@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.
- package/README.md +19 -1
- package/dist/adapters/index.d.mts +4 -4
- package/dist/adapters/index.d.ts +4 -4
- package/dist/adapters/index.js +139 -12
- package/dist/adapters/index.mjs +139 -12
- package/dist/{base-tNgbBaSo.d.mts → base-BYQKp9TW.d.mts} +5 -1
- package/dist/{base-C58Dsr9p.d.ts → base-Cxq3ni0t.d.ts} +5 -1
- package/dist/fallback/index.d.mts +4 -4
- package/dist/fallback/index.d.ts +4 -4
- package/dist/index.d.mts +60 -8
- package/dist/index.d.ts +60 -8
- package/dist/index.js +59 -0
- package/dist/index.mjs +59 -0
- package/dist/providers/anthropic/index.d.mts +3 -3
- package/dist/providers/anthropic/index.d.ts +3 -3
- package/dist/providers/anthropic/index.js +91 -10
- package/dist/providers/anthropic/index.mjs +91 -10
- package/dist/providers/azure/index.d.mts +3 -3
- package/dist/providers/azure/index.d.ts +3 -3
- package/dist/providers/fireworks/index.d.mts +1 -1
- package/dist/providers/fireworks/index.d.ts +1 -1
- package/dist/providers/google/index.d.mts +3 -3
- package/dist/providers/google/index.d.ts +3 -3
- package/dist/providers/google/index.js +51 -2
- package/dist/providers/google/index.mjs +51 -2
- package/dist/providers/ollama/index.d.mts +4 -4
- package/dist/providers/ollama/index.d.ts +4 -4
- package/dist/providers/openai/index.d.mts +3 -3
- package/dist/providers/openai/index.d.ts +3 -3
- package/dist/providers/openai/index.js +51 -2
- package/dist/providers/openai/index.mjs +51 -2
- package/dist/providers/openrouter/index.d.mts +3 -3
- package/dist/providers/openrouter/index.d.ts +3 -3
- package/dist/providers/openrouter/index.js +51 -2
- package/dist/providers/openrouter/index.mjs +51 -2
- package/dist/providers/togetherai/index.d.mts +3 -3
- package/dist/providers/togetherai/index.d.ts +3 -3
- package/dist/providers/togetherai/index.js +51 -2
- package/dist/providers/togetherai/index.mjs +51 -2
- package/dist/providers/xai/index.d.mts +3 -3
- package/dist/providers/xai/index.d.ts +3 -3
- package/dist/providers/xai/index.js +51 -2
- package/dist/providers/xai/index.mjs +51 -2
- package/dist/{types-BSSiJW2o.d.mts → types-BvkiJ1dd.d.mts} +2 -2
- package/dist/{types-CCxPmkmK.d.ts → types-ChORafYS.d.ts} +1 -1
- package/dist/{types-BkQCSiIt.d.mts → types-D774b0dg.d.mts} +57 -2
- package/dist/{types-BkQCSiIt.d.ts → types-D774b0dg.d.ts} +57 -2
- package/dist/{types-BQ31QIsA.d.ts → types-TMilS-Dz.d.ts} +2 -2
- package/dist/{types-B6dhnguR.d.mts → types-mwMhCwOq.d.mts} +1 -1
- package/dist/yourgpt/index.d.mts +1 -1
- package/dist/yourgpt/index.d.ts +1 -1
- 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
|
|
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
|
|
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,
|
|
2
|
-
import { L as LLMAdapter } from './base-
|
|
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
|
package/dist/yourgpt/index.d.mts
CHANGED
package/dist/yourgpt/index.d.ts
CHANGED