Skip to content

fix(langchain): prefer response model metadata over request alias - #2146

Open
jcd1991 wants to merge 1 commit into
langfuse:mainfrom
jcd1991:codex/langchain-model-name
Open

jcd1991 wants to merge 1 commit into
langfuse:mainfrom
jcd1991:codex/langchain-model-name

Conversation

@jcd1991

@jcd1991 jcd1991 commented Nov 22, 2026 •

Copy link
Copy Markdown

Summary

  • prefer the model name returned in generation info or response metadata over a request alias
  • retain the existing llm_output["model_name"] value as a fallback
  • add regression coverage for both LangChain response shapes

Related: langfuse/langfuse#4672

Verification

  • uv run --frozen pytest -n auto --dist worksteal tests/unit -q — 1039 passed, 2 skipped
  • uv run --frozen ruff check . — passed
  • uv run --frozen ruff format --check . — passed
  • uv run --frozen mypy langfuse --no-error-summary — passed
  • git diff --check — passed

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge.

Summary

The PR makes _parse_model prefer the returned model name over the request alias.

  • LangChain spans prefer the model name returned with each response.

No actionable issues found. Tests were not run during this review.

Reviews (1) · Last reviewed commit: "fix(langchain): prefer response model me..." · Reviewed by Greptile

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

This branch has not been deployed

No deployments
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