mirror of
https://github.com/hwchase17/langchain
synced 2024-11-08 07:10:35 +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]
|
||||
|
||||
|
||||
class AdditionalResultAttributeValue(BaseModel, extra=Extra.allow):
|
||||
TextWithHighlightsValue: TextWithHighLights
|
||||
|
||||
|
||||
class AdditionalResultAttribute(BaseModel, extra=Extra.allow):
|
||||
Key: str
|
||||
ValueType: Literal["TEXT_WITH_HIGHLIGHTS_VALUE"]
|
||||
Value: Optional[TextWithHighLights]
|
||||
Value: AdditionalResultAttributeValue
|
||||
|
||||
def get_value_text(self) -> str:
|
||||
if not self.Value:
|
||||
return ""
|
||||
else:
|
||||
return self.Value.Text
|
||||
return self.Value.TextWithHighlightsValue.Text
|
||||
|
||||
|
||||
class QueryResultItem(BaseModel, extra=Extra.allow):
|
||||
|
Loading…
Reference in New Issue
Block a user