The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
Update kendra.py to avoid Kendra query ValidationException (#14866)
abhjaw6fbd068b3fc9
diff --git a/libs/community/langchain_community/retrievers/kendra.py b/libs/community/langchain_community/retrievers/kendra.pyindex ec1554c0ab..e93ef3ff56 100644--- a/libs/community/langchain_community/retrievers/kendra.py+++ b/libs/community/langchain_community/retrievers/kendra.py@@ -379,7 +379,9 @@ class AmazonKendraRetriever(BaseRetriever):def _kendra_query(self, query: str) -> Sequence[ResultItem]:kendra_kwargs = {"IndexId": self.index_id,- "QueryText": query.strip(),+ # truncate the query to ensure that+ # there is no validation exception from Kendra.+ "QueryText": query.strip()[0:999],"PageSize": self.top_k,}if self.attribute_filter is not None: