@jambonz/llm 0.6.8 → 0.6.10

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.
@@ -74,12 +74,16 @@ interface PromptRequest {
74
74
  maxTokens?: number;
75
75
  /**
76
76
  * Provider-specific request-body parameters merged verbatim into the
77
- * outgoing request by OpenAI-compatible adapters. Opt-in escape hatch for
78
- * fields the typed interface does not model — e.g. a vLLM/Mantle-served
79
- * Kimi endpoint's `{chat_template_kwargs: {enable_thinking: false}}` to
80
- * suppress chain-of-thought. Never sent unless set. Keys that collide with
81
- * library-managed fields (model, messages, stream, tools, …) are ignored,
82
- * so this can only add parameters, never override core request shape.
77
+ * outgoing request by OpenAI-compatible adapters and the Anthropic adapter
78
+ * (the Gemini adapters merge them into the generation config). Opt-in
79
+ * escape hatch for fields the typed interface does not model — e.g. a
80
+ * vLLM/Mantle-served Kimi endpoint's
81
+ * `{chat_template_kwargs: {enable_thinking: false}}` to suppress
82
+ * chain-of-thought, or Claude's `{output_config: {effort: 'low'}}` to cap
83
+ * how much it thinks before answering. Never sent unless set. Keys that
84
+ * collide with library-managed fields (model, messages, stream, tools, …)
85
+ * are ignored, so this can only add parameters, never override core
86
+ * request shape.
83
87
  */
84
88
  providerParams?: Record<string, unknown>;
85
89
  /** Abort the stream. Adapters MUST honor this and propagate to the vendor SDK. */
@@ -115,6 +119,16 @@ type LlmEvent = {
115
119
  id: string;
116
120
  name: string;
117
121
  arguments: unknown;
122
+ /**
123
+ * Opaque vendor-native state the adapter needs back when the call is
124
+ * written into history: pass the event to `appendAssistantToolCall`
125
+ * unchanged. Anthropic records the turn's content blocks here
126
+ * (`thinking`, `redacted_thinking`, text and `tool_use`, in order) and
127
+ * replays them, so the model keeps its reasoning after the tool result
128
+ * instead of working the turn out again. Absent unless the adapter
129
+ * set it.
130
+ */
131
+ vendorRaw?: unknown;
118
132
  } | {
119
133
  type: 'end';
120
134
  finishReason: FinishReason;
@@ -298,7 +312,18 @@ interface AdapterManifest {
298
312
  * talks to the customer's harness over its own WebSocket protocol.
299
313
  */
300
314
  credentialOnly?: boolean;
315
+ /**
316
+ * What a credential for this vendor is used for, which decides where the
317
+ * portal lists it. Absent means `llm`; `getManifest()` fills it in.
318
+ */
319
+ category?: VendorCategory;
301
320
  }
321
+ /**
322
+ * - `llm`: a language model behind the agent verb (and the harness, which takes its place).
323
+ * - `s2s`: a speech-to-speech model for the llm verb. Ids are the schema's verb names (`openai_s2s`).
324
+ * - `hosted`: an agent defined and run at the vendor, e.g. Dialogflow CES for the dialogflow verb.
325
+ */
326
+ type VendorCategory = 'llm' | 's2s' | 'hosted';
302
327
  interface AuthKindSchema {
303
328
  kind: AuthKind;
304
329
  displayName: string;
@@ -435,4 +460,4 @@ interface CreateLlmArgs<A extends AuthSpec = AuthSpec> {
435
460
  client?: ClientOptions;
436
461
  }
437
462
 
438
- export type { AuthSpec as A, BedrockApiKeyAuth as B, CreateLlmArgs as C, FinishReason as F, GoogleApiKeyAuth as G, JsonSchema as J, LlmAdapter as L, Message as M, PromptRequest as P, Role as R, ServiceAccountJson as S, Tool as T, Usage as U, VertexServiceAccountAuth as V, AuthKindSchema as a, AdapterFactory as b, AdapterManifest as c, ApiKeyAuth as d, AuthKind as e, AzureOpenAIApiKeyAuth as f, BedrockIamAuth as g, ClientOptions as h, ContentBlock as i, FormField as j, FormFieldType as k, GoogleServiceAccountAuth as l, LlmEvent as m, ModelCapabilities as n, ModelInfo as o, ToolCallEvent as p };
463
+ export type { AuthSpec as A, BedrockApiKeyAuth as B, CreateLlmArgs as C, FinishReason as F, GoogleApiKeyAuth as G, JsonSchema as J, LlmAdapter as L, Message as M, PromptRequest as P, Role as R, ServiceAccountJson as S, Tool as T, Usage as U, VendorCategory as V, AuthKindSchema as a, AdapterFactory as b, AdapterManifest as c, ApiKeyAuth as d, AuthKind as e, AzureOpenAIApiKeyAuth as f, BedrockIamAuth as g, ClientOptions as h, ContentBlock as i, FormField as j, FormFieldType as k, GoogleServiceAccountAuth as l, LlmEvent as m, ModelCapabilities as n, ModelInfo as o, ToolCallEvent as p, VertexServiceAccountAuth as q };
@@ -74,12 +74,16 @@ interface PromptRequest {
74
74
  maxTokens?: number;
75
75
  /**
76
76
  * Provider-specific request-body parameters merged verbatim into the
77
- * outgoing request by OpenAI-compatible adapters. Opt-in escape hatch for
78
- * fields the typed interface does not model — e.g. a vLLM/Mantle-served
79
- * Kimi endpoint's `{chat_template_kwargs: {enable_thinking: false}}` to
80
- * suppress chain-of-thought. Never sent unless set. Keys that collide with
81
- * library-managed fields (model, messages, stream, tools, …) are ignored,
82
- * so this can only add parameters, never override core request shape.
77
+ * outgoing request by OpenAI-compatible adapters and the Anthropic adapter
78
+ * (the Gemini adapters merge them into the generation config). Opt-in
79
+ * escape hatch for fields the typed interface does not model — e.g. a
80
+ * vLLM/Mantle-served Kimi endpoint's
81
+ * `{chat_template_kwargs: {enable_thinking: false}}` to suppress
82
+ * chain-of-thought, or Claude's `{output_config: {effort: 'low'}}` to cap
83
+ * how much it thinks before answering. Never sent unless set. Keys that
84
+ * collide with library-managed fields (model, messages, stream, tools, …)
85
+ * are ignored, so this can only add parameters, never override core
86
+ * request shape.
83
87
  */
84
88
  providerParams?: Record<string, unknown>;
85
89
  /** Abort the stream. Adapters MUST honor this and propagate to the vendor SDK. */
@@ -115,6 +119,16 @@ type LlmEvent = {
115
119
  id: string;
116
120
  name: string;
117
121
  arguments: unknown;
122
+ /**
123
+ * Opaque vendor-native state the adapter needs back when the call is
124
+ * written into history: pass the event to `appendAssistantToolCall`
125
+ * unchanged. Anthropic records the turn's content blocks here
126
+ * (`thinking`, `redacted_thinking`, text and `tool_use`, in order) and
127
+ * replays them, so the model keeps its reasoning after the tool result
128
+ * instead of working the turn out again. Absent unless the adapter
129
+ * set it.
130
+ */
131
+ vendorRaw?: unknown;
118
132
  } | {
119
133
  type: 'end';
120
134
  finishReason: FinishReason;
@@ -298,7 +312,18 @@ interface AdapterManifest {
298
312
  * talks to the customer's harness over its own WebSocket protocol.
299
313
  */
300
314
  credentialOnly?: boolean;
315
+ /**
316
+ * What a credential for this vendor is used for, which decides where the
317
+ * portal lists it. Absent means `llm`; `getManifest()` fills it in.
318
+ */
319
+ category?: VendorCategory;
301
320
  }
321
+ /**
322
+ * - `llm`: a language model behind the agent verb (and the harness, which takes its place).
323
+ * - `s2s`: a speech-to-speech model for the llm verb. Ids are the schema's verb names (`openai_s2s`).
324
+ * - `hosted`: an agent defined and run at the vendor, e.g. Dialogflow CES for the dialogflow verb.
325
+ */
326
+ type VendorCategory = 'llm' | 's2s' | 'hosted';
302
327
  interface AuthKindSchema {
303
328
  kind: AuthKind;
304
329
  displayName: string;
@@ -435,4 +460,4 @@ interface CreateLlmArgs<A extends AuthSpec = AuthSpec> {
435
460
  client?: ClientOptions;
436
461
  }
437
462
 
438
- export type { AuthSpec as A, BedrockApiKeyAuth as B, CreateLlmArgs as C, FinishReason as F, GoogleApiKeyAuth as G, JsonSchema as J, LlmAdapter as L, Message as M, PromptRequest as P, Role as R, ServiceAccountJson as S, Tool as T, Usage as U, VertexServiceAccountAuth as V, AuthKindSchema as a, AdapterFactory as b, AdapterManifest as c, ApiKeyAuth as d, AuthKind as e, AzureOpenAIApiKeyAuth as f, BedrockIamAuth as g, ClientOptions as h, ContentBlock as i, FormField as j, FormFieldType as k, GoogleServiceAccountAuth as l, LlmEvent as m, ModelCapabilities as n, ModelInfo as o, ToolCallEvent as p };
463
+ export type { AuthSpec as A, BedrockApiKeyAuth as B, CreateLlmArgs as C, FinishReason as F, GoogleApiKeyAuth as G, JsonSchema as J, LlmAdapter as L, Message as M, PromptRequest as P, Role as R, ServiceAccountJson as S, Tool as T, Usage as U, VendorCategory as V, AuthKindSchema as a, AdapterFactory as b, AdapterManifest as c, ApiKeyAuth as d, AuthKind as e, AzureOpenAIApiKeyAuth as f, BedrockIamAuth as g, ClientOptions as h, ContentBlock as i, FormField as j, FormFieldType as k, GoogleServiceAccountAuth as l, LlmEvent as m, ModelCapabilities as n, ModelInfo as o, ToolCallEvent as p, VertexServiceAccountAuth as q };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jambonz/llm",
3
- "version": "0.6.8",
3
+ "version": "0.6.10",
4
4
  "description": "Voice-oriented LLM adapter library — a uniform interface for streaming chat completions from multiple LLM vendors, with first-class support for tool calls, AbortSignal interruption, and lossless history round-tripping.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",