llm = Bedrock(model="anthropic.claude-3-sonnet-20240229-v1:0") messages = [ ChatMessage(role="system", content="You are a pirate with a colorful personality"), ChatMessage(role="user", content="Tell me a story"), ] llm.chat(messages=[ ChatMessage(role="system", content="You are a pirate with a colorful personality"), ChatMessage(role="user", content="Tell me a story"), ])
The above code is throwing the below error File "C:\Users\Jay\OneDrive\coding_projects\RAG_AWS_Neptune\venv\Lib\site-packages\llama_index\llms\bedrock\utils.py", line 157, in get_request_body if len(prompt) > 0 and prompt[0]["role"] == "system": ~~~~~^^^^^^^^ TypeError: string indices must be integers, not 'str'
This happens for both 'chat' and 'complete' method
@Logan M I was getting the same error using the Bedrock llm class with LlamaIndex evaluators (specifially the CorrectnessEvaluator), but the bedrock-converse workaround solved it, so thank you!