mirror of
https://github.com/Mintplex-Labs/langchain-python.git
synced 2026-07-19 21:33:31 -04: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:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user