Skip to content

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

Draft
shellmayr wants to merge 15 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 15 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 cohere package continues to contain the v1 and v2 APIs, therefore we still need to support both. 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
  • Semantically, Cohere is a model-provider 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

Bug Fixes 🐛

  • (celery) Propagate user-set headers by sentrivana in #5581

Documentation 📚

  • Add AGENTS.md by sentrivana in #5579
  • Add set_attribute example to changelog by sentrivana in #5578

🤖 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: 9.92s

All tests are passing successfully.

❌ Patch coverage is 6.47%. Project has 13973 uncovered lines.

Files with missing lines (6)
File Patch % Lines
utils.py 16.08% ⚠️ 214 Missing
v2.py 0.00% ⚠️ 108 Missing
v1.py 0.00% ⚠️ 90 Missing
__init__.py 25.00% ⚠️ 42 Missing
span_config.py 17.65% ⚠️ 28 Missing
utils.py 0.00% ⚠️ 21 Missing

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