Skip to content

Commit

Permalink
Update kendra.py
Browse files Browse the repository at this point in the history
Fixing issue - #14494 to avoid Kendra query ValidationException
  • Loading branch information
abhjaw authored Dec 18, 2023
1 parent 92957e6 commit e461743
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libs/community/langchain_community/retrievers/kendra.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ def create_client(cls, values: Dict[str, Any]) -> Dict[str, Any]:
def _kendra_query(self, query: str) -> Sequence[ResultItem]:
kendra_kwargs = {
"IndexId": self.index_id,
"QueryText": query.strip(),
"QueryText": query.strip()[0:999], #trucate the query to ensure that there is no validation exception from Kendra.

Check failure on line 382 in libs/community/langchain_community/retrievers/kendra.py

View workflow job for this annotation

GitHub Actions / Check for spelling errors

trucate ==> truncate

Check failure on line 382 in libs/community/langchain_community/retrievers/kendra.py

View workflow job for this annotation

GitHub Actions / ci (libs/community) / lint / build (3.8)

Ruff (E501)

langchain_community/retrievers/kendra.py:382:89: E501 Line too long (126 > 88)

Check failure on line 382 in libs/community/langchain_community/retrievers/kendra.py

View workflow job for this annotation

GitHub Actions / ci (libs/community) / lint / build (3.11)

Ruff (E501)

langchain_community/retrievers/kendra.py:382:89: E501 Line too long (126 > 88)
"PageSize": self.top_k,
}
if self.attribute_filter is not None:
Expand Down

0 comments on commit e461743

Please sign in to comment.