Commit fa2f6ec
committed
fix(langchain): read AzureOpenAI API version from openai_api_version
`_extract_model_name` for `AzureOpenAI` checks
`serialized_kwargs["openai_api_version"]` to decide whether a version
is available, then reads the value from `serialized_kwargs["deployment_version"]`
(`langfuse/langchain/utils.py:73-74`). LangChain's `AzureOpenAI` doesn't
expose a `deployment_version` field — only `openai_api_version` and
`deployment_name` — so `deployment_version` is always `None`, the
`isinstance(deployment_version, str)` check fails, and the function
returns the bare deployment name with no version suffix.
Read the value from the same key that gates the branch
(`openai_api_version`). Combined with the deduplication logic added in
PR #1203, deployments now produce `<deployment_name>-<api_version>` —
matching the documented intent of this code path — while still
collapsing if the deployment_name already embeds the version.
Add `tests/unit/test_extract_model_name.py` with three regression cases:
api_version present, api_version absent, and the dedup path from #1203.1 parent 8bcc8fa commit fa2f6ec
2 files changed
Lines changed: 52 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
73 | 77 | | |
74 | | - | |
| 78 | + | |
75 | 79 | | |
76 | 80 | | |
77 | 81 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
0 commit comments