You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When trying to use the documents parameter with co.chat() method in the Cohere Python SDK v5.11.4, receiving a TypeError indicating that documents is an unexpected keyword argument.
The error occurs when trying to use the chat endpoint with RAG:
chat_response = co.chat(
model="command-r-plus-08-2024",
messages=chat_messages,
documents=[{
"data": {"text": doc["text"]}
} for doc in context_docs],
temperature=0.2
)
Error Message
TypeError: V2Client.chat() got an unexpected keyword argument 'documents'
Expected Behavior
Based on the Cohere documentation, the chat endpoint should accept a documents parameter for RAG functionality.
Actual Behavior
The SDK throws a TypeError when attempting to use the documents parameter.
Steps to Reproduce
Initialize Cohere client with V2 endpoint (co = cohere.ClientV2(...)
Prepare chat messages and context documents
Call co.chat() with documents parameter
The text was updated successfully, but these errors were encountered:
The solution: I had to cast id of the documents to be of type string, which the documentation does say. The error message should indicate that document IDs must be strings, like:
'TypeError: Document IDs must be of type string in the documents parameter. Please ensure all document IDs are properly cast to strings before making the chat request.'
SDK Version (required): 5.11.4
Describe the bug
When trying to use the documents parameter with co.chat() method in the Cohere Python SDK v5.11.4, receiving a TypeError indicating that documents is an unexpected keyword argument.
The error occurs when trying to use the chat endpoint with RAG:
Error Message
Expected Behavior
Based on the Cohere documentation, the chat endpoint should accept a
documents
parameter for RAG functionality.Actual Behavior
The SDK throws a TypeError when attempting to use the
documents
parameter.Steps to Reproduce
co = cohere.ClientV2(
...)co.chat()
with documents parameterThe text was updated successfully, but these errors were encountered: