@agentskit/adapters 0.17.3 → 0.18.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/README.md +2 -0
- package/dist/catalog/index.cjs +78 -93
- package/dist/catalog/index.cjs.map +1 -1
- package/dist/catalog/index.d.cts +1 -1
- package/dist/catalog/index.d.ts +1 -1
- package/dist/catalog/index.js +1 -1
- package/dist/{chunk-ICIKG7XA.js → chunk-MJDQXBVD.js} +89 -100
- package/dist/chunk-MJDQXBVD.js.map +1 -0
- package/dist/index.cjs +97 -112
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -4
- package/dist/index.d.ts +29 -4
- package/dist/index.js +4 -5
- package/dist/index.js.map +1 -1
- package/dist/retry-Bc6xtQCm.d.cts +49 -0
- package/dist/retry-Bc6xtQCm.d.ts +49 -0
- package/package.json +6 -5
- package/dist/chunk-ICIKG7XA.js.map +0 -1
- package/dist/utils-ddwu4MN4.d.cts +0 -66
- package/dist/utils-ddwu4MN4.d.ts +0 -66
package/dist/index.d.cts
CHANGED
|
@@ -1,10 +1,35 @@
|
|
|
1
1
|
import { G as GenericAdapterConfig } from './createAdapter-C-pKR1aO.cjs';
|
|
2
2
|
export { C as CreateAdapterConfig, c as createAdapter } from './createAdapter-C-pKR1aO.cjs';
|
|
3
3
|
import * as _agentskit_core from '@agentskit/core';
|
|
4
|
-
import { AdapterFactory, AdapterCapabilities, AdapterRequest, DataRegion, StreamChunk, EmbedFn } from '@agentskit/core';
|
|
4
|
+
import { StreamSource, AdapterFactory, AdapterCapabilities, AdapterRequest, DataRegion, StreamChunk, EmbedFn } from '@agentskit/core';
|
|
5
5
|
export { DataRegion } from '@agentskit/core';
|
|
6
|
-
import { R as RetryOptions } from './
|
|
7
|
-
export {
|
|
6
|
+
import { R as RetryOptions } from './retry-Bc6xtQCm.cjs';
|
|
7
|
+
export { f as fetchWithRetry } from './retry-Bc6xtQCm.cjs';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Chunk-splitter that turns one large string into N streamable text chunks.
|
|
11
|
+
* Useful when a provider returns the full response in one shot and you
|
|
12
|
+
* want to feed it to a UI that expects streaming.
|
|
13
|
+
*
|
|
14
|
+
* Default splits by whitespace boundaries with a target chunk size of ~32
|
|
15
|
+
* characters.
|
|
16
|
+
*/
|
|
17
|
+
declare function chunkText(text: string, targetSize?: number): string[];
|
|
18
|
+
/**
|
|
19
|
+
* Build a StreamSource from a non-streaming fetch. The adapter is
|
|
20
|
+
* auto-completing: it fetches once, then yields the text as a sequence
|
|
21
|
+
* of chunks so UIs see the same streaming shape they'd see from a
|
|
22
|
+
* native streaming provider.
|
|
23
|
+
*
|
|
24
|
+
* Use this when you're wiring a provider that only has a non-streaming
|
|
25
|
+
* endpoint but you want consumers (useChat, the runtime) to get
|
|
26
|
+
* identical ergonomics.
|
|
27
|
+
*/
|
|
28
|
+
declare function simulateStream(doFetch: (signal: AbortSignal) => Promise<Response>, extractText: (response: Response) => Promise<string>, errorLabel: string, options?: {
|
|
29
|
+
chunkSize?: number;
|
|
30
|
+
delayMs?: number;
|
|
31
|
+
retry?: RetryOptions;
|
|
32
|
+
}): StreamSource;
|
|
8
33
|
|
|
9
34
|
declare function generic(config: GenericAdapterConfig): AdapterFactory;
|
|
10
35
|
|
|
@@ -803,4 +828,4 @@ declare function refreshCredentials(adapter: unknown, next: string, options?: {
|
|
|
803
828
|
logger?: (msg: string) => void;
|
|
804
829
|
}): Promise<boolean>;
|
|
805
830
|
|
|
806
|
-
export { type AnthropicConfig, type ApplyCarbonOptions, type AzureOpenAIConfig, type BailConfig, type BedrockConfig, type BedrockRuntimeClientLike, type CarbonTable, type CerebrasConfig, type CohereConfig, type CredentialRefreshable, DEFAULT_CARBON_TABLE, DEFAULT_DEPRECATION_TABLE, type DeepSeekConfig, type DeepSeekEmbedderConfig, type DeprecationAction, type DeprecationPolicy, type EnsembleAggregator, type EnsembleBranchResult, type EnsembleCandidate, type EnsembleOptions, type FallbackCandidate, type FallbackOptions, type FireworksConfig, type GeminiConfig, type GeminiEmbedderConfig, GenericAdapterConfig, type GrokConfig, type GrokEmbedderConfig, type GroqConfig, type HuggingFaceConfig, type KimiConfig, type KimiEmbedderConfig, type LMStudioConfig, type LangChainConfig, type LangGraphConfig, type LlamaCppConfig, type MistralConfig, type MockAdapterOptions, type MockResponse, type ModelDeprecation, type OllamaConfig, type OllamaEmbedderConfig, type OpenAICompatibleEmbedderConfig, type OpenAIConfig, type OpenAIEmbedderConfig, type OpenRouterConfig, type ProviderRegionKey, type RecordedTurn, type RecordingFixture, type RecordingSink, type ReplicateConfig, type ResolveModelInput, type ResolveModelResult, RetryOptions, type RotatingCredentials, type RouterCandidate, type RouterOptions, type RouterPolicy, type TogetherConfig, type VLLMConfig, type VercelAIConfig, type VertexConfig, type WebLlmConfig, type WebLlmEngineLike, anthropic, applyCarbonTable, azureOpenAI, azureOpenAIAdapter, bail, bailAdapter, bedrock, bedrockAdapter, cerebras, cerebrasAdapter, cohere, cohereAdapter, createEnsembleAdapter, createFallbackAdapter, createOpenAICompatibleEmbedder, createRotatingCredentials, createRouter, deepseek, deepseekEmbedder, estimateCO2Grams, fireworks, gemini, geminiEmbedder, generic, grok, grokEmbedder, groq, groqAdapter, huggingface, inMemorySink, kimi, kimiEmbedder, langchain, langgraph, llamacpp, lmstudio, mistral, mockAdapter, ollama, ollamaEmbedder, openai, openaiEmbedder, openrouter, qwen, recordingAdapter, refreshCredentials, replayAdapter, replicate, replicateAdapter, resolveModel, together, vercelAI, vertex, vertexAdapter, vllm, webllm, webllmAdapter, withDeprecationPolicy };
|
|
831
|
+
export { type AnthropicConfig, type ApplyCarbonOptions, type AzureOpenAIConfig, type BailConfig, type BedrockConfig, type BedrockRuntimeClientLike, type CarbonTable, type CerebrasConfig, type CohereConfig, type CredentialRefreshable, DEFAULT_CARBON_TABLE, DEFAULT_DEPRECATION_TABLE, type DeepSeekConfig, type DeepSeekEmbedderConfig, type DeprecationAction, type DeprecationPolicy, type EnsembleAggregator, type EnsembleBranchResult, type EnsembleCandidate, type EnsembleOptions, type FallbackCandidate, type FallbackOptions, type FireworksConfig, type GeminiConfig, type GeminiEmbedderConfig, GenericAdapterConfig, type GrokConfig, type GrokEmbedderConfig, type GroqConfig, type HuggingFaceConfig, type KimiConfig, type KimiEmbedderConfig, type LMStudioConfig, type LangChainConfig, type LangGraphConfig, type LlamaCppConfig, type MistralConfig, type MockAdapterOptions, type MockResponse, type ModelDeprecation, type OllamaConfig, type OllamaEmbedderConfig, type OpenAICompatibleEmbedderConfig, type OpenAIConfig, type OpenAIEmbedderConfig, type OpenRouterConfig, type ProviderRegionKey, type RecordedTurn, type RecordingFixture, type RecordingSink, type ReplicateConfig, type ResolveModelInput, type ResolveModelResult, RetryOptions, type RotatingCredentials, type RouterCandidate, type RouterOptions, type RouterPolicy, type TogetherConfig, type VLLMConfig, type VercelAIConfig, type VertexConfig, type WebLlmConfig, type WebLlmEngineLike, anthropic, applyCarbonTable, azureOpenAI, azureOpenAIAdapter, bail, bailAdapter, bedrock, bedrockAdapter, cerebras, cerebrasAdapter, chunkText, cohere, cohereAdapter, createEnsembleAdapter, createFallbackAdapter, createOpenAICompatibleEmbedder, createRotatingCredentials, createRouter, deepseek, deepseekEmbedder, estimateCO2Grams, fireworks, gemini, geminiEmbedder, generic, grok, grokEmbedder, groq, groqAdapter, huggingface, inMemorySink, kimi, kimiEmbedder, langchain, langgraph, llamacpp, lmstudio, mistral, mockAdapter, ollama, ollamaEmbedder, openai, openaiEmbedder, openrouter, qwen, recordingAdapter, refreshCredentials, replayAdapter, replicate, replicateAdapter, resolveModel, simulateStream, together, vercelAI, vertex, vertexAdapter, vllm, webllm, webllmAdapter, withDeprecationPolicy };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,35 @@
|
|
|
1
1
|
import { G as GenericAdapterConfig } from './createAdapter-C-pKR1aO.js';
|
|
2
2
|
export { C as CreateAdapterConfig, c as createAdapter } from './createAdapter-C-pKR1aO.js';
|
|
3
3
|
import * as _agentskit_core from '@agentskit/core';
|
|
4
|
-
import { AdapterFactory, AdapterCapabilities, AdapterRequest, DataRegion, StreamChunk, EmbedFn } from '@agentskit/core';
|
|
4
|
+
import { StreamSource, AdapterFactory, AdapterCapabilities, AdapterRequest, DataRegion, StreamChunk, EmbedFn } from '@agentskit/core';
|
|
5
5
|
export { DataRegion } from '@agentskit/core';
|
|
6
|
-
import { R as RetryOptions } from './
|
|
7
|
-
export {
|
|
6
|
+
import { R as RetryOptions } from './retry-Bc6xtQCm.js';
|
|
7
|
+
export { f as fetchWithRetry } from './retry-Bc6xtQCm.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Chunk-splitter that turns one large string into N streamable text chunks.
|
|
11
|
+
* Useful when a provider returns the full response in one shot and you
|
|
12
|
+
* want to feed it to a UI that expects streaming.
|
|
13
|
+
*
|
|
14
|
+
* Default splits by whitespace boundaries with a target chunk size of ~32
|
|
15
|
+
* characters.
|
|
16
|
+
*/
|
|
17
|
+
declare function chunkText(text: string, targetSize?: number): string[];
|
|
18
|
+
/**
|
|
19
|
+
* Build a StreamSource from a non-streaming fetch. The adapter is
|
|
20
|
+
* auto-completing: it fetches once, then yields the text as a sequence
|
|
21
|
+
* of chunks so UIs see the same streaming shape they'd see from a
|
|
22
|
+
* native streaming provider.
|
|
23
|
+
*
|
|
24
|
+
* Use this when you're wiring a provider that only has a non-streaming
|
|
25
|
+
* endpoint but you want consumers (useChat, the runtime) to get
|
|
26
|
+
* identical ergonomics.
|
|
27
|
+
*/
|
|
28
|
+
declare function simulateStream(doFetch: (signal: AbortSignal) => Promise<Response>, extractText: (response: Response) => Promise<string>, errorLabel: string, options?: {
|
|
29
|
+
chunkSize?: number;
|
|
30
|
+
delayMs?: number;
|
|
31
|
+
retry?: RetryOptions;
|
|
32
|
+
}): StreamSource;
|
|
8
33
|
|
|
9
34
|
declare function generic(config: GenericAdapterConfig): AdapterFactory;
|
|
10
35
|
|
|
@@ -803,4 +828,4 @@ declare function refreshCredentials(adapter: unknown, next: string, options?: {
|
|
|
803
828
|
logger?: (msg: string) => void;
|
|
804
829
|
}): Promise<boolean>;
|
|
805
830
|
|
|
806
|
-
export { type AnthropicConfig, type ApplyCarbonOptions, type AzureOpenAIConfig, type BailConfig, type BedrockConfig, type BedrockRuntimeClientLike, type CarbonTable, type CerebrasConfig, type CohereConfig, type CredentialRefreshable, DEFAULT_CARBON_TABLE, DEFAULT_DEPRECATION_TABLE, type DeepSeekConfig, type DeepSeekEmbedderConfig, type DeprecationAction, type DeprecationPolicy, type EnsembleAggregator, type EnsembleBranchResult, type EnsembleCandidate, type EnsembleOptions, type FallbackCandidate, type FallbackOptions, type FireworksConfig, type GeminiConfig, type GeminiEmbedderConfig, GenericAdapterConfig, type GrokConfig, type GrokEmbedderConfig, type GroqConfig, type HuggingFaceConfig, type KimiConfig, type KimiEmbedderConfig, type LMStudioConfig, type LangChainConfig, type LangGraphConfig, type LlamaCppConfig, type MistralConfig, type MockAdapterOptions, type MockResponse, type ModelDeprecation, type OllamaConfig, type OllamaEmbedderConfig, type OpenAICompatibleEmbedderConfig, type OpenAIConfig, type OpenAIEmbedderConfig, type OpenRouterConfig, type ProviderRegionKey, type RecordedTurn, type RecordingFixture, type RecordingSink, type ReplicateConfig, type ResolveModelInput, type ResolveModelResult, RetryOptions, type RotatingCredentials, type RouterCandidate, type RouterOptions, type RouterPolicy, type TogetherConfig, type VLLMConfig, type VercelAIConfig, type VertexConfig, type WebLlmConfig, type WebLlmEngineLike, anthropic, applyCarbonTable, azureOpenAI, azureOpenAIAdapter, bail, bailAdapter, bedrock, bedrockAdapter, cerebras, cerebrasAdapter, cohere, cohereAdapter, createEnsembleAdapter, createFallbackAdapter, createOpenAICompatibleEmbedder, createRotatingCredentials, createRouter, deepseek, deepseekEmbedder, estimateCO2Grams, fireworks, gemini, geminiEmbedder, generic, grok, grokEmbedder, groq, groqAdapter, huggingface, inMemorySink, kimi, kimiEmbedder, langchain, langgraph, llamacpp, lmstudio, mistral, mockAdapter, ollama, ollamaEmbedder, openai, openaiEmbedder, openrouter, qwen, recordingAdapter, refreshCredentials, replayAdapter, replicate, replicateAdapter, resolveModel, together, vercelAI, vertex, vertexAdapter, vllm, webllm, webllmAdapter, withDeprecationPolicy };
|
|
831
|
+
export { type AnthropicConfig, type ApplyCarbonOptions, type AzureOpenAIConfig, type BailConfig, type BedrockConfig, type BedrockRuntimeClientLike, type CarbonTable, type CerebrasConfig, type CohereConfig, type CredentialRefreshable, DEFAULT_CARBON_TABLE, DEFAULT_DEPRECATION_TABLE, type DeepSeekConfig, type DeepSeekEmbedderConfig, type DeprecationAction, type DeprecationPolicy, type EnsembleAggregator, type EnsembleBranchResult, type EnsembleCandidate, type EnsembleOptions, type FallbackCandidate, type FallbackOptions, type FireworksConfig, type GeminiConfig, type GeminiEmbedderConfig, GenericAdapterConfig, type GrokConfig, type GrokEmbedderConfig, type GroqConfig, type HuggingFaceConfig, type KimiConfig, type KimiEmbedderConfig, type LMStudioConfig, type LangChainConfig, type LangGraphConfig, type LlamaCppConfig, type MistralConfig, type MockAdapterOptions, type MockResponse, type ModelDeprecation, type OllamaConfig, type OllamaEmbedderConfig, type OpenAICompatibleEmbedderConfig, type OpenAIConfig, type OpenAIEmbedderConfig, type OpenRouterConfig, type ProviderRegionKey, type RecordedTurn, type RecordingFixture, type RecordingSink, type ReplicateConfig, type ResolveModelInput, type ResolveModelResult, RetryOptions, type RotatingCredentials, type RouterCandidate, type RouterOptions, type RouterPolicy, type TogetherConfig, type VLLMConfig, type VercelAIConfig, type VertexConfig, type WebLlmConfig, type WebLlmEngineLike, anthropic, applyCarbonTable, azureOpenAI, azureOpenAIAdapter, bail, bailAdapter, bedrock, bedrockAdapter, cerebras, cerebrasAdapter, chunkText, cohere, cohereAdapter, createEnsembleAdapter, createFallbackAdapter, createOpenAICompatibleEmbedder, createRotatingCredentials, createRouter, deepseek, deepseekEmbedder, estimateCO2Grams, fireworks, gemini, geminiEmbedder, generic, grok, grokEmbedder, groq, groqAdapter, huggingface, inMemorySink, kimi, kimiEmbedder, langchain, langgraph, llamacpp, lmstudio, mistral, mockAdapter, ollama, ollamaEmbedder, openai, openaiEmbedder, openrouter, qwen, recordingAdapter, refreshCredentials, replayAdapter, replicate, replicateAdapter, resolveModel, simulateStream, together, vercelAI, vertex, vertexAdapter, vllm, webllm, webllmAdapter, withDeprecationPolicy };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { createAdapter } from './chunk-3DO3UAVT.js';
|
|
2
|
-
import { createStreamSource, parseAnthropicStream, parseGeminiStream, parseOllamaStream, toProviderMessages, parseOpenAIStream, openai
|
|
3
|
-
export { chunkText, fetchWithRetry, openai, simulateStream } from './chunk-
|
|
2
|
+
import { createStreamSource, parseAnthropicStream, parseGeminiStream, parseOllamaStream, toProviderMessages, parseOpenAIStream, openai } from './chunk-MJDQXBVD.js';
|
|
3
|
+
export { chunkText, fetchWithRetry, openai, simulateStream } from './chunk-MJDQXBVD.js';
|
|
4
4
|
import { raceAbort, isAbortError, adapterErrorChunk, abortableSleep, parseCompleteToolArgs } from './chunk-6CIB2QCH.js';
|
|
5
|
+
import { parseSSE } from '@agentskit/net';
|
|
5
6
|
import { ConfigError, ErrorCodes, AdapterError } from '@agentskit/core';
|
|
6
7
|
|
|
7
8
|
// src/generic.ts
|
|
@@ -423,8 +424,6 @@ function langgraph(config) {
|
|
|
423
424
|
mode: "events"
|
|
424
425
|
});
|
|
425
426
|
}
|
|
426
|
-
|
|
427
|
-
// src/vercel-ai.ts
|
|
428
427
|
var UI_STREAM_HEADER = "x-vercel-ai-ui-message-stream";
|
|
429
428
|
async function* parseVercelTextStream(stream) {
|
|
430
429
|
const reader = stream.getReader();
|
|
@@ -442,7 +441,7 @@ async function* parseVercelTextStream(stream) {
|
|
|
442
441
|
yield { type: "done" };
|
|
443
442
|
}
|
|
444
443
|
async function* parseVercelUiMessageStreamV1(stream) {
|
|
445
|
-
for await (const data of
|
|
444
|
+
for await (const { data } of parseSSE(stream)) {
|
|
446
445
|
if (data === "[DONE]") {
|
|
447
446
|
yield { type: "done" };
|
|
448
447
|
return;
|