Skip to content

fix(langchain): use default EmbeddingInvocation operation_name instead of hardcoded value#214

Open
adityamehra wants to merge 1 commit intomainfrom
fix/embedding-default-operation-name
Open

fix(langchain): use default EmbeddingInvocation operation_name instead of hardcoded value#214
adityamehra wants to merge 1 commit intomainfrom
fix/embedding-default-operation-name

Conversation

@adityamehra
Copy link
Contributor

Summary

  • Remove explicit operation_name="embedding" (singular) from the langchain embedding wrapper, allowing the correct semantic convention default "embeddings" (plural) from EmbeddingInvocation types.py to be used
  • Add embedding invocation tests in util/opentelemetry-util-genai covering default operation_name, semconv attributes, span name formatting, error path, and override behaviour
  • Add VCR integration tests in langchain instrumentation for both success and error embedding paths, following the same pattern as test_langchain_llm.py

Test plan

  • Linting passed (ruff check + ruff format)
  • Tests passed for util/opentelemetry-util-genai (8 tests)
  • Tests passed for instrumentation-genai/opentelemetry-instrumentation-langchain (2 tests)
  • Full langchain test suite passes (13 tests)

Made with Cursor

…d of hardcoded value

The langchain instrumentation was setting operation_name="embedding" (singular)
which overrode the correct semantic convention default of "embeddings" (plural)
defined in EmbeddingInvocation types.py. Remove the explicit override so the
dataclass default from GenAiOperationNameValues.EMBEDDINGS is used.

Add embedding tests for both packages:
- util-genai: default operation_name, semconv attributes, span name, error path
- langchain: VCR integration tests for success and error paths

Co-authored-by: Cursor <cursoragent@cursor.com>
@adityamehra adityamehra requested review from a team as code owners February 14, 2026 01:03
@shuningc
Copy link
Contributor

Do we need to add the changes to Changelog?

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.

3 participants