Skip to content

Commit

Permalink
Fix: add bedrock branch logic while creating kg index (#574)
Browse files Browse the repository at this point in the history
Error occurred when using bedrock as llm provider caused by malformed
input request.

botocore.errorfactory.ValidationException: An error occurred
(ValidationException) when calling the InvokeModel operation: Malformed
input request: #: subject must not be valid against schema
{"required":["messages"]}#: extraneous key [response_mime_type] is not
permitted, please reformat your input and try again.
  • Loading branch information
NG85 authored Jan 7, 2025
1 parent c1efd7f commit 25d01a2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions backend/app/rag/knowledge_graph/extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ def get_llm_output_config(self):
# ollama support set format=json in the top-level request config, but not in the request's option
# https://github.com/ollama/ollama/blob/5e2653f9fe454e948a8d48e3c15c21830c1ac26b/api/types.go#L70
return {}
elif "bedrock" in self.dspy_lm.provider.lower():
# Fix: add bedrock branch to fix 'Malformed input request' error
# subject must not be valid against schema {"required":["messages"]}: extraneous key [response_mime_type] is not permitted
return {}
else:
return {
"response_mime_type": "application/json",
Expand Down

0 comments on commit 25d01a2

Please sign in to comment.