Closed Thato-Lesetla closed 3 weeks ago
i am getting this same error with:
PROMPT = PromptTemplate(input_variables=["context", "question"], template=prompt_template)
query_answer = RetrievalQA.from_chain_type(
llm=bedrock_llm,
chain_type="stuff",
retriever=opensearch_vector_search_client.as_retriever(),
return_source_documents=True,
chain_type_kwargs={
"prompt": PROMPT,
"verbose": True,
},
verbose=True,
)
response = query_answer(inputs={"query": question, "context": context})
langchain==1.0.9 boto3==1.34.49 opensearch-py==2.4.2
Lambda is using Python3.12
I am getting this same error, but in the node library. Did you guys find the solution?
Hi @Thato-Lesetla,
looking at your code snippet I believe the reason for the error is that you're specifying the Titan embedding model as the chat model.
), Bedrock(
model_id="amazon.titan-embed-text-v1", client=bedrock_runtime, region_name="us-east-1"
)
I was able to reproduce this with amazon.titan-embed-text-v1
. However, if you use e.g. amazon.titan-text-premier-v1:0
it should work (since the Titan text generation models support the textGenerationConfig
parameter, see the docs).
Please also note that since you opened the issue the code has changed quite a bit, most notably we're not using the plain Bedrock
class anymore but instead ChatBedrock
.
Closing this issue for now.
Good day, I'm currently getting the below error when triggering the response lambda. I'm currently using a different model then the one specified on the repo.
[ERROR] ValueError: Error raised by bedrock service: An error occurred (ValidationException) when calling the InvokeModel operation: Malformed input request: extraneous key [textGenerationConfig] is not permitted, please reformat your input and try again.
` logger.info("Executing vector embeddings") embeddings, llm = BedrockEmbeddings( model_id="amazon.titan-embed-text-v1", client=bedrock_runtime, region_name="us-east-1", ), Bedrock( model_id="amazon.titan-embed-text-v1", client=bedrock_runtime, region_name="us-east-1" ) faiss_index = FAISS.load_local("/tmp", embeddings)
`