Skip to content

feat(cohere): upgrade integration from ai to gen_ai#5532

Draft
shellmayr wants to merge 9 commits intomasterfrom
shellmayr/feat/upgrade-cohere-ai-integration-from-ai-to-genai
Draft

feat(cohere): upgrade integration from ai to gen_ai#5532
shellmayr wants to merge 9 commits intomasterfrom
shellmayr/feat/upgrade-cohere-ai-integration-from-ai-to-genai

Conversation

@shellmayr
Copy link
Member

@shellmayr shellmayr commented Feb 25, 2026

This PR encompasses multiple changes to accomplish this

  • Add support for the "new" v2 of cohere which was released at the end of 2024. The instrumentation is in a separate file to prevent confusion between the versions.
  • Move the auto-instrumentation for v1 from ai.* attributes to gen_ai.* attributes
  • Adapt / add tests for v1 and v2
  • Has been run against two new templates for cohere in the testing framework
  • Cohere is on the level of e.g. anthropic and openai, meaning that there is no agentic flavor to this, it is "just" an API for LLM-calling for Cohere's own models

Closes TET-2023

@github-actions
Copy link
Contributor

github-actions bot commented Feb 25, 2026

Semver Impact of This PR

🟡 Minor (new features)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (cohere) Upgrade integration from ai to gen_ai by shellmayr in #5532
  • Add set_attribute, remove_attribute to global API by sentrivana in #5555

Bug Fixes 🐛

Openai

  • Avoid consuming iterables passed to the Completions API by alexander-alderman-webb in #5489
  • Avoid consuming iterables passed to the Embeddings API by alexander-alderman-webb in #5491

Other

  • (anthropic) Fix token accounting by shellmayr in #5490
  • (google-genai) Remove agent spans for simple requests by alexander-alderman-webb in #5443
  • (grpc) Read method from handler_call_details for grpcio >= 1.76 compat by yeung108 in #5521
  • (httpx) Correctly append baggage in async client by sentrivana in #5530
  • (pydantic-ai) Adapt to missing ToolManager._call_tool by sentrivana in #5522
  • (utils) Use HEROKU_BUILD_COMMIT env var for default release by ericapisani in #5499
  • (wsgi) Do not wrap file responses when uWSGI offload-threads is enabled by ericapisani in #5556

Documentation 📚

  • Add troubleshooting note for editable installs with uWSGI by ericapisani in #5552
  • Add debugging advice by alexander-alderman-webb in #5517
  • New integration guide by alexander-alderman-webb in #5476

Internal Changes 🔧

Agents

  • Add security-review skill to agent configuration by ericapisani in #5498
  • Add sentry skills to be used by warden in CI reviews by ericapisani in #5485

Openai Agents

  • Remove set_data_normalized for primitive attributes by alexander-alderman-webb in #5509
  • Expect new tool fields by alexander-alderman-webb in #5471

Other

  • (ai) Add configuration for dotagents by ericapisani in #5480
  • (anthropic) Remove set_data_normalized for primitive attributes by alexander-alderman-webb in #5504
  • (github) Add warden configuration by ericapisani in #5484
  • (pydantic-ai) Remove set_data_normalized for the gen_ai.response.model attribute by alexander-alderman-webb in #5512
  • (repo) Add .serena to .gitignore by ericapisani in #5464
  • Updated codecov.yml by MathurAditya724 in #5571
  • 🤖 Update test matrix with new releases (02/24) by github-actions in #5524
  • 🤖 Update test matrix with new releases (02/23) by github-actions in #5503
  • 🤖 Update test matrix with new releases (02/19) by github-actions in #5483
  • 🤖 Update test matrix with new releases (02/18) by github-actions in #5475

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 25, 2026

Codecov Results 📊

13 passed | Total: 13 | Pass Rate: 100% | Execution Time: 7.28s

📊 Comparison with Base Branch

Metric Change
Total Tests
Passed Tests
Failed Tests
Skipped Tests

✨ No test changes detected

All tests are passing successfully.

❌ Patch coverage is 5.00%. Project has 13908 uncovered lines.
✅ Project coverage is 30.5%. Comparing base (base) to head (head).

Files with missing lines (4)
File Patch % Lines
utils.py 16.08% ⚠️ 214 Missing
v2.py 0.00% ⚠️ 134 Missing
v1.py 0.00% ⚠️ 107 Missing
__init__.py 25.42% ⚠️ 44 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    25.65%    30.50%    +4.85%
==========================================
  Files          189       191        +2
  Lines        19838     20012      +174
  Branches      6430      6500       +70
==========================================
+ Hits          5089      6104     +1015
- Misses       14749     13908      -841
- Partials       421       468       +47

Generated by Codecov Action

@linear
Copy link

linear bot commented Feb 27, 2026

GEN_AI_ALLOWED_MESSAGE_ROLES.SYSTEM: ["system"],
GEN_AI_ALLOWED_MESSAGE_ROLES.USER: ["user", "human"],
GEN_AI_ALLOWED_MESSAGE_ROLES.ASSISTANT: ["assistant", "ai"],
GEN_AI_ALLOWED_MESSAGE_ROLES.ASSISTANT: ["assistant", "ai", "chatbot"],
Copy link
Member Author

Choose a reason for hiding this comment

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

This is needed because cohere sometimes uses the role chatbot in their message structure

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.

1 participant