@struct-ai/sdk 0.4.3 → 0.4.5
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.
|
@@ -107,8 +107,26 @@ function isAzureHost(host) {
|
|
|
107
107
|
host.endsWith(".services.ai.azure.us") ||
|
|
108
108
|
host.endsWith(".services.ai.azure.cn"));
|
|
109
109
|
}
|
|
110
|
+
// OpenAI-compatible vendor endpoints served through the openai client. Values
|
|
111
|
+
// are the CURRENT OTel gen_ai.provider.name well-known enum (semconv-genai
|
|
112
|
+
// registry): note "x_ai" (underscored — the deprecated gen_ai.system enum used
|
|
113
|
+
// "xai") and "mistral_ai" (not "mistral"). Fixed API hosts, so exact-match —
|
|
114
|
+
// a lookalike like "api.x.ai.evil.com" must not match.
|
|
115
|
+
// Parity: python openai.py's _OPENAI_COMPATIBLE_HOSTS.
|
|
116
|
+
const OPENAI_COMPATIBLE_HOSTS = new Map([
|
|
117
|
+
["api.x.ai", "x_ai"],
|
|
118
|
+
["api.groq.com", "groq"],
|
|
119
|
+
["api.deepseek.com", "deepseek"],
|
|
120
|
+
["api.mistral.ai", "mistral_ai"],
|
|
121
|
+
]);
|
|
110
122
|
const HOST_RULES = [
|
|
111
123
|
[isAzureHost, "azure.ai.openai"],
|
|
124
|
+
// One (predicate, provider) entry per fixed vendor host — the detector
|
|
125
|
+
// returns the first matching rule's value.
|
|
126
|
+
...[...OPENAI_COMPATIBLE_HOSTS].map(([vendorHost, provider]) => [
|
|
127
|
+
(host) => host === vendorHost,
|
|
128
|
+
provider,
|
|
129
|
+
]),
|
|
112
130
|
];
|
|
113
131
|
function detectProvider(resource) {
|
|
114
132
|
return (0, genai_content_js_1.detectProviderFromResource)(resource, CLASS_NAME_RULES, HOST_RULES, "openai");
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.4.
|
|
1
|
+
export declare const SDK_VERSION = "0.4.5";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/commonjs/version.js
CHANGED
|
@@ -98,8 +98,26 @@ function isAzureHost(host) {
|
|
|
98
98
|
host.endsWith(".services.ai.azure.us") ||
|
|
99
99
|
host.endsWith(".services.ai.azure.cn"));
|
|
100
100
|
}
|
|
101
|
+
// OpenAI-compatible vendor endpoints served through the openai client. Values
|
|
102
|
+
// are the CURRENT OTel gen_ai.provider.name well-known enum (semconv-genai
|
|
103
|
+
// registry): note "x_ai" (underscored — the deprecated gen_ai.system enum used
|
|
104
|
+
// "xai") and "mistral_ai" (not "mistral"). Fixed API hosts, so exact-match —
|
|
105
|
+
// a lookalike like "api.x.ai.evil.com" must not match.
|
|
106
|
+
// Parity: python openai.py's _OPENAI_COMPATIBLE_HOSTS.
|
|
107
|
+
const OPENAI_COMPATIBLE_HOSTS = new Map([
|
|
108
|
+
["api.x.ai", "x_ai"],
|
|
109
|
+
["api.groq.com", "groq"],
|
|
110
|
+
["api.deepseek.com", "deepseek"],
|
|
111
|
+
["api.mistral.ai", "mistral_ai"],
|
|
112
|
+
]);
|
|
101
113
|
const HOST_RULES = [
|
|
102
114
|
[isAzureHost, "azure.ai.openai"],
|
|
115
|
+
// One (predicate, provider) entry per fixed vendor host — the detector
|
|
116
|
+
// returns the first matching rule's value.
|
|
117
|
+
...[...OPENAI_COMPATIBLE_HOSTS].map(([vendorHost, provider]) => [
|
|
118
|
+
(host) => host === vendorHost,
|
|
119
|
+
provider,
|
|
120
|
+
]),
|
|
103
121
|
];
|
|
104
122
|
function detectProvider(resource) {
|
|
105
123
|
return detectProviderFromResource(resource, CLASS_NAME_RULES, HOST_RULES, "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.5";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/esm/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@struct-ai/sdk",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.5",
|
|
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",
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"tshy": "^3.0.0",
|
|
100
100
|
"tsx": "^4.21.0",
|
|
101
101
|
"typescript": "^5.5.0",
|
|
102
|
-
"vitest": "^4.
|
|
102
|
+
"vitest": "^4.1.11",
|
|
103
103
|
"zod": "^4.4.3"
|
|
104
104
|
},
|
|
105
105
|
"tshy": {
|