@jambonz/llm 0.5.5 → 0.5.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/index.cjs +103 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +103 -0
- package/dist/index.js.map +1 -1
- package/dist/test-kit/index.cjs +102 -0
- package/dist/test-kit/index.cjs.map +1 -1
- package/dist/test-kit/index.d.cts +1 -1
- package/dist/test-kit/index.d.ts +1 -1
- package/dist/test-kit/index.js +102 -0
- package/dist/test-kit/index.js.map +1 -1
- package/dist/{types-BEgQaQIb.d.cts → types-rZZBXYhB.d.cts} +10 -0
- package/dist/{types-BEgQaQIb.d.ts → types-rZZBXYhB.d.ts} +10 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -130,6 +130,12 @@ async function* streamFromOpenAI(client, req, options) {
|
|
|
130
130
|
const param = options.tokensParam ?? (needsMaxCompletionTokens(req.model) ? "max_completion_tokens" : "max_tokens");
|
|
131
131
|
body[param] = effectiveMaxTokens;
|
|
132
132
|
}
|
|
133
|
+
if (req.providerParams) {
|
|
134
|
+
const bodyRecord = body;
|
|
135
|
+
for (const [key, value] of Object.entries(req.providerParams)) {
|
|
136
|
+
if (!(key in bodyRecord)) bodyRecord[key] = value;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
133
139
|
const t0 = process.hrtime.bigint();
|
|
134
140
|
let t1;
|
|
135
141
|
let t2;
|
|
@@ -989,6 +995,101 @@ var zaiFactory = {
|
|
|
989
995
|
manifest: zaiManifest,
|
|
990
996
|
create: () => new ZaiAdapter()
|
|
991
997
|
};
|
|
998
|
+
var xaiManifest = {
|
|
999
|
+
vendor: "xai",
|
|
1000
|
+
displayName: "xAI (Grok)",
|
|
1001
|
+
authKinds: [
|
|
1002
|
+
{
|
|
1003
|
+
kind: "apiKey",
|
|
1004
|
+
displayName: "API Key",
|
|
1005
|
+
fields: [
|
|
1006
|
+
{
|
|
1007
|
+
name: "apiKey",
|
|
1008
|
+
label: "API Key",
|
|
1009
|
+
type: "password",
|
|
1010
|
+
required: true,
|
|
1011
|
+
help: "Get an API key from https://console.x.ai/team/default/api-keys"
|
|
1012
|
+
},
|
|
1013
|
+
{
|
|
1014
|
+
name: "baseURL",
|
|
1015
|
+
label: "Base URL",
|
|
1016
|
+
type: "url",
|
|
1017
|
+
required: false,
|
|
1018
|
+
default: "https://api.x.ai/v1",
|
|
1019
|
+
help: "Override for proxy endpoints. Defaults to xAI production."
|
|
1020
|
+
}
|
|
1021
|
+
]
|
|
1022
|
+
}
|
|
1023
|
+
],
|
|
1024
|
+
knownModels: [
|
|
1025
|
+
{
|
|
1026
|
+
id: "grok-4.3",
|
|
1027
|
+
displayName: "Grok 4.3",
|
|
1028
|
+
capabilities: {
|
|
1029
|
+
streaming: true,
|
|
1030
|
+
tools: true,
|
|
1031
|
+
vision: true,
|
|
1032
|
+
systemPrompt: true,
|
|
1033
|
+
maxContextTokens: 1e6
|
|
1034
|
+
}
|
|
1035
|
+
},
|
|
1036
|
+
{
|
|
1037
|
+
id: "grok-4.20-0309-reasoning",
|
|
1038
|
+
displayName: "Grok 4.20 (Reasoning)",
|
|
1039
|
+
capabilities: {
|
|
1040
|
+
streaming: true,
|
|
1041
|
+
tools: true,
|
|
1042
|
+
vision: true,
|
|
1043
|
+
systemPrompt: true,
|
|
1044
|
+
maxContextTokens: 1e6
|
|
1045
|
+
}
|
|
1046
|
+
},
|
|
1047
|
+
{
|
|
1048
|
+
id: "grok-4.20-0309-non-reasoning",
|
|
1049
|
+
displayName: "Grok 4.20 (Non-Reasoning)",
|
|
1050
|
+
capabilities: {
|
|
1051
|
+
streaming: true,
|
|
1052
|
+
tools: true,
|
|
1053
|
+
vision: true,
|
|
1054
|
+
systemPrompt: true,
|
|
1055
|
+
maxContextTokens: 1e6
|
|
1056
|
+
}
|
|
1057
|
+
},
|
|
1058
|
+
{
|
|
1059
|
+
id: "grok-4.20-multi-agent-0309",
|
|
1060
|
+
displayName: "Grok 4.20 Multi-Agent",
|
|
1061
|
+
capabilities: {
|
|
1062
|
+
streaming: true,
|
|
1063
|
+
tools: true,
|
|
1064
|
+
vision: true,
|
|
1065
|
+
systemPrompt: true,
|
|
1066
|
+
maxContextTokens: 1e6
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
],
|
|
1070
|
+
supportsModelListing: true,
|
|
1071
|
+
docsUrl: "https://docs.x.ai/"
|
|
1072
|
+
};
|
|
1073
|
+
var XaiAdapter = class extends OpenAIAdapter {
|
|
1074
|
+
vendor = xaiManifest.vendor;
|
|
1075
|
+
init(auth, client) {
|
|
1076
|
+
super.init(
|
|
1077
|
+
{
|
|
1078
|
+
...auth,
|
|
1079
|
+
baseURL: auth.baseURL ?? "https://api.x.ai/v1"
|
|
1080
|
+
},
|
|
1081
|
+
client
|
|
1082
|
+
);
|
|
1083
|
+
}
|
|
1084
|
+
knownModels() {
|
|
1085
|
+
return xaiManifest.knownModels;
|
|
1086
|
+
}
|
|
1087
|
+
};
|
|
1088
|
+
var xaiFactory = {
|
|
1089
|
+
vendor: xaiManifest.vendor,
|
|
1090
|
+
manifest: xaiManifest,
|
|
1091
|
+
create: () => new XaiAdapter()
|
|
1092
|
+
};
|
|
992
1093
|
|
|
993
1094
|
// src/adapters/anthropic/adapter.ts
|
|
994
1095
|
var import_sdk = __toESM(require("@anthropic-ai/sdk"), 1);
|
|
@@ -3164,6 +3265,7 @@ registerAdapter(deepseekFactory);
|
|
|
3164
3265
|
registerAdapter(basetenFactory);
|
|
3165
3266
|
registerAdapter(moonshotFactory);
|
|
3166
3267
|
registerAdapter(zaiFactory);
|
|
3268
|
+
registerAdapter(xaiFactory);
|
|
3167
3269
|
registerAdapter(anthropicFactory);
|
|
3168
3270
|
registerAdapter(googleFactory);
|
|
3169
3271
|
registerAdapter(vertexGeminiFactory);
|
|
@@ -3182,6 +3284,7 @@ function normalizeAuth(vendor, raw) {
|
|
|
3182
3284
|
case "huggingface":
|
|
3183
3285
|
case "moonshot":
|
|
3184
3286
|
case "zai":
|
|
3287
|
+
case "xai":
|
|
3185
3288
|
return requireApiKey(vendor, raw);
|
|
3186
3289
|
case "deepseek":
|
|
3187
3290
|
return {
|