@yourgpt/llm-sdk 2.5.1-beta.0 → 2.5.1-beta.1

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.
Files changed (52) hide show
  1. package/README.md +19 -1
  2. package/dist/adapters/index.d.mts +4 -4
  3. package/dist/adapters/index.d.ts +4 -4
  4. package/dist/adapters/index.js +139 -12
  5. package/dist/adapters/index.mjs +139 -12
  6. package/dist/{base-tNgbBaSo.d.mts → base-BYQKp9TW.d.mts} +5 -1
  7. package/dist/{base-C58Dsr9p.d.ts → base-Cxq3ni0t.d.ts} +5 -1
  8. package/dist/fallback/index.d.mts +4 -4
  9. package/dist/fallback/index.d.ts +4 -4
  10. package/dist/index.d.mts +60 -8
  11. package/dist/index.d.ts +60 -8
  12. package/dist/index.js +59 -0
  13. package/dist/index.mjs +59 -0
  14. package/dist/providers/anthropic/index.d.mts +3 -3
  15. package/dist/providers/anthropic/index.d.ts +3 -3
  16. package/dist/providers/anthropic/index.js +91 -10
  17. package/dist/providers/anthropic/index.mjs +91 -10
  18. package/dist/providers/azure/index.d.mts +3 -3
  19. package/dist/providers/azure/index.d.ts +3 -3
  20. package/dist/providers/fireworks/index.d.mts +1 -1
  21. package/dist/providers/fireworks/index.d.ts +1 -1
  22. package/dist/providers/google/index.d.mts +3 -3
  23. package/dist/providers/google/index.d.ts +3 -3
  24. package/dist/providers/google/index.js +51 -2
  25. package/dist/providers/google/index.mjs +51 -2
  26. package/dist/providers/ollama/index.d.mts +4 -4
  27. package/dist/providers/ollama/index.d.ts +4 -4
  28. package/dist/providers/openai/index.d.mts +3 -3
  29. package/dist/providers/openai/index.d.ts +3 -3
  30. package/dist/providers/openai/index.js +51 -2
  31. package/dist/providers/openai/index.mjs +51 -2
  32. package/dist/providers/openrouter/index.d.mts +3 -3
  33. package/dist/providers/openrouter/index.d.ts +3 -3
  34. package/dist/providers/openrouter/index.js +51 -2
  35. package/dist/providers/openrouter/index.mjs +51 -2
  36. package/dist/providers/togetherai/index.d.mts +3 -3
  37. package/dist/providers/togetherai/index.d.ts +3 -3
  38. package/dist/providers/togetherai/index.js +51 -2
  39. package/dist/providers/togetherai/index.mjs +51 -2
  40. package/dist/providers/xai/index.d.mts +3 -3
  41. package/dist/providers/xai/index.d.ts +3 -3
  42. package/dist/providers/xai/index.js +51 -2
  43. package/dist/providers/xai/index.mjs +51 -2
  44. package/dist/{types-BSSiJW2o.d.mts → types-BvkiJ1dd.d.mts} +2 -2
  45. package/dist/{types-CCxPmkmK.d.ts → types-ChORafYS.d.ts} +1 -1
  46. package/dist/{types-BkQCSiIt.d.mts → types-D774b0dg.d.mts} +57 -2
  47. package/dist/{types-BkQCSiIt.d.ts → types-D774b0dg.d.ts} +57 -2
  48. package/dist/{types-BQ31QIsA.d.ts → types-TMilS-Dz.d.ts} +2 -2
  49. package/dist/{types-B6dhnguR.d.mts → types-mwMhCwOq.d.mts} +1 -1
  50. package/dist/yourgpt/index.d.mts +1 -1
  51. package/dist/yourgpt/index.d.ts +1 -1
  52. package/package.json +1 -1
@@ -245,6 +245,42 @@ type ResponseFormat = {
245
245
  strict?: boolean;
246
246
  };
247
247
  };
248
+ /**
249
+ * MCP (Model Context Protocol) server reference for a request.
250
+ *
251
+ * Vendor-neutral shape — each adapter translates to its provider's native
252
+ * field: OpenAI Responses `tools[type=mcp]`, Anthropic `mcp_servers` +
253
+ * `tools[type=mcp_toolset]` (beta `mcp-client-2025-11-20`), or local
254
+ * execution for adapters without native MCP.
255
+ */
256
+ interface McpServerConfig {
257
+ /** Human-readable label sent to the provider (also used as MCP server name). */
258
+ label: string;
259
+ /** MCP server endpoint (HTTP/SSE URL). */
260
+ url: string;
261
+ /** Additional HTTP headers; the `Authorization` value is also extracted for providers that take a separate token field. */
262
+ headers?: Record<string, string>;
263
+ /** Restrict the model to a subset of the MCP server's exposed tools. */
264
+ allowedTools?: string[];
265
+ /** Approval policy for tool invocation. Defaults to "never" (no human-in-the-loop). */
266
+ requireApproval?: "never" | "always";
267
+ }
268
+ /**
269
+ * Reasoning effort knob — normalized across providers.
270
+ *
271
+ * Maps to OpenAI Responses `reasoning.effort`, Anthropic `thinking`
272
+ * (adaptive+effort on Claude 4.6/4.7, budget_tokens on older models),
273
+ * Gemini `thinkingBudget`, xAI `reasoning_effort`. Adapters silently
274
+ * no-op when the underlying model doesn't support reasoning.
275
+ *
276
+ * Use the enum for the common case, or `{ budgetTokens }` / `{ raw }`
277
+ * for provider-specific escape hatches when full fidelity is required.
278
+ */
279
+ type ReasoningEffort = "minimal" | "low" | "medium" | "high" | {
280
+ budgetTokens: number;
281
+ } | {
282
+ raw: Record<string, unknown>;
283
+ };
248
284
  /**
249
285
  * LLM configuration
250
286
  */
@@ -252,6 +288,8 @@ interface LLMConfig {
252
288
  temperature?: number;
253
289
  maxTokens?: number;
254
290
  responseFormat?: ResponseFormat;
291
+ mcpServers?: McpServerConfig[];
292
+ reasoningEffort?: ReasoningEffort;
255
293
  }
256
294
  /**
257
295
  * Tool call format (OpenAI style)
@@ -620,7 +658,7 @@ interface ToolMessage {
620
658
  /**
621
659
  * Content parts for multimodal user messages
622
660
  */
623
- type UserContentPart = TextPart | ImagePart | FilePart;
661
+ type UserContentPart = TextPart | ImagePart | FilePart | AudioPart;
624
662
  interface TextPart {
625
663
  type: "text";
626
664
  text: string;
@@ -639,6 +677,15 @@ interface FilePart {
639
677
  /** MIME type (e.g., 'application/pdf') */
640
678
  mimeType: string;
641
679
  }
680
+ interface AudioPart {
681
+ type: "input_audio";
682
+ input_audio: {
683
+ /** Base64-encoded audio data */
684
+ data: string;
685
+ /** Audio format (e.g., 'mp3', 'wav', 'ogg', 'webm', 'm4a', 'flac') */
686
+ format: string;
687
+ };
688
+ }
642
689
  /**
643
690
  * Tool definition with Zod schema support
644
691
  */
@@ -702,6 +749,10 @@ interface DoGenerateParams {
702
749
  maxTokens?: number;
703
750
  /** Structured-output / JSON-mode request format (provider-translated) */
704
751
  responseFormat?: ResponseFormat;
752
+ /** MCP servers exposed to the model (provider-translated). */
753
+ mcpServers?: McpServerConfig[];
754
+ /** Reasoning/thinking effort knob (provider-translated). */
755
+ reasoningEffort?: ReasoningEffort;
705
756
  /** Abort signal */
706
757
  signal?: AbortSignal;
707
758
  }
@@ -780,6 +831,10 @@ interface GenerateTextParams {
780
831
  maxTokens?: number;
781
832
  /** Structured-output / JSON-mode request format */
782
833
  responseFormat?: ResponseFormat;
834
+ /** MCP servers exposed to the model (provider-translated). */
835
+ mcpServers?: McpServerConfig[];
836
+ /** Reasoning/thinking effort knob (provider-translated). */
837
+ reasoningEffort?: ReasoningEffort;
783
838
  /** Abort signal */
784
839
  signal?: AbortSignal;
785
840
  }
@@ -960,4 +1015,4 @@ interface StorageFile {
960
1015
  filename?: string;
961
1016
  }
962
1017
 
963
- export { type ToolExecution as $, type ActionDefinition as A, type ToolResultChunk as B, type CoreMessage as C, type DoneEventMessage as D, type FinishChunk as E, type FilePart as F, type GenerateTextParams as G, type ErrorChunk as H, type ImagePart as I, type TokenUsage as J, type KnowledgeBaseConfig as K, type LanguageModel as L, type Message as M, type FinishReason as N, type ResponseOptions as O, type ProviderToolRuntimeOptions as P, type StorageFile as Q, type ResponseFormat as R, type StreamTextParams as S, type ToolContext as T, type UserMessage as U, DEFAULT_CAPABILITIES as V, type WebSearchConfig as W, type LLMConfig as X, type ToolLocation as Y, type UnifiedToolCall as Z, type UnifiedToolResult as _, type GenerateTextResult as a, type OpenAIToolSelectionHints as a0, type AnthropicToolSelectionHints as a1, type ToolNativeProviderHints as a2, type OpenAIProviderToolOptions as a3, type AnthropicProviderToolOptions as a4, type Citation as a5, type MessageAttachment as a6, type StreamTextResult as b, type Tool as c, type ToolDefinition as d, type ToolProfile as e, type StorageAdapter as f, type StreamEvent as g, type ToolCallInfo as h, type TokenUsageRaw as i, type ToolResponse as j, type StorageMessage as k, type ModelCapabilities as l, type DoGenerateParams as m, type DoGenerateResult as n, type SystemMessage as o, type AssistantMessage as p, type ToolMessage as q, type UserContentPart as r, type TextPart as s, type ToolCall as t, type ToolResult as u, type GenerateStep as v, type StreamPart as w, type StreamChunk as x, type TextDeltaChunk as y, type ToolCallChunk as z };
1018
+ export { type UnifiedToolCall as $, type ActionDefinition as A, type TextDeltaChunk as B, type CoreMessage as C, type DoneEventMessage as D, type ToolCallChunk as E, type FilePart as F, type GenerateTextParams as G, type ToolResultChunk as H, type ImagePart as I, type FinishChunk as J, type KnowledgeBaseConfig as K, type LanguageModel as L, type McpServerConfig as M, type ErrorChunk as N, type TokenUsage as O, type ProviderToolRuntimeOptions as P, type FinishReason as Q, type ResponseFormat as R, type StreamTextParams as S, type ToolContext as T, type UserMessage as U, type ResponseOptions as V, type WebSearchConfig as W, type StorageFile as X, DEFAULT_CAPABILITIES as Y, type LLMConfig as Z, type ToolLocation as _, type GenerateTextResult as a, type UnifiedToolResult as a0, type ToolExecution as a1, type OpenAIToolSelectionHints as a2, type AnthropicToolSelectionHints as a3, type ToolNativeProviderHints as a4, type OpenAIProviderToolOptions as a5, type AnthropicProviderToolOptions as a6, type Citation as a7, type MessageAttachment as a8, type StreamTextResult as b, type Tool as c, type ToolDefinition as d, type ToolProfile as e, type StorageAdapter as f, type ReasoningEffort as g, type StreamEvent as h, type ToolCallInfo as i, type TokenUsageRaw as j, type Message as k, type ToolResponse as l, type StorageMessage as m, type ModelCapabilities as n, type DoGenerateParams as o, type DoGenerateResult as p, type SystemMessage as q, type AssistantMessage as r, type ToolMessage as s, type UserContentPart as t, type TextPart as u, type ToolCall as v, type ToolResult as w, type GenerateStep as x, type StreamPart as y, type StreamChunk as z };
@@ -245,6 +245,42 @@ type ResponseFormat = {
245
245
  strict?: boolean;
246
246
  };
247
247
  };
248
+ /**
249
+ * MCP (Model Context Protocol) server reference for a request.
250
+ *
251
+ * Vendor-neutral shape — each adapter translates to its provider's native
252
+ * field: OpenAI Responses `tools[type=mcp]`, Anthropic `mcp_servers` +
253
+ * `tools[type=mcp_toolset]` (beta `mcp-client-2025-11-20`), or local
254
+ * execution for adapters without native MCP.
255
+ */
256
+ interface McpServerConfig {
257
+ /** Human-readable label sent to the provider (also used as MCP server name). */
258
+ label: string;
259
+ /** MCP server endpoint (HTTP/SSE URL). */
260
+ url: string;
261
+ /** Additional HTTP headers; the `Authorization` value is also extracted for providers that take a separate token field. */
262
+ headers?: Record<string, string>;
263
+ /** Restrict the model to a subset of the MCP server's exposed tools. */
264
+ allowedTools?: string[];
265
+ /** Approval policy for tool invocation. Defaults to "never" (no human-in-the-loop). */
266
+ requireApproval?: "never" | "always";
267
+ }
268
+ /**
269
+ * Reasoning effort knob — normalized across providers.
270
+ *
271
+ * Maps to OpenAI Responses `reasoning.effort`, Anthropic `thinking`
272
+ * (adaptive+effort on Claude 4.6/4.7, budget_tokens on older models),
273
+ * Gemini `thinkingBudget`, xAI `reasoning_effort`. Adapters silently
274
+ * no-op when the underlying model doesn't support reasoning.
275
+ *
276
+ * Use the enum for the common case, or `{ budgetTokens }` / `{ raw }`
277
+ * for provider-specific escape hatches when full fidelity is required.
278
+ */
279
+ type ReasoningEffort = "minimal" | "low" | "medium" | "high" | {
280
+ budgetTokens: number;
281
+ } | {
282
+ raw: Record<string, unknown>;
283
+ };
248
284
  /**
249
285
  * LLM configuration
250
286
  */
@@ -252,6 +288,8 @@ interface LLMConfig {
252
288
  temperature?: number;
253
289
  maxTokens?: number;
254
290
  responseFormat?: ResponseFormat;
291
+ mcpServers?: McpServerConfig[];
292
+ reasoningEffort?: ReasoningEffort;
255
293
  }
256
294
  /**
257
295
  * Tool call format (OpenAI style)
@@ -620,7 +658,7 @@ interface ToolMessage {
620
658
  /**
621
659
  * Content parts for multimodal user messages
622
660
  */
623
- type UserContentPart = TextPart | ImagePart | FilePart;
661
+ type UserContentPart = TextPart | ImagePart | FilePart | AudioPart;
624
662
  interface TextPart {
625
663
  type: "text";
626
664
  text: string;
@@ -639,6 +677,15 @@ interface FilePart {
639
677
  /** MIME type (e.g., 'application/pdf') */
640
678
  mimeType: string;
641
679
  }
680
+ interface AudioPart {
681
+ type: "input_audio";
682
+ input_audio: {
683
+ /** Base64-encoded audio data */
684
+ data: string;
685
+ /** Audio format (e.g., 'mp3', 'wav', 'ogg', 'webm', 'm4a', 'flac') */
686
+ format: string;
687
+ };
688
+ }
642
689
  /**
643
690
  * Tool definition with Zod schema support
644
691
  */
@@ -702,6 +749,10 @@ interface DoGenerateParams {
702
749
  maxTokens?: number;
703
750
  /** Structured-output / JSON-mode request format (provider-translated) */
704
751
  responseFormat?: ResponseFormat;
752
+ /** MCP servers exposed to the model (provider-translated). */
753
+ mcpServers?: McpServerConfig[];
754
+ /** Reasoning/thinking effort knob (provider-translated). */
755
+ reasoningEffort?: ReasoningEffort;
705
756
  /** Abort signal */
706
757
  signal?: AbortSignal;
707
758
  }
@@ -780,6 +831,10 @@ interface GenerateTextParams {
780
831
  maxTokens?: number;
781
832
  /** Structured-output / JSON-mode request format */
782
833
  responseFormat?: ResponseFormat;
834
+ /** MCP servers exposed to the model (provider-translated). */
835
+ mcpServers?: McpServerConfig[];
836
+ /** Reasoning/thinking effort knob (provider-translated). */
837
+ reasoningEffort?: ReasoningEffort;
783
838
  /** Abort signal */
784
839
  signal?: AbortSignal;
785
840
  }
@@ -960,4 +1015,4 @@ interface StorageFile {
960
1015
  filename?: string;
961
1016
  }
962
1017
 
963
- export { type ToolExecution as $, type ActionDefinition as A, type ToolResultChunk as B, type CoreMessage as C, type DoneEventMessage as D, type FinishChunk as E, type FilePart as F, type GenerateTextParams as G, type ErrorChunk as H, type ImagePart as I, type TokenUsage as J, type KnowledgeBaseConfig as K, type LanguageModel as L, type Message as M, type FinishReason as N, type ResponseOptions as O, type ProviderToolRuntimeOptions as P, type StorageFile as Q, type ResponseFormat as R, type StreamTextParams as S, type ToolContext as T, type UserMessage as U, DEFAULT_CAPABILITIES as V, type WebSearchConfig as W, type LLMConfig as X, type ToolLocation as Y, type UnifiedToolCall as Z, type UnifiedToolResult as _, type GenerateTextResult as a, type OpenAIToolSelectionHints as a0, type AnthropicToolSelectionHints as a1, type ToolNativeProviderHints as a2, type OpenAIProviderToolOptions as a3, type AnthropicProviderToolOptions as a4, type Citation as a5, type MessageAttachment as a6, type StreamTextResult as b, type Tool as c, type ToolDefinition as d, type ToolProfile as e, type StorageAdapter as f, type StreamEvent as g, type ToolCallInfo as h, type TokenUsageRaw as i, type ToolResponse as j, type StorageMessage as k, type ModelCapabilities as l, type DoGenerateParams as m, type DoGenerateResult as n, type SystemMessage as o, type AssistantMessage as p, type ToolMessage as q, type UserContentPart as r, type TextPart as s, type ToolCall as t, type ToolResult as u, type GenerateStep as v, type StreamPart as w, type StreamChunk as x, type TextDeltaChunk as y, type ToolCallChunk as z };
1018
+ export { type UnifiedToolCall as $, type ActionDefinition as A, type TextDeltaChunk as B, type CoreMessage as C, type DoneEventMessage as D, type ToolCallChunk as E, type FilePart as F, type GenerateTextParams as G, type ToolResultChunk as H, type ImagePart as I, type FinishChunk as J, type KnowledgeBaseConfig as K, type LanguageModel as L, type McpServerConfig as M, type ErrorChunk as N, type TokenUsage as O, type ProviderToolRuntimeOptions as P, type FinishReason as Q, type ResponseFormat as R, type StreamTextParams as S, type ToolContext as T, type UserMessage as U, type ResponseOptions as V, type WebSearchConfig as W, type StorageFile as X, DEFAULT_CAPABILITIES as Y, type LLMConfig as Z, type ToolLocation as _, type GenerateTextResult as a, type UnifiedToolResult as a0, type ToolExecution as a1, type OpenAIToolSelectionHints as a2, type AnthropicToolSelectionHints as a3, type ToolNativeProviderHints as a4, type OpenAIProviderToolOptions as a5, type AnthropicProviderToolOptions as a6, type Citation as a7, type MessageAttachment as a8, type StreamTextResult as b, type Tool as c, type ToolDefinition as d, type ToolProfile as e, type StorageAdapter as f, type ReasoningEffort as g, type StreamEvent as h, type ToolCallInfo as i, type TokenUsageRaw as j, type Message as k, type ToolResponse as l, type StorageMessage as m, type ModelCapabilities as n, type DoGenerateParams as o, type DoGenerateResult as p, type SystemMessage as q, type AssistantMessage as r, type ToolMessage as s, type UserContentPart as t, type TextPart as u, type ToolCall as v, type ToolResult as w, type GenerateStep as x, type StreamPart as y, type StreamChunk as z };
@@ -1,5 +1,5 @@
1
- import { d as ToolDefinition, Z as UnifiedToolCall, _ as UnifiedToolResult } from './types-BkQCSiIt.js';
2
- import { L as LLMAdapter } from './base-C58Dsr9p.js';
1
+ import { d as ToolDefinition, $ as UnifiedToolCall, a0 as UnifiedToolResult } from './types-D774b0dg.js';
2
+ import { L as LLMAdapter } from './base-Cxq3ni0t.js';
3
3
 
4
4
  /**
5
5
  * Provider Types
@@ -1,4 +1,4 @@
1
- import { L as LLMAdapter } from './base-tNgbBaSo.mjs';
1
+ import { L as LLMAdapter } from './base-BYQKp9TW.mjs';
2
2
 
3
3
  /**
4
4
  * Fallback Chain & Routing Strategy Types
@@ -1,4 +1,4 @@
1
- import { k as StorageMessage, f as StorageAdapter, Q as StorageFile } from '../types-BkQCSiIt.mjs';
1
+ import { m as StorageMessage, f as StorageAdapter, X as StorageFile } from '../types-D774b0dg.mjs';
2
2
  import 'zod';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { k as StorageMessage, f as StorageAdapter, Q as StorageFile } from '../types-BkQCSiIt.js';
1
+ import { m as StorageMessage, f as StorageAdapter, X as StorageFile } from '../types-D774b0dg.js';
2
2
  import 'zod';
3
3
 
4
4
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yourgpt/llm-sdk",
3
- "version": "2.5.1-beta.0",
3
+ "version": "2.5.1-beta.1",
4
4
  "description": "AI SDK for building AI Agents with any LLM",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",