mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-21 03:51:42 +00:00
Added missing attribute value object (#6849)
## Description Adds a missing type class for [AdditionalResultAttributeValue](https://docs.aws.amazon.com/kendra/latest/APIReference/API_AdditionalResultAttributeValue.html). Fixes validation failure for the query API that have `AdditionalAttributes` in the response. cc @dev2049 cc @zhichenggeng
This commit is contained in:
parent
e494b0a09f
commit
e53995836a
@ -32,16 +32,17 @@ class TextWithHighLights(BaseModel, extra=Extra.allow):
|
|||||||
Highlights: Optional[Any]
|
Highlights: Optional[Any]
|
||||||
|
|
||||||
|
|
||||||
|
class AdditionalResultAttributeValue(BaseModel, extra=Extra.allow):
|
||||||
|
TextWithHighlightsValue: TextWithHighLights
|
||||||
|
|
||||||
|
|
||||||
class AdditionalResultAttribute(BaseModel, extra=Extra.allow):
|
class AdditionalResultAttribute(BaseModel, extra=Extra.allow):
|
||||||
Key: str
|
Key: str
|
||||||
ValueType: Literal["TEXT_WITH_HIGHLIGHTS_VALUE"]
|
ValueType: Literal["TEXT_WITH_HIGHLIGHTS_VALUE"]
|
||||||
Value: Optional[TextWithHighLights]
|
Value: AdditionalResultAttributeValue
|
||||||
|
|
||||||
def get_value_text(self) -> str:
|
def get_value_text(self) -> str:
|
||||||
if not self.Value:
|
return self.Value.TextWithHighlightsValue.Text
|
||||||
return ""
|
|
||||||
else:
|
|
||||||
return self.Value.Text
|
|
||||||
|
|
||||||
|
|
||||||
class QueryResultItem(BaseModel, extra=Extra.allow):
|
class QueryResultItem(BaseModel, extra=Extra.allow):
|
||||||
|
Loading…
Reference in New Issue
Block a user