@yourgpt/llm-sdk 1.2.7 → 1.3.0

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.d.mts CHANGED
@@ -1,21 +1,14 @@
1
1
  import { G as GenerateTextParams, a as GenerateTextResult, S as StreamTextParams, b as StreamTextResult, T as ToolContext, c as Tool } from './types-CdORv1Yu.mjs';
2
2
  export { A as AssistantMessage, C as CoreMessage, t as DEFAULT_CAPABILITIES, D as DoGenerateParams, d as DoGenerateResult, E as ErrorChunk, F as FilePart, q as FinishChunk, s as FinishReason, k as GenerateStep, I as ImagePart, L as LanguageModel, M as ModelCapabilities, R as ResponseOptions, m as StreamChunk, l as StreamPart, e as SystemMessage, n as TextDeltaChunk, h as TextPart, r as TokenUsage, i as ToolCall, o as ToolCallChunk, f as ToolMessage, j as ToolResult, p as ToolResultChunk, g as UserContentPart, U as UserMessage } from './types-CdORv1Yu.mjs';
3
3
  import { z } from 'zod';
4
- export { createOpenAI, openai } from './providers/openai/index.mjs';
5
- export { anthropic, createAnthropic } from './providers/anthropic/index.mjs';
6
- export { createXAI, xai } from './providers/xai/index.mjs';
7
- export { createGoogle, google } from './providers/google/index.mjs';
8
4
  import { ActionDefinition, ToolDefinition, AgentLoopConfig, KnowledgeBaseConfig, DoneEventMessage, StreamEvent, Message, AIProvider as AIProvider$1, ToolResponse } from '@yourgpt/copilot-sdk/core';
9
5
  export { ActionDefinition, AgentLoopConfig, LLMConfig, Message, StreamEvent, ToolDefinition, ToolExecution, ToolLocation, ToolResponse, UnifiedToolCall, UnifiedToolResult } from '@yourgpt/copilot-sdk/core';
10
- import { A as AIProvider, P as ProviderCapabilities, d as ProviderFormatter } from './types-B8rxpnYi.mjs';
11
- export { c as AnthropicProviderConfig, e as AnthropicTool, g as AnthropicToolResult, f as AnthropicToolUse, a as AzureProviderConfig, B as BaseProviderConfig, l as GeminiFunctionCall, k as GeminiFunctionDeclaration, m as GeminiFunctionResponse, G as GoogleProviderConfig, O as OllamaProviderConfig, b as OpenAIProviderConfig, h as OpenAITool, i as OpenAIToolCall, j as OpenAIToolResult, X as XAIProviderConfig } from './types-B8rxpnYi.mjs';
6
+ import { A as AIProvider } from './types-B7dyZii0.mjs';
7
+ export { a as AnthropicProviderConfig, e as AnthropicTool, g as AnthropicToolResult, f as AnthropicToolUse, b as AzureProviderConfig, B as BaseProviderConfig, l as GeminiFunctionCall, k as GeminiFunctionDeclaration, m as GeminiFunctionResponse, G as GoogleProviderConfig, c as OllamaProviderConfig, O as OpenAIProviderConfig, h as OpenAITool, i as OpenAIToolCall, j as OpenAIToolResult, P as ProviderCapabilities, d as ProviderFormatter, X as XAIProviderConfig } from './types-B7dyZii0.mjs';
12
8
  import { L as LLMAdapter } from './base-CXNMfvXg.mjs';
13
9
  export { A as AdapterFactory, C as ChatCompletionRequest } from './base-CXNMfvXg.mjs';
14
10
  import * as hono from 'hono';
15
11
  import { Hono } from 'hono';
16
- export { AnthropicAdapter, AnthropicAdapterConfig, AzureAdapter, AzureAdapterConfig, GoogleAdapter, GoogleAdapterConfig, OllamaAdapter, OllamaAdapterConfig, OpenAIAdapter, OpenAIAdapterConfig, XAIAdapter, XAIAdapterConfig, createAnthropicAdapter, createAzureAdapter, createGoogleAdapter, createOllamaAdapter, createOpenAIAdapter, createXAIAdapter } from './adapters/index.mjs';
17
- export { createOllama } from './providers/ollama/index.mjs';
18
- export { createAzure } from './providers/azure/index.mjs';
19
12
 
20
13
  /**
21
14
  * generateText - Generate text using a language model
@@ -688,139 +681,4 @@ interface AgentLoopOptions {
688
681
  */
689
682
  declare function runAgentLoop(options: AgentLoopOptions): AsyncGenerator<StreamEvent>;
690
683
 
691
- /**
692
- * Provider Registry
693
- *
694
- * Central registry for AI providers.
695
- * Allows dynamic registration and lookup of providers.
696
- */
697
-
698
- /**
699
- * Register a provider factory
700
- *
701
- * @param name Provider name (e.g., 'openai')
702
- * @param factory Factory function that creates the provider
703
- *
704
- * @example
705
- * ```typescript
706
- * registerProvider('openai', (config) => createOpenAI(config));
707
- * ```
708
- */
709
- declare function registerProvider(name: string, factory: (config?: Record<string, unknown>) => AIProvider): void;
710
- /**
711
- * Get a provider by name
712
- *
713
- * @param name Provider name
714
- * @param config Optional configuration
715
- * @returns Provider instance or undefined if not found
716
- *
717
- * @example
718
- * ```typescript
719
- * const openai = getProvider('openai', { apiKey: '...' });
720
- * ```
721
- */
722
- declare function getProvider(name: string, config?: Record<string, unknown>): AIProvider | undefined;
723
- /**
724
- * Check if a provider is registered
725
- */
726
- declare function hasProvider(name: string): boolean;
727
- /**
728
- * List all registered provider names
729
- */
730
- declare function listProviders(): string[];
731
- /**
732
- * Get all available providers with their models
733
- * Useful for building UI model selectors
734
- */
735
- declare function getAvailableProviders(): Array<{
736
- name: string;
737
- models: string[];
738
- }>;
739
- /**
740
- * Get capabilities for a specific provider and model
741
- */
742
- declare function getModelCapabilities(providerName: string, modelId: string): ProviderCapabilities | undefined;
743
-
744
- /**
745
- * OpenAI Provider Formatter
746
- *
747
- * Transformation functions for OpenAI API format
748
- * Also used by xAI/Grok (they use OpenAI-compatible format)
749
- */
750
-
751
- /**
752
- * OpenAI provider formatter
753
- */
754
- declare const openaiFormatter: ProviderFormatter;
755
-
756
- /**
757
- * Anthropic/Claude Provider Formatter
758
- *
759
- * Transformation functions for Anthropic API format
760
- */
761
-
762
- /**
763
- * Anthropic provider formatter
764
- */
765
- declare const anthropicFormatter: ProviderFormatter;
766
-
767
- /**
768
- * Google Gemini Provider Formatter
769
- *
770
- * Transformation functions for Google Gemini API format
771
- */
772
-
773
- /**
774
- * Gemini provider formatter
775
- */
776
- declare const geminiFormatter: ProviderFormatter;
777
-
778
- /**
779
- * Provider Formatter Registry
780
- *
781
- * Maps provider names to their formatters for the agent loop.
782
- * Formatters handle tool transformations between unified format and provider-specific formats.
783
- */
784
-
785
- /**
786
- * Get a formatter for a specific provider
787
- *
788
- * @param provider - Provider name (e.g., 'openai', 'anthropic', 'google')
789
- * @returns The provider's formatter
790
- * @throws Error if provider is not supported
791
- *
792
- * @example
793
- * ```typescript
794
- * const formatter = getFormatter('openai');
795
- * const tools = formatter.transformTools(unifiedTools);
796
- * ```
797
- */
798
- declare function getFormatter(provider: string): ProviderFormatter;
799
- /**
800
- * Check if a provider is supported
801
- *
802
- * @param provider - Provider name to check
803
- * @returns True if provider has a formatter
804
- *
805
- * @example
806
- * ```typescript
807
- * if (isProviderSupported('openai')) {
808
- * // Use the provider
809
- * }
810
- * ```
811
- */
812
- declare function isProviderSupported(provider: string): boolean;
813
- /**
814
- * Get list of supported providers
815
- *
816
- * @returns Array of supported provider names
817
- *
818
- * @example
819
- * ```typescript
820
- * const providers = getSupportedProviders();
821
- * // ['openai', 'anthropic', 'google', ...]
822
- * ```
823
- */
824
- declare function getSupportedProviders(): string[];
825
-
826
- export { AIProvider, type ActionRequest, type AgentLoopOptions, type ChatRequest, DEFAULT_MAX_ITERATIONS, GenerateTextParams, GenerateTextResult, LLMAdapter, ProviderCapabilities, ProviderFormatter, type RequestContext, Runtime, type RuntimeConfig, StreamTextParams, StreamTextResult, Tool, ToolContext, anthropicFormatter, createEventStream, createExpressMiddleware, createHonoApp, createNextHandler, createNodeHandler, createRuntime, createSSEHeaders, createSSEResponse, formatSSEData, formatToolsForAnthropic, formatToolsForGoogle, formatToolsForOpenAI, geminiFormatter, generateText, getAvailableProviders, getFormatter, getModelCapabilities, getProvider, getSupportedProviders, hasProvider, isProviderSupported, listProviders, openaiFormatter, registerProvider, runAgentLoop, streamText, tool };
684
+ export { AIProvider, type ActionRequest, type AgentLoopOptions, type ChatRequest, DEFAULT_MAX_ITERATIONS, GenerateTextParams, GenerateTextResult, LLMAdapter, type RequestContext, Runtime, type RuntimeConfig, StreamTextParams, StreamTextResult, Tool, ToolContext, createEventStream, createExpressMiddleware, createHonoApp, createNextHandler, createNodeHandler, createRuntime, createSSEHeaders, createSSEResponse, formatSSEData, formatToolsForAnthropic, formatToolsForGoogle, formatToolsForOpenAI, generateText, runAgentLoop, streamText, tool };
package/dist/index.d.ts CHANGED
@@ -1,21 +1,14 @@
1
1
  import { G as GenerateTextParams, a as GenerateTextResult, S as StreamTextParams, b as StreamTextResult, T as ToolContext, c as Tool } from './types-CdORv1Yu.js';
2
2
  export { A as AssistantMessage, C as CoreMessage, t as DEFAULT_CAPABILITIES, D as DoGenerateParams, d as DoGenerateResult, E as ErrorChunk, F as FilePart, q as FinishChunk, s as FinishReason, k as GenerateStep, I as ImagePart, L as LanguageModel, M as ModelCapabilities, R as ResponseOptions, m as StreamChunk, l as StreamPart, e as SystemMessage, n as TextDeltaChunk, h as TextPart, r as TokenUsage, i as ToolCall, o as ToolCallChunk, f as ToolMessage, j as ToolResult, p as ToolResultChunk, g as UserContentPart, U as UserMessage } from './types-CdORv1Yu.js';
3
3
  import { z } from 'zod';
4
- export { createOpenAI, openai } from './providers/openai/index.js';
5
- export { anthropic, createAnthropic } from './providers/anthropic/index.js';
6
- export { createXAI, xai } from './providers/xai/index.js';
7
- export { createGoogle, google } from './providers/google/index.js';
8
4
  import { ActionDefinition, ToolDefinition, AgentLoopConfig, KnowledgeBaseConfig, DoneEventMessage, StreamEvent, Message, AIProvider as AIProvider$1, ToolResponse } from '@yourgpt/copilot-sdk/core';
9
5
  export { ActionDefinition, AgentLoopConfig, LLMConfig, Message, StreamEvent, ToolDefinition, ToolExecution, ToolLocation, ToolResponse, UnifiedToolCall, UnifiedToolResult } from '@yourgpt/copilot-sdk/core';
10
- import { A as AIProvider, P as ProviderCapabilities, d as ProviderFormatter } from './types-CrQftISG.js';
11
- export { c as AnthropicProviderConfig, e as AnthropicTool, g as AnthropicToolResult, f as AnthropicToolUse, a as AzureProviderConfig, B as BaseProviderConfig, l as GeminiFunctionCall, k as GeminiFunctionDeclaration, m as GeminiFunctionResponse, G as GoogleProviderConfig, O as OllamaProviderConfig, b as OpenAIProviderConfig, h as OpenAITool, i as OpenAIToolCall, j as OpenAIToolResult, X as XAIProviderConfig } from './types-CrQftISG.js';
6
+ import { A as AIProvider } from './types-0uwUGKFS.js';
7
+ export { a as AnthropicProviderConfig, e as AnthropicTool, g as AnthropicToolResult, f as AnthropicToolUse, b as AzureProviderConfig, B as BaseProviderConfig, l as GeminiFunctionCall, k as GeminiFunctionDeclaration, m as GeminiFunctionResponse, G as GoogleProviderConfig, c as OllamaProviderConfig, O as OpenAIProviderConfig, h as OpenAITool, i as OpenAIToolCall, j as OpenAIToolResult, P as ProviderCapabilities, d as ProviderFormatter, X as XAIProviderConfig } from './types-0uwUGKFS.js';
12
8
  import { L as LLMAdapter } from './base-CXNMfvXg.js';
13
9
  export { A as AdapterFactory, C as ChatCompletionRequest } from './base-CXNMfvXg.js';
14
10
  import * as hono from 'hono';
15
11
  import { Hono } from 'hono';
16
- export { AnthropicAdapter, AnthropicAdapterConfig, AzureAdapter, AzureAdapterConfig, GoogleAdapter, GoogleAdapterConfig, OllamaAdapter, OllamaAdapterConfig, OpenAIAdapter, OpenAIAdapterConfig, XAIAdapter, XAIAdapterConfig, createAnthropicAdapter, createAzureAdapter, createGoogleAdapter, createOllamaAdapter, createOpenAIAdapter, createXAIAdapter } from './adapters/index.js';
17
- export { createOllama } from './providers/ollama/index.js';
18
- export { createAzure } from './providers/azure/index.js';
19
12
 
20
13
  /**
21
14
  * generateText - Generate text using a language model
@@ -688,139 +681,4 @@ interface AgentLoopOptions {
688
681
  */
689
682
  declare function runAgentLoop(options: AgentLoopOptions): AsyncGenerator<StreamEvent>;
690
683
 
691
- /**
692
- * Provider Registry
693
- *
694
- * Central registry for AI providers.
695
- * Allows dynamic registration and lookup of providers.
696
- */
697
-
698
- /**
699
- * Register a provider factory
700
- *
701
- * @param name Provider name (e.g., 'openai')
702
- * @param factory Factory function that creates the provider
703
- *
704
- * @example
705
- * ```typescript
706
- * registerProvider('openai', (config) => createOpenAI(config));
707
- * ```
708
- */
709
- declare function registerProvider(name: string, factory: (config?: Record<string, unknown>) => AIProvider): void;
710
- /**
711
- * Get a provider by name
712
- *
713
- * @param name Provider name
714
- * @param config Optional configuration
715
- * @returns Provider instance or undefined if not found
716
- *
717
- * @example
718
- * ```typescript
719
- * const openai = getProvider('openai', { apiKey: '...' });
720
- * ```
721
- */
722
- declare function getProvider(name: string, config?: Record<string, unknown>): AIProvider | undefined;
723
- /**
724
- * Check if a provider is registered
725
- */
726
- declare function hasProvider(name: string): boolean;
727
- /**
728
- * List all registered provider names
729
- */
730
- declare function listProviders(): string[];
731
- /**
732
- * Get all available providers with their models
733
- * Useful for building UI model selectors
734
- */
735
- declare function getAvailableProviders(): Array<{
736
- name: string;
737
- models: string[];
738
- }>;
739
- /**
740
- * Get capabilities for a specific provider and model
741
- */
742
- declare function getModelCapabilities(providerName: string, modelId: string): ProviderCapabilities | undefined;
743
-
744
- /**
745
- * OpenAI Provider Formatter
746
- *
747
- * Transformation functions for OpenAI API format
748
- * Also used by xAI/Grok (they use OpenAI-compatible format)
749
- */
750
-
751
- /**
752
- * OpenAI provider formatter
753
- */
754
- declare const openaiFormatter: ProviderFormatter;
755
-
756
- /**
757
- * Anthropic/Claude Provider Formatter
758
- *
759
- * Transformation functions for Anthropic API format
760
- */
761
-
762
- /**
763
- * Anthropic provider formatter
764
- */
765
- declare const anthropicFormatter: ProviderFormatter;
766
-
767
- /**
768
- * Google Gemini Provider Formatter
769
- *
770
- * Transformation functions for Google Gemini API format
771
- */
772
-
773
- /**
774
- * Gemini provider formatter
775
- */
776
- declare const geminiFormatter: ProviderFormatter;
777
-
778
- /**
779
- * Provider Formatter Registry
780
- *
781
- * Maps provider names to their formatters for the agent loop.
782
- * Formatters handle tool transformations between unified format and provider-specific formats.
783
- */
784
-
785
- /**
786
- * Get a formatter for a specific provider
787
- *
788
- * @param provider - Provider name (e.g., 'openai', 'anthropic', 'google')
789
- * @returns The provider's formatter
790
- * @throws Error if provider is not supported
791
- *
792
- * @example
793
- * ```typescript
794
- * const formatter = getFormatter('openai');
795
- * const tools = formatter.transformTools(unifiedTools);
796
- * ```
797
- */
798
- declare function getFormatter(provider: string): ProviderFormatter;
799
- /**
800
- * Check if a provider is supported
801
- *
802
- * @param provider - Provider name to check
803
- * @returns True if provider has a formatter
804
- *
805
- * @example
806
- * ```typescript
807
- * if (isProviderSupported('openai')) {
808
- * // Use the provider
809
- * }
810
- * ```
811
- */
812
- declare function isProviderSupported(provider: string): boolean;
813
- /**
814
- * Get list of supported providers
815
- *
816
- * @returns Array of supported provider names
817
- *
818
- * @example
819
- * ```typescript
820
- * const providers = getSupportedProviders();
821
- * // ['openai', 'anthropic', 'google', ...]
822
- * ```
823
- */
824
- declare function getSupportedProviders(): string[];
825
-
826
- export { AIProvider, type ActionRequest, type AgentLoopOptions, type ChatRequest, DEFAULT_MAX_ITERATIONS, GenerateTextParams, GenerateTextResult, LLMAdapter, ProviderCapabilities, ProviderFormatter, type RequestContext, Runtime, type RuntimeConfig, StreamTextParams, StreamTextResult, Tool, ToolContext, anthropicFormatter, createEventStream, createExpressMiddleware, createHonoApp, createNextHandler, createNodeHandler, createRuntime, createSSEHeaders, createSSEResponse, formatSSEData, formatToolsForAnthropic, formatToolsForGoogle, formatToolsForOpenAI, geminiFormatter, generateText, getAvailableProviders, getFormatter, getModelCapabilities, getProvider, getSupportedProviders, hasProvider, isProviderSupported, listProviders, openaiFormatter, registerProvider, runAgentLoop, streamText, tool };
684
+ export { AIProvider, type ActionRequest, type AgentLoopOptions, type ChatRequest, DEFAULT_MAX_ITERATIONS, GenerateTextParams, GenerateTextResult, LLMAdapter, type RequestContext, Runtime, type RuntimeConfig, StreamTextParams, StreamTextResult, Tool, ToolContext, createEventStream, createExpressMiddleware, createHonoApp, createNextHandler, createNodeHandler, createRuntime, createSSEHeaders, createSSEResponse, formatSSEData, formatToolsForAnthropic, formatToolsForGoogle, formatToolsForOpenAI, generateText, runAgentLoop, streamText, tool };