Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC: Update documentation for ChatCohere class to include response_format parameter #26550

Open
2 tasks done
ryanchase-cohere opened this issue Sep 16, 2024 · 3 comments
Open
2 tasks done
Labels
🤖:docs Changes to documentation and examples, like .md, .rst, .ipynb files. Changes to the docs/ folder stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed

Comments

@ryanchase-cohere
Copy link

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

  • I added a very descriptive title to this issue.
  • 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

@dosubot dosubot bot added the 🤖:docs Changes to documentation and examples, like .md, .rst, .ipynb files. Changes to the docs/ folder label Sep 16, 2024
@tibor-reiss
Copy link
Contributor

tibor-reiss commented Sep 22, 2024

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.

@ryanchase-cohere
Copy link
Author

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 ?

Copy link

dosubot bot commented Dec 24, 2024

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_format parameter in the ChatCohere class.
  • @tibor-reiss mentioned that response_format is handled via kwargs and is documented in the Cohere documentation.
  • You inquired about supporting JSON mode in the ChatCohere wrapper 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!

@dosubot dosubot bot added the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖:docs Changes to documentation and examples, like .md, .rst, .ipynb files. Changes to the docs/ folder stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed
Projects
None yet
Development

No branches or pull requests

2 participants