DOC: Update documentation for ChatCohere class to include `response_format` parameter
URL
https://python.langchain.com/v0.2/api_reference/cohere/chat_models/langchain_cohere.chat_models.ChatCohere.html#langchain_cohere.chat_models.ChatCohere.model
Checklist
- [X] I added a very descriptive title to this issue.
- [X] I included a link to the documentation page I am referring to (if applicable).
Issue with current documentation:
The documentation for the ChatCohere class is missing the response_format parameter.
The response_format parameter appears to be a valid parameter when using the ChatCohere class. Example usage:
!pip install langchain_cohere
from langchain_cohere.chat_models import ChatCohere
llm = ChatCohere(cohere_api_key=COHERE_API_KEY, model="command-r-plus")
res = llm.invoke("John is five years old", response_format={
"type": "json_object",
"schema": {
"title": "Person",
"description": "Identifies the age and name of a person",
"type": "object",
"properties": {
"name": { "type": "string", "description": "Name of the person" },
"age": { "type": "number", "description": "Age of the person" },
},
"required": [
"name",
"age",
],
}
}
)
Idea or request for content:
No response
langchain is just a wrapper in this case. response_format is passed in via kwargs and then propagated to the appropriate calling function, in this case BaseCohere.chat - this has dozens of other kwargs (https://github.com/cohere-ai/cohere-python/blob/main/src/cohere/base_client.py#L706). So this is documented in the cohere docs, e.g. https://docs.cohere.com/v1/docs/structured-outputs-json.
what else is required so that Json mode is supported by the ChatCohere wrapper such that it would be reflected in this table https://python.langchain.com/v0.2/docs/integrations/chat/#featured-providers ?
Hi, @ryanchase-cohere. I'm Dosu, and I'm helping the LangChain team manage their backlog. I'm marking this issue as stale.
Issue Summary
- The issue highlights missing documentation for the
response_formatparameter in theChatCohereclass. - @tibor-reiss mentioned that
response_formatis handled viakwargsand is documented in the Cohere documentation. - You inquired about supporting JSON mode in the
ChatCoherewrapper and its reflection in the LangChain documentation.
Next Steps
- Please confirm if this issue is still relevant to the latest version of the LangChain repository. If so, feel free to comment to keep the discussion open.
- If there is no further activity, this issue will be automatically closed in 7 days.
Thank you for your understanding and contribution!