@struct-ai/sdk 0.4.6 → 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.
- package/dist/commonjs/integrations/langchain-content.js +26 -4
- package/dist/commonjs/integrations/openai.js +8 -0
- package/dist/commonjs/version.d.ts +1 -1
- package/dist/commonjs/version.js +1 -1
- package/dist/esm/integrations/langchain-content.js +26 -4
- package/dist/esm/integrations/openai.js +8 -0
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/package.json +1 -1
|
@@ -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.
|
|
36
|
+
ChatGoogleGenerativeAI: "gcp.gemini",
|
|
21
37
|
ChatVertexAI: "gcp.vertex_ai",
|
|
22
38
|
ChatCohere: "cohere",
|
|
23
|
-
ChatMistralAI: "
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
1
|
+
export declare const SDK_VERSION = "0.4.7";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/commonjs/version.js
CHANGED
|
@@ -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.
|
|
23
|
+
ChatGoogleGenerativeAI: "gcp.gemini",
|
|
8
24
|
ChatVertexAI: "gcp.vertex_ai",
|
|
9
25
|
ChatCohere: "cohere",
|
|
10
|
-
ChatMistralAI: "
|
|
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
|
-
|
|
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
|
-
|
|
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"],
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.4.
|
|
1
|
+
export declare const SDK_VERSION = "0.4.7";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/esm/version.js
CHANGED
package/package.json
CHANGED