Skip to content

Commit e280ceb

Browse files
authored
fix(ai-sdk): Add model mapping to azure (#892)
1 parent ddb1241 commit e280ceb

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

packages/traceloop-sdk/src/lib/tracing/ai-sdk-transformations.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ const ROLE_USER = "user";
6666
// Uses prefixes to match AI SDK patterns like "openai.chat", "anthropic.messages", etc.
6767
const VENDOR_MAPPING: Record<string, string> = {
6868
openai: "OpenAI",
69+
azure: "Azure",
6970
"azure-openai": "Azure",
7071
anthropic: "Anthropic",
7172
cohere: "Cohere",

packages/traceloop-sdk/test/ai-sdk/ai-sdk-transformations.test.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,6 +1016,22 @@ describe("AI SDK Transformations", () => {
10161016
});
10171017
});
10181018

1019+
it("should transform azure provider (ai-sdk/azure) to Azure system", () => {
1020+
const azureProviders = ["azure.chat", "azure.completions", "azure"];
1021+
1022+
azureProviders.forEach((provider) => {
1023+
const attributes = {
1024+
"ai.model.provider": provider,
1025+
};
1026+
1027+
transformLLMSpans(attributes);
1028+
1029+
assert.strictEqual(attributes[ATTR_GEN_AI_PROVIDER_NAME], "azure");
1030+
assert.strictEqual(attributes[ATTR_GEN_AI_SYSTEM], "Azure");
1031+
assert.strictEqual(attributes["ai.model.provider"], undefined);
1032+
});
1033+
});
1034+
10191035
it("should transform other providers to their value", () => {
10201036
const attributes = {
10211037
"ai.model.provider": "anthropic",

0 commit comments

Comments
 (0)