@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.
@@ -1,4 +1,4 @@
1
- import { b as AdapterFactory, e as AuthKind, A as AuthSpec, L as LlmAdapter, d as ApiKeyAuth, h as ClientOptions, P as PromptRequest, m as LlmEvent, M as Message, p as ToolCallEvent, o as ModelInfo, c as AdapterManifest } from '../types-BEgQaQIb.cjs';
1
+ import { b as AdapterFactory, e as AuthKind, A as AuthSpec, L as LlmAdapter, d as ApiKeyAuth, h as ClientOptions, P as PromptRequest, m as LlmEvent, M as Message, p as ToolCallEvent, o as ModelInfo, c as AdapterManifest } from '../types-rZZBXYhB.cjs';
2
2
 
3
3
  /**
4
4
  * Named scenarios the harness must be able to stage. Each scenario configures
@@ -1,4 +1,4 @@
1
- import { b as AdapterFactory, e as AuthKind, A as AuthSpec, L as LlmAdapter, d as ApiKeyAuth, h as ClientOptions, P as PromptRequest, m as LlmEvent, M as Message, p as ToolCallEvent, o as ModelInfo, c as AdapterManifest } from '../types-BEgQaQIb.js';
1
+ import { b as AdapterFactory, e as AuthKind, A as AuthSpec, L as LlmAdapter, d as ApiKeyAuth, h as ClientOptions, P as PromptRequest, m as LlmEvent, M as Message, p as ToolCallEvent, o as ModelInfo, c as AdapterManifest } from '../types-rZZBXYhB.js';
2
2
 
3
3
  /**
4
4
  * Named scenarios the harness must be able to stage. Each scenario configures
@@ -78,6 +78,12 @@ async function* streamFromOpenAI(client, req, options) {
78
78
  const param = options.tokensParam ?? (needsMaxCompletionTokens(req.model) ? "max_completion_tokens" : "max_tokens");
79
79
  body[param] = effectiveMaxTokens;
80
80
  }
81
+ if (req.providerParams) {
82
+ const bodyRecord = body;
83
+ for (const [key, value] of Object.entries(req.providerParams)) {
84
+ if (!(key in bodyRecord)) bodyRecord[key] = value;
85
+ }
86
+ }
81
87
  const t0 = process.hrtime.bigint();
82
88
  let t1;
83
89
  let t2;
@@ -937,6 +943,101 @@ var zaiFactory = {
937
943
  manifest: zaiManifest,
938
944
  create: () => new ZaiAdapter()
939
945
  };
946
+ var xaiManifest = {
947
+ vendor: "xai",
948
+ displayName: "xAI (Grok)",
949
+ authKinds: [
950
+ {
951
+ kind: "apiKey",
952
+ displayName: "API Key",
953
+ fields: [
954
+ {
955
+ name: "apiKey",
956
+ label: "API Key",
957
+ type: "password",
958
+ required: true,
959
+ help: "Get an API key from https://console.x.ai/team/default/api-keys"
960
+ },
961
+ {
962
+ name: "baseURL",
963
+ label: "Base URL",
964
+ type: "url",
965
+ required: false,
966
+ default: "https://api.x.ai/v1",
967
+ help: "Override for proxy endpoints. Defaults to xAI production."
968
+ }
969
+ ]
970
+ }
971
+ ],
972
+ knownModels: [
973
+ {
974
+ id: "grok-4.3",
975
+ displayName: "Grok 4.3",
976
+ capabilities: {
977
+ streaming: true,
978
+ tools: true,
979
+ vision: true,
980
+ systemPrompt: true,
981
+ maxContextTokens: 1e6
982
+ }
983
+ },
984
+ {
985
+ id: "grok-4.20-0309-reasoning",
986
+ displayName: "Grok 4.20 (Reasoning)",
987
+ capabilities: {
988
+ streaming: true,
989
+ tools: true,
990
+ vision: true,
991
+ systemPrompt: true,
992
+ maxContextTokens: 1e6
993
+ }
994
+ },
995
+ {
996
+ id: "grok-4.20-0309-non-reasoning",
997
+ displayName: "Grok 4.20 (Non-Reasoning)",
998
+ capabilities: {
999
+ streaming: true,
1000
+ tools: true,
1001
+ vision: true,
1002
+ systemPrompt: true,
1003
+ maxContextTokens: 1e6
1004
+ }
1005
+ },
1006
+ {
1007
+ id: "grok-4.20-multi-agent-0309",
1008
+ displayName: "Grok 4.20 Multi-Agent",
1009
+ capabilities: {
1010
+ streaming: true,
1011
+ tools: true,
1012
+ vision: true,
1013
+ systemPrompt: true,
1014
+ maxContextTokens: 1e6
1015
+ }
1016
+ }
1017
+ ],
1018
+ supportsModelListing: true,
1019
+ docsUrl: "https://docs.x.ai/"
1020
+ };
1021
+ var XaiAdapter = class extends OpenAIAdapter {
1022
+ vendor = xaiManifest.vendor;
1023
+ init(auth, client) {
1024
+ super.init(
1025
+ {
1026
+ ...auth,
1027
+ baseURL: auth.baseURL ?? "https://api.x.ai/v1"
1028
+ },
1029
+ client
1030
+ );
1031
+ }
1032
+ knownModels() {
1033
+ return xaiManifest.knownModels;
1034
+ }
1035
+ };
1036
+ var xaiFactory = {
1037
+ vendor: xaiManifest.vendor,
1038
+ manifest: xaiManifest,
1039
+ create: () => new XaiAdapter()
1040
+ };
940
1041
 
941
1042
  // src/adapters/anthropic/adapter.ts
942
1043
  import Anthropic from "@anthropic-ai/sdk";
@@ -3118,6 +3219,7 @@ registerAdapter(deepseekFactory);
3118
3219
  registerAdapter(basetenFactory);
3119
3220
  registerAdapter(moonshotFactory);
3120
3221
  registerAdapter(zaiFactory);
3222
+ registerAdapter(xaiFactory);
3121
3223
  registerAdapter(anthropicFactory);
3122
3224
  registerAdapter(googleFactory);
3123
3225
  registerAdapter(vertexGeminiFactory);