Skip to content

Conversation

phlogisticfugu
Copy link

@phlogisticfugu phlogisticfugu commented Oct 10, 2025

  • support V1 and V2 Cohere SDK clients (default to V2)
  • pass model explicitly in calls (fixing existing issue)
  • update tests and examples to use V2
  • fix ollama cohere models which support tool calling
  • add comments for more models

Important

Update Cohere integration to support V1 and V2 API clients, defaulting to V2, with updated tests and examples.

  • Behavior:
    • Support for both V1 and V2 Cohere SDK clients in instructor/providers/cohere/client.py, defaulting to V2.
    • Explicit model specification in API calls to fix existing issues.
    • Updated response handling to accommodate V2 API structure in instructor/processing/function_calls.py and instructor/providers/cohere/utils.py.
  • Testing:
    • Updated tests in tests/llm/test_cohere/test_json_schema.py and tests/llm/test_cohere/test_none_response.py to use V2 API.
    • Added fixtures for V1 and V2 clients in tests/llm/test_cohere/conftest.py.
  • Documentation:
    • Updated examples in docs/examples/document_segmentation.md and docs/integrations/cohere.md to use V2 API.
  • Misc:
    • Minor code formatting changes in examples/caching/run.py and instructor/processing/multimodal.py.

This description was created by Ellipsis for cee3a6d. You can customize this summary. It will automatically update as commits are pushed.

- support V1 and V2 Cohere SDK clients
- pass model explicitly in calls (fixing existing issue)
- update tests and examples to use V2
- fix ollama cohere models which support tool calling
- add comments for more models
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Looks good to me! 👍

Reviewed everything up to cee3a6d in 1 minute and 32 seconds. Click for details.
  • Reviewed 965 lines of code in 23 files
  • Skipped 0 files when reviewing.
  • Skipped posting 6 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. tests/test_process_response.py:7
  • Draft comment:
    In test_typed_dict_conversion(), adding a comment explaining why the TypedDict and Pydantic model conversions are equivalent would clarify the assumptions for future maintainers.
  • Reason this comment was not posted:
    Confidence changes required: 70% <= threshold 85% None
2. tests/test_process_response.py:22
  • Draft comment:
    In test_openai_to_bedrock_conversion(), an inline comment explaining the transformation logic (e.g. removal of 'model' and creation of 'modelId', as well as the expected two messages) would improve clarity.
  • Reason this comment was not posted:
    Confidence changes required: 60% <= threshold 85% None
3. tests/test_process_response.py:45
  • Draft comment:
    In test_bedrock_round_trip(), add a comment noting that preserving the original input via deep copy is critical for ensuring round-trip integrity.
  • Reason this comment was not posted:
    Confidence changes required: 60% <= threshold 85% None
4. tests/test_process_response.py:109
  • Draft comment:
    In test_empty_and_missing_content(), consider documenting any expected side effects (like logging warnings) when handling empty messages or missing content.
  • Reason this comment was not posted:
    Confidence changes required: 50% <= threshold 85% None
5. tests/test_process_response.py:123
  • Draft comment:
    In test_bedrock_invalid_content_format(), using pytest.raises with the match parameter to assert the specific error message would be clearer than manually raising an AssertionError.
  • Reason this comment was not posted:
    Confidence changes required: 70% <= threshold 85% None
6. instructor/providers/cohere/utils.py:209
  • Draft comment:
    Typo: The comment references 'handle_cohere_modes', but the function is named 'handle_cohere_tools'. Please verify and correct if needed.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.

Workflow ID: wflow_9jLdYa2oMPpJ9r4D

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants