@struct-ai/sdk 0.4.5 → 0.4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,14 +13,30 @@ exports.lastUserMessageParts = lastUserMessageParts;
13
13
  exports.mergeChunks = mergeChunks;
14
14
  const truncation_js_1 = require("../truncation.js");
15
15
  const semconv_js_1 = require("../semconv.js");
16
+ // Values MUST be `gen_ai.provider.name` well-known values from the OTel GenAI
17
+ // registry (now open-telemetry/semantic-conventions-genai; the attribute is
18
+ // marked Moved in the main semantic-conventions repo). Re-validated against the
19
+ // registry 2026-09-30, which defines exactly: openai, gcp.gen_ai, gcp.vertex_ai,
20
+ // gcp.gemini, anthropic, cohere, azure.ai.inference, azure.ai.openai,
21
+ // ibm.watsonx.ai, aws.bedrock, perplexity, x_ai, deepseek, groq, mistral_ai,
22
+ // moonshot_ai.
23
+ // Two values here were NOT in that enum and were corrected 2026-09-30:
24
+ // gcp.generative_ai -> gcp.gemini (ChatGoogleGenerativeAI targets
25
+ // generativelanguage.googleapis.com, which
26
+ // is exactly when the spec says gcp.gemini)
27
+ // mistral -> mistral_ai (also disagreed with openai.ts's own host
28
+ // map, which had mistral_ai right already)
29
+ // This map is a cross-language contract: keep it in step with
30
+ // struct-sdk-python's _PROVIDER_MAP / _MODULE_PROVIDER_MAP in langchain.py.
31
+ // fireworks / together / ollama are deliberate open-enum extensions.
16
32
  exports.PROVIDER_MAP = {
17
33
  ChatOpenAI: "openai",
18
34
  AzureChatOpenAI: "azure.ai.openai",
19
35
  ChatAnthropic: "anthropic",
20
- ChatGoogleGenerativeAI: "gcp.generative_ai",
36
+ ChatGoogleGenerativeAI: "gcp.gemini",
21
37
  ChatVertexAI: "gcp.vertex_ai",
22
38
  ChatCohere: "cohere",
23
- ChatMistralAI: "mistral",
39
+ ChatMistralAI: "mistral_ai",
24
40
  ChatGroq: "groq",
25
41
  ChatBedrock: "aws.bedrock",
26
42
  ChatBedrockConverse: "aws.bedrock",
@@ -33,9 +49,15 @@ exports.PROVIDER_MAP = {
33
49
  exports.MODULE_PROVIDER_MAP = {
34
50
  openai: "openai",
35
51
  anthropic: "anthropic",
36
- google: "gcp.generative_ai",
52
+ // Order matters: first matching segment wins. langchain_google_vertexai
53
+ // splits into [langchain, google, vertexai], so "vertexai" must precede
54
+ // "google" or Vertex traffic is labelled gcp.gemini (the AI Studio endpoint).
55
+ vertexai: "gcp.vertex_ai",
56
+ google: "gcp.gemini",
37
57
  cohere: "cohere",
38
- mistral: "mistral",
58
+ // The partner package is langchain_mistralai, whose segment is "mistralai".
59
+ mistralai: "mistral_ai",
60
+ mistral: "mistral_ai",
39
61
  groq: "groq",
40
62
  bedrock: "aws.bedrock",
41
63
  fireworks: "fireworks",
@@ -118,6 +118,14 @@ const OPENAI_COMPATIBLE_HOSTS = new Map([
118
118
  ["api.groq.com", "groq"],
119
119
  ["api.deepseek.com", "deepseek"],
120
120
  ["api.mistral.ai", "mistral_ai"],
121
+ // Enum values verified 2026-10-01 against each vendor's own API docs.
122
+ ["api.perplexity.ai", "perplexity"],
123
+ ["api.moonshot.ai", "moonshot_ai"],
124
+ ["api.moonshot.cn", "moonshot_ai"],
125
+ // Cohere's OpenAI-compatible endpoint is api.cohere.ai/compatibility/v1;
126
+ // its docs also use api.cohere.com for the same path.
127
+ ["api.cohere.ai", "cohere"],
128
+ ["api.cohere.com", "cohere"],
121
129
  ]);
122
130
  const HOST_RULES = [
123
131
  [isAzureHost, "azure.ai.openai"],
@@ -1,2 +1,2 @@
1
- export declare const SDK_VERSION = "0.4.5";
1
+ export declare const SDK_VERSION = "0.4.7";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
4
  // Keep in sync with package.json; test/version.test.ts enforces it.
5
- exports.SDK_VERSION = "0.4.5";
5
+ exports.SDK_VERSION = "0.4.7";
6
6
  //# sourceMappingURL=version.js.map
@@ -1,13 +1,29 @@
1
1
  import { truncateAndSerialize } from "../truncation.js";
2
2
  import { LANGCHAIN_FINISH_REASON_MAP } from "../semconv.js";
3
+ // Values MUST be `gen_ai.provider.name` well-known values from the OTel GenAI
4
+ // registry (now open-telemetry/semantic-conventions-genai; the attribute is
5
+ // marked Moved in the main semantic-conventions repo). Re-validated against the
6
+ // registry 2026-09-30, which defines exactly: openai, gcp.gen_ai, gcp.vertex_ai,
7
+ // gcp.gemini, anthropic, cohere, azure.ai.inference, azure.ai.openai,
8
+ // ibm.watsonx.ai, aws.bedrock, perplexity, x_ai, deepseek, groq, mistral_ai,
9
+ // moonshot_ai.
10
+ // Two values here were NOT in that enum and were corrected 2026-09-30:
11
+ // gcp.generative_ai -> gcp.gemini (ChatGoogleGenerativeAI targets
12
+ // generativelanguage.googleapis.com, which
13
+ // is exactly when the spec says gcp.gemini)
14
+ // mistral -> mistral_ai (also disagreed with openai.ts's own host
15
+ // map, which had mistral_ai right already)
16
+ // This map is a cross-language contract: keep it in step with
17
+ // struct-sdk-python's _PROVIDER_MAP / _MODULE_PROVIDER_MAP in langchain.py.
18
+ // fireworks / together / ollama are deliberate open-enum extensions.
3
19
  export const PROVIDER_MAP = {
4
20
  ChatOpenAI: "openai",
5
21
  AzureChatOpenAI: "azure.ai.openai",
6
22
  ChatAnthropic: "anthropic",
7
- ChatGoogleGenerativeAI: "gcp.generative_ai",
23
+ ChatGoogleGenerativeAI: "gcp.gemini",
8
24
  ChatVertexAI: "gcp.vertex_ai",
9
25
  ChatCohere: "cohere",
10
- ChatMistralAI: "mistral",
26
+ ChatMistralAI: "mistral_ai",
11
27
  ChatGroq: "groq",
12
28
  ChatBedrock: "aws.bedrock",
13
29
  ChatBedrockConverse: "aws.bedrock",
@@ -20,9 +36,15 @@ export const PROVIDER_MAP = {
20
36
  export const MODULE_PROVIDER_MAP = {
21
37
  openai: "openai",
22
38
  anthropic: "anthropic",
23
- google: "gcp.generative_ai",
39
+ // Order matters: first matching segment wins. langchain_google_vertexai
40
+ // splits into [langchain, google, vertexai], so "vertexai" must precede
41
+ // "google" or Vertex traffic is labelled gcp.gemini (the AI Studio endpoint).
42
+ vertexai: "gcp.vertex_ai",
43
+ google: "gcp.gemini",
24
44
  cohere: "cohere",
25
- mistral: "mistral",
45
+ // The partner package is langchain_mistralai, whose segment is "mistralai".
46
+ mistralai: "mistral_ai",
47
+ mistral: "mistral_ai",
26
48
  groq: "groq",
27
49
  bedrock: "aws.bedrock",
28
50
  fireworks: "fireworks",
@@ -109,6 +109,14 @@ const OPENAI_COMPATIBLE_HOSTS = new Map([
109
109
  ["api.groq.com", "groq"],
110
110
  ["api.deepseek.com", "deepseek"],
111
111
  ["api.mistral.ai", "mistral_ai"],
112
+ // Enum values verified 2026-10-01 against each vendor's own API docs.
113
+ ["api.perplexity.ai", "perplexity"],
114
+ ["api.moonshot.ai", "moonshot_ai"],
115
+ ["api.moonshot.cn", "moonshot_ai"],
116
+ // Cohere's OpenAI-compatible endpoint is api.cohere.ai/compatibility/v1;
117
+ // its docs also use api.cohere.com for the same path.
118
+ ["api.cohere.ai", "cohere"],
119
+ ["api.cohere.com", "cohere"],
112
120
  ]);
113
121
  const HOST_RULES = [
114
122
  [isAzureHost, "azure.ai.openai"],
@@ -1,2 +1,2 @@
1
- export declare const SDK_VERSION = "0.4.5";
1
+ export declare const SDK_VERSION = "0.4.7";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1,3 +1,3 @@
1
1
  // Keep in sync with package.json; test/version.test.ts enforces it.
2
- export const SDK_VERSION = "0.4.5";
2
+ export const SDK_VERSION = "0.4.7";
3
3
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@struct-ai/sdk",
3
- "version": "0.4.5",
3
+ "version": "0.4.7",
4
4
  "description": "Struct agent observability SDK — auto-instruments AI agent frameworks with OpenTelemetry",
5
5
  "type": "module",
6
6
  "main": "./dist/commonjs/index.js",