Skip to content

fix(cohere): accept cohere 6.x and 7.x in the dependency check - #4409

Open
Anai-Guo wants to merge 1 commit into
traceloop:mainfrom
Anai-Guo:fix-cohere-instruments-bound
Open

fix(cohere): accept cohere 6.x and 7.x in the dependency check#4409
Anai-Guo wants to merge 1 commit into
traceloop:mainfrom
Anai-Guo:fix-cohere-instruments-bound

Conversation

@Anai-Guo

@Anai-Guo Anai-Guo commented Aug 10, 2026

Copy link
Copy Markdown

Problem

opentelemetry-instrumentation-cohere declares

_instruments = ("cohere >=4.2.7, <6",)

BaseInstrumentor.instrument() checks that against the installed distribution and, on a conflict, logs a DependencyConflict and returns without instrumenting anything. Cohere shipped 6.0.0 on 2026-04-08 and 7.0.0 on 2026-05-22, so anyone on a current cohere gets:

DependencyConflict: requested: "cohere >=4.2.7, <6" but found: "cohere 7.0.8"

and then simply no spans — no exception, no warning at the call site.

The cap is not protecting anything real. Everything this instrumentation touches is unchanged in 7.x:

  • cohere.client.Client still subclasses BaseCohere, which still defines generate, chat, chat_stream and rerank — all four WRAPPED_METHODS targets resolve.
  • The response models the span/event code reads are field-for-field the same: Generation.id / .generations[].text / .id, NonStreamedChatResponse.text / .response_id, RerankResponse.id / .results[].index / .relevance_score / .document.

Change

One line: <6<8.

Verification

Ran the package's own test suite against cohere==7.0.8 (everything else per the test group), before and after the change:

result
before (<6) 25 failedIndexError: tuple index out of range in every test, i.e. the exporter got zero spans, plus assert 0 == 1 on the embed span counts
after (<8) 25 passed

The recorded cassettes replay unchanged under 7.x, so the wire traffic for the v1 chat / generate / rerank / embed endpoints is identical too.

Note on CI

I deliberately left the test group pinned at cohere>=5.18.0,<6, so this PR does not touch uv.lock and CI keeps exercising the version it exercises today (where the change is a no-op). Happy to bump the test pin to <8 in this PR if you'd rather have CI cover 7.x — as shown above the suite is already green there.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added support for Cohere versions 6 and 7 in the OpenTelemetry instrumentation.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: dfb64902-b64a-48be-9878-ba67d9742833

📥 Commits

Reviewing files that changed from the base of the PR and between 62e24c2 and d43ede4.

📒 Files selected for processing (1)
  • packages/opentelemetry-instrumentation-cohere/opentelemetry/instrumentation/cohere/__init__.py

📝 Walkthrough

Walkthrough

The Cohere instrumentation dependency range now supports versions >=4.2.7, <8 instead of <6.

Changes

Cohere dependency support

Layer / File(s) Summary
Update Cohere version range
packages/opentelemetry-instrumentation-cohere/opentelemetry/instrumentation/cohere/__init__.py
The supported Cohere version upper bound changes from <6 to <8.

Estimated code review effort: 1 (Trivial) | ~2 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: accepting Cohere 6.x and 7.x versions in the dependency check.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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