ai 3.3.5 → 3.3.6
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 +82 -60
- package/dist/index.d.ts +82 -60
- package/dist/index.js +231 -213
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +181 -152
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -8
- package/rsc/dist/rsc-server.mjs +5 -37
- package/rsc/dist/rsc-server.mjs.map +1 -1
package/dist/index.d.mts
CHANGED
@@ -1,11 +1,9 @@
|
|
1
|
-
import { DeepPartial, Attachment, JSONValue, CreateMessage, FunctionCall as FunctionCall$1, AssistantMessage, DataMessage } from '@ai-sdk/ui-utils';
|
2
|
-
export { AssistantMessage, AssistantStatus, ChatRequest, ChatRequestOptions, CreateMessage, DataMessage, DeepPartial, Function, FunctionCall, FunctionCallHandler, IdGenerator, JSONValue, Message, RequestOptions, StreamPart, Tool, ToolCall, ToolCallHandler, ToolChoice, ToolInvocation, UseAssistantOptions, formatStreamPart, parseComplexResponse, parseStreamPart, readDataStream } from '@ai-sdk/ui-utils';
|
1
|
+
import { Schema, DeepPartial, Attachment, JSONValue, CreateMessage, FunctionCall as FunctionCall$1, AssistantMessage, DataMessage } from '@ai-sdk/ui-utils';
|
2
|
+
export { AssistantMessage, AssistantStatus, ChatRequest, ChatRequestOptions, CreateMessage, DataMessage, DeepPartial, Function, FunctionCall, FunctionCallHandler, IdGenerator, JSONValue, Message, RequestOptions, Schema, StreamPart, Tool, ToolCall, ToolCallHandler, ToolChoice, ToolInvocation, UseAssistantOptions, formatStreamPart, jsonSchema, parseComplexResponse, parseStreamPart, readDataStream } from '@ai-sdk/ui-utils';
|
3
3
|
import { AttributeValue, Span } from '@opentelemetry/api';
|
4
4
|
import { EmbeddingModelV1, EmbeddingModelV1Embedding, LanguageModelV1, LanguageModelV1FinishReason, LanguageModelV1LogProbs, LanguageModelV1CallWarning, LanguageModelV1StreamPart, AISDKError } from '@ai-sdk/provider';
|
5
5
|
export { AISDKError, APICallError, EmptyResponseBodyError, InvalidPromptError, InvalidResponseDataError, JSONParseError, LoadAPIKeyError, TypeValidationError, UnsupportedFunctionalityError } from '@ai-sdk/provider';
|
6
6
|
import { z } from 'zod';
|
7
|
-
import { Validator } from '@ai-sdk/provider-utils';
|
8
|
-
import { JSONSchema7 } from 'json-schema';
|
9
7
|
import { ServerResponse } from 'http';
|
10
8
|
import { ServerResponse as ServerResponse$1 } from 'node:http';
|
11
9
|
import { AssistantStream } from 'openai/lib/AssistantStream';
|
@@ -514,40 +512,6 @@ type Prompt = {
|
|
514
512
|
messages?: Array<CoreMessage>;
|
515
513
|
};
|
516
514
|
|
517
|
-
/**
|
518
|
-
* Used to mark schemas so we can support both Zod and custom schemas.
|
519
|
-
*/
|
520
|
-
declare const schemaSymbol: unique symbol;
|
521
|
-
type Schema<OBJECT = unknown> = Validator<OBJECT> & {
|
522
|
-
/**
|
523
|
-
* Used to mark schemas so we can support both Zod and custom schemas.
|
524
|
-
*/
|
525
|
-
[schemaSymbol]: true;
|
526
|
-
/**
|
527
|
-
* Schema type for inference.
|
528
|
-
*/
|
529
|
-
_type: OBJECT;
|
530
|
-
/**
|
531
|
-
* The JSON Schema for the schema. It is passed to the providers.
|
532
|
-
*/
|
533
|
-
readonly jsonSchema: JSONSchema7;
|
534
|
-
};
|
535
|
-
/**
|
536
|
-
* Create a schema using a JSON Schema.
|
537
|
-
*
|
538
|
-
* @param jsonSchema The JSON Schema for the schema.
|
539
|
-
* @param options.validate Optional. A validation function for the schema.
|
540
|
-
*/
|
541
|
-
declare function jsonSchema<OBJECT = unknown>(jsonSchema: JSONSchema7, { validate, }?: {
|
542
|
-
validate?: (value: unknown) => {
|
543
|
-
success: true;
|
544
|
-
value: OBJECT;
|
545
|
-
} | {
|
546
|
-
success: false;
|
547
|
-
error: Error;
|
548
|
-
};
|
549
|
-
}): Schema<OBJECT>;
|
550
|
-
|
551
515
|
/**
|
552
516
|
The result of a `generateObject` call.
|
553
517
|
*/
|
@@ -1583,13 +1547,22 @@ declare class DefaultStreamTextResult<TOOLS extends Record<string, CoreTool>> im
|
|
1583
1547
|
*/
|
1584
1548
|
declare const experimental_streamText: typeof streamText;
|
1585
1549
|
|
1586
|
-
declare
|
1550
|
+
declare const symbol$a: unique symbol;
|
1551
|
+
declare class InvalidModelIdError extends AISDKError {
|
1552
|
+
private readonly [symbol$a];
|
1587
1553
|
readonly id: string;
|
1588
1554
|
constructor({ id, message, }: {
|
1589
1555
|
id: string;
|
1590
1556
|
message?: string;
|
1591
1557
|
});
|
1558
|
+
static isInstance(error: unknown): error is InvalidModelIdError;
|
1559
|
+
/**
|
1560
|
+
* @deprecated use `isInstance` instead
|
1561
|
+
*/
|
1592
1562
|
static isInvalidModelIdError(error: unknown): error is InvalidModelIdError;
|
1563
|
+
/**
|
1564
|
+
* @deprecated Do not use this method. It will be removed in the next major version.
|
1565
|
+
*/
|
1593
1566
|
toJSON(): {
|
1594
1567
|
name: string;
|
1595
1568
|
message: string;
|
@@ -1598,25 +1571,37 @@ declare class InvalidModelIdError extends Error {
|
|
1598
1571
|
};
|
1599
1572
|
}
|
1600
1573
|
|
1601
|
-
declare
|
1574
|
+
declare const symbol$9: unique symbol;
|
1575
|
+
type ModelType = 'languageModel' | 'textEmbeddingModel';
|
1576
|
+
declare class NoSuchModelError extends AISDKError {
|
1577
|
+
private readonly [symbol$9];
|
1602
1578
|
readonly modelId: string;
|
1603
|
-
readonly modelType:
|
1579
|
+
readonly modelType: ModelType;
|
1604
1580
|
constructor({ modelId, modelType, message, }: {
|
1605
1581
|
modelId: string;
|
1606
|
-
modelType:
|
1582
|
+
modelType: ModelType;
|
1607
1583
|
message?: string;
|
1608
1584
|
});
|
1585
|
+
static isInstance(error: unknown): error is NoSuchModelError;
|
1586
|
+
/**
|
1587
|
+
* @deprecated use `isInstance` instead
|
1588
|
+
*/
|
1609
1589
|
static isNoSuchModelError(error: unknown): error is NoSuchModelError;
|
1590
|
+
/**
|
1591
|
+
* @deprecated Do not use this method. It will be removed in the next major version.
|
1592
|
+
*/
|
1610
1593
|
toJSON(): {
|
1611
1594
|
name: string;
|
1612
1595
|
message: string;
|
1613
1596
|
stack: string | undefined;
|
1614
1597
|
modelId: string;
|
1615
|
-
modelType:
|
1598
|
+
modelType: ModelType;
|
1616
1599
|
};
|
1617
1600
|
}
|
1618
1601
|
|
1619
|
-
declare
|
1602
|
+
declare const symbol$8: unique symbol;
|
1603
|
+
declare class NoSuchProviderError extends AISDKError {
|
1604
|
+
private readonly [symbol$8];
|
1620
1605
|
readonly providerId: string;
|
1621
1606
|
readonly availableProviders: string[];
|
1622
1607
|
constructor({ providerId, availableProviders, message, }: {
|
@@ -1624,7 +1609,14 @@ declare class NoSuchProviderError extends Error {
|
|
1624
1609
|
availableProviders: string[];
|
1625
1610
|
message?: string;
|
1626
1611
|
});
|
1612
|
+
static isInstance(error: unknown): error is NoSuchProviderError;
|
1613
|
+
/**
|
1614
|
+
* @deprecated use `isInstance` instead
|
1615
|
+
*/
|
1627
1616
|
static isNoSuchProviderError(error: unknown): error is NoSuchProviderError;
|
1617
|
+
/**
|
1618
|
+
* @deprecated Do not use this method. It will be removed in the next major version.
|
1619
|
+
*/
|
1628
1620
|
toJSON(): {
|
1629
1621
|
name: string;
|
1630
1622
|
message: string;
|
@@ -1634,6 +1626,50 @@ declare class NoSuchProviderError extends Error {
|
|
1634
1626
|
};
|
1635
1627
|
}
|
1636
1628
|
|
1629
|
+
/**
|
1630
|
+
* Provides for language and text embedding models.
|
1631
|
+
*/
|
1632
|
+
interface experimental_Provider {
|
1633
|
+
/**
|
1634
|
+
Returns the language model with the given id in the format `providerId:modelId`.
|
1635
|
+
The model id is then passed to the provider function to get the model.
|
1636
|
+
|
1637
|
+
@param {string} id - The id of the model to return.
|
1638
|
+
|
1639
|
+
@throws {NoSuchModelError} If no model with the given id exists.
|
1640
|
+
@throws {NoSuchProviderError} If no provider with the given id exists.
|
1641
|
+
|
1642
|
+
@returns {LanguageModel} The language model associated with the id.
|
1643
|
+
*/
|
1644
|
+
languageModel?: (modelId: string) => LanguageModel;
|
1645
|
+
/**
|
1646
|
+
Returns the text embedding model with the given id in the format `providerId:modelId`.
|
1647
|
+
The model id is then passed to the provider function to get the model.
|
1648
|
+
|
1649
|
+
@param {string} id - The id of the model to return.
|
1650
|
+
|
1651
|
+
@throws {NoSuchModelError} If no model with the given id exists.
|
1652
|
+
@throws {NoSuchProviderError} If no provider with the given id exists.
|
1653
|
+
|
1654
|
+
@returns {LanguageModel} The language model associated with the id.
|
1655
|
+
*/
|
1656
|
+
textEmbeddingModel?: (modelId: string) => EmbeddingModel<string>;
|
1657
|
+
/**
|
1658
|
+
Returns the text embedding model with the given id in the format `providerId:modelId`.
|
1659
|
+
The model id is then passed to the provider function to get the model.
|
1660
|
+
|
1661
|
+
@param {string} id - The id of the model to return.
|
1662
|
+
|
1663
|
+
@throws {NoSuchModelError} If no model with the given id exists.
|
1664
|
+
@throws {NoSuchProviderError} If no provider with the given id exists.
|
1665
|
+
|
1666
|
+
@returns {LanguageModel} The language model associated with the id.
|
1667
|
+
|
1668
|
+
@deprecated use `textEmbeddingModel` instead.
|
1669
|
+
*/
|
1670
|
+
textEmbedding?: (modelId: string) => EmbeddingModel<string>;
|
1671
|
+
}
|
1672
|
+
|
1637
1673
|
/**
|
1638
1674
|
Registry for managing models. It enables getting a model with a string id.
|
1639
1675
|
*/
|
@@ -1667,24 +1703,10 @@ type experimental_ProviderRegistry = {
|
|
1667
1703
|
* @deprecated Use `experimental_ProviderRegistry` instead.
|
1668
1704
|
*/
|
1669
1705
|
type experimental_ModelRegistry = experimental_ProviderRegistry;
|
1670
|
-
/**
|
1671
|
-
* Provider for language and text embedding models. Compatible with the
|
1672
|
-
* provider registry.
|
1673
|
-
*/
|
1674
|
-
interface Provider {
|
1675
|
-
/**
|
1676
|
-
* Returns a language model with the given id.
|
1677
|
-
*/
|
1678
|
-
languageModel?: (modelId: string) => LanguageModel;
|
1679
|
-
/**
|
1680
|
-
* Returns a text embedding model with the given id.
|
1681
|
-
*/
|
1682
|
-
textEmbedding?: (modelId: string) => EmbeddingModel<string>;
|
1683
|
-
}
|
1684
1706
|
/**
|
1685
1707
|
* Creates a registry for the given providers.
|
1686
1708
|
*/
|
1687
|
-
declare function experimental_createProviderRegistry(providers: Record<string,
|
1709
|
+
declare function experimental_createProviderRegistry(providers: Record<string, experimental_Provider>): experimental_ProviderRegistry;
|
1688
1710
|
/**
|
1689
1711
|
* @deprecated Use `experimental_createProviderRegistry` instead.
|
1690
1712
|
*/
|
@@ -2678,4 +2700,4 @@ declare const generateId: (size?: number | undefined) => string;
|
|
2678
2700
|
*/
|
2679
2701
|
declare const nanoid: (size?: number | undefined) => string;
|
2680
2702
|
|
2681
|
-
export { AIStream, AIStreamCallbacksAndOptions, AIStreamParser, AIStreamParserOptions, AWSBedrockAnthropicMessagesStream, AWSBedrockAnthropicStream, AWSBedrockCohereStream, AWSBedrockLlama2Stream, AWSBedrockStream, AnthropicStream, AssistantContent, AssistantResponse, CallWarning, CohereStream, CompletionTokenUsage, CompletionUsage, CoreAssistantMessage, CoreMessage, CoreSystemMessage, CoreTool, CoreToolChoice, CoreToolMessage, CoreUserMessage, DataContent, DownloadError, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingTokenUsage, ExperimentalAssistantMessage, ExperimentalMessage, ExperimentalTool, ExperimentalToolMessage, ExperimentalUserMessage, FinishReason, FunctionCallPayload, GenerateObjectResult, GenerateTextResult, GoogleGenerativeAIStream, HuggingFaceStream, ImagePart, InkeepAIStreamCallbacksAndOptions, InkeepChatResultCallbacks, InkeepOnFinalMetadata, InkeepStream, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidModelIdError, InvalidToolArgumentsError, langchainAdapter as LangChainAdapter, LangChainStream, LanguageModel, LogProbs, MistralStream, NoObjectGeneratedError, NoSuchModelError, NoSuchProviderError, NoSuchToolError, ObjectStreamInputPart, ObjectStreamPart, OpenAIStream, OpenAIStreamCallbacks, ReplicateStream, RetryError,
|
2703
|
+
export { AIStream, AIStreamCallbacksAndOptions, AIStreamParser, AIStreamParserOptions, AWSBedrockAnthropicMessagesStream, AWSBedrockAnthropicStream, AWSBedrockCohereStream, AWSBedrockLlama2Stream, AWSBedrockStream, AnthropicStream, AssistantContent, AssistantResponse, CallWarning, CohereStream, CompletionTokenUsage, CompletionUsage, CoreAssistantMessage, CoreMessage, CoreSystemMessage, CoreTool, CoreToolChoice, CoreToolMessage, CoreUserMessage, DataContent, DownloadError, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingTokenUsage, ExperimentalAssistantMessage, ExperimentalMessage, ExperimentalTool, ExperimentalToolMessage, ExperimentalUserMessage, FinishReason, FunctionCallPayload, GenerateObjectResult, GenerateTextResult, GoogleGenerativeAIStream, HuggingFaceStream, ImagePart, InkeepAIStreamCallbacksAndOptions, InkeepChatResultCallbacks, InkeepOnFinalMetadata, InkeepStream, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidModelIdError, InvalidToolArgumentsError, langchainAdapter as LangChainAdapter, LangChainStream, LanguageModel, LogProbs, MistralStream, ModelType, NoObjectGeneratedError, NoSuchModelError, NoSuchProviderError, NoSuchToolError, ObjectStreamInputPart, ObjectStreamPart, OpenAIStream, OpenAIStreamCallbacks, ReplicateStream, RetryError, StreamData, StreamObjectResult, StreamTextResult, StreamingTextResponse, TextPart$1 as TextPart, TextStreamPart, TokenUsage, ToolCallPart, ToolCallPayload, ToolContent, ToolResultPart, UserContent, convertDataContentToBase64String, convertDataContentToUint8Array, convertToCoreMessages, convertUint8ArrayToText, cosineSimilarity, createCallbacksTransformer, createEventStreamTransformer, createStreamDataTransformer, embed, embedMany, experimental_AssistantResponse, experimental_ModelRegistry, experimental_Provider, experimental_ProviderRegistry, experimental_StreamData, experimental_createModelRegistry, experimental_createProviderRegistry, experimental_generateObject, experimental_generateText, experimental_streamObject, experimental_streamText, generateId, generateObject, generateText, nanoid, readableFromAsyncIterable, streamObject, streamText, streamToResponse, tool, trimStartOfStreamHelper };
|
package/dist/index.d.ts
CHANGED
@@ -1,11 +1,9 @@
|
|
1
|
-
import { DeepPartial, Attachment, JSONValue, CreateMessage, FunctionCall as FunctionCall$1, AssistantMessage, DataMessage } from '@ai-sdk/ui-utils';
|
2
|
-
export { AssistantMessage, AssistantStatus, ChatRequest, ChatRequestOptions, CreateMessage, DataMessage, DeepPartial, Function, FunctionCall, FunctionCallHandler, IdGenerator, JSONValue, Message, RequestOptions, StreamPart, Tool, ToolCall, ToolCallHandler, ToolChoice, ToolInvocation, UseAssistantOptions, formatStreamPart, parseComplexResponse, parseStreamPart, readDataStream } from '@ai-sdk/ui-utils';
|
1
|
+
import { Schema, DeepPartial, Attachment, JSONValue, CreateMessage, FunctionCall as FunctionCall$1, AssistantMessage, DataMessage } from '@ai-sdk/ui-utils';
|
2
|
+
export { AssistantMessage, AssistantStatus, ChatRequest, ChatRequestOptions, CreateMessage, DataMessage, DeepPartial, Function, FunctionCall, FunctionCallHandler, IdGenerator, JSONValue, Message, RequestOptions, Schema, StreamPart, Tool, ToolCall, ToolCallHandler, ToolChoice, ToolInvocation, UseAssistantOptions, formatStreamPart, jsonSchema, parseComplexResponse, parseStreamPart, readDataStream } from '@ai-sdk/ui-utils';
|
3
3
|
import { AttributeValue, Span } from '@opentelemetry/api';
|
4
4
|
import { EmbeddingModelV1, EmbeddingModelV1Embedding, LanguageModelV1, LanguageModelV1FinishReason, LanguageModelV1LogProbs, LanguageModelV1CallWarning, LanguageModelV1StreamPart, AISDKError } from '@ai-sdk/provider';
|
5
5
|
export { AISDKError, APICallError, EmptyResponseBodyError, InvalidPromptError, InvalidResponseDataError, JSONParseError, LoadAPIKeyError, TypeValidationError, UnsupportedFunctionalityError } from '@ai-sdk/provider';
|
6
6
|
import { z } from 'zod';
|
7
|
-
import { Validator } from '@ai-sdk/provider-utils';
|
8
|
-
import { JSONSchema7 } from 'json-schema';
|
9
7
|
import { ServerResponse } from 'http';
|
10
8
|
import { ServerResponse as ServerResponse$1 } from 'node:http';
|
11
9
|
import { AssistantStream } from 'openai/lib/AssistantStream';
|
@@ -514,40 +512,6 @@ type Prompt = {
|
|
514
512
|
messages?: Array<CoreMessage>;
|
515
513
|
};
|
516
514
|
|
517
|
-
/**
|
518
|
-
* Used to mark schemas so we can support both Zod and custom schemas.
|
519
|
-
*/
|
520
|
-
declare const schemaSymbol: unique symbol;
|
521
|
-
type Schema<OBJECT = unknown> = Validator<OBJECT> & {
|
522
|
-
/**
|
523
|
-
* Used to mark schemas so we can support both Zod and custom schemas.
|
524
|
-
*/
|
525
|
-
[schemaSymbol]: true;
|
526
|
-
/**
|
527
|
-
* Schema type for inference.
|
528
|
-
*/
|
529
|
-
_type: OBJECT;
|
530
|
-
/**
|
531
|
-
* The JSON Schema for the schema. It is passed to the providers.
|
532
|
-
*/
|
533
|
-
readonly jsonSchema: JSONSchema7;
|
534
|
-
};
|
535
|
-
/**
|
536
|
-
* Create a schema using a JSON Schema.
|
537
|
-
*
|
538
|
-
* @param jsonSchema The JSON Schema for the schema.
|
539
|
-
* @param options.validate Optional. A validation function for the schema.
|
540
|
-
*/
|
541
|
-
declare function jsonSchema<OBJECT = unknown>(jsonSchema: JSONSchema7, { validate, }?: {
|
542
|
-
validate?: (value: unknown) => {
|
543
|
-
success: true;
|
544
|
-
value: OBJECT;
|
545
|
-
} | {
|
546
|
-
success: false;
|
547
|
-
error: Error;
|
548
|
-
};
|
549
|
-
}): Schema<OBJECT>;
|
550
|
-
|
551
515
|
/**
|
552
516
|
The result of a `generateObject` call.
|
553
517
|
*/
|
@@ -1583,13 +1547,22 @@ declare class DefaultStreamTextResult<TOOLS extends Record<string, CoreTool>> im
|
|
1583
1547
|
*/
|
1584
1548
|
declare const experimental_streamText: typeof streamText;
|
1585
1549
|
|
1586
|
-
declare
|
1550
|
+
declare const symbol$a: unique symbol;
|
1551
|
+
declare class InvalidModelIdError extends AISDKError {
|
1552
|
+
private readonly [symbol$a];
|
1587
1553
|
readonly id: string;
|
1588
1554
|
constructor({ id, message, }: {
|
1589
1555
|
id: string;
|
1590
1556
|
message?: string;
|
1591
1557
|
});
|
1558
|
+
static isInstance(error: unknown): error is InvalidModelIdError;
|
1559
|
+
/**
|
1560
|
+
* @deprecated use `isInstance` instead
|
1561
|
+
*/
|
1592
1562
|
static isInvalidModelIdError(error: unknown): error is InvalidModelIdError;
|
1563
|
+
/**
|
1564
|
+
* @deprecated Do not use this method. It will be removed in the next major version.
|
1565
|
+
*/
|
1593
1566
|
toJSON(): {
|
1594
1567
|
name: string;
|
1595
1568
|
message: string;
|
@@ -1598,25 +1571,37 @@ declare class InvalidModelIdError extends Error {
|
|
1598
1571
|
};
|
1599
1572
|
}
|
1600
1573
|
|
1601
|
-
declare
|
1574
|
+
declare const symbol$9: unique symbol;
|
1575
|
+
type ModelType = 'languageModel' | 'textEmbeddingModel';
|
1576
|
+
declare class NoSuchModelError extends AISDKError {
|
1577
|
+
private readonly [symbol$9];
|
1602
1578
|
readonly modelId: string;
|
1603
|
-
readonly modelType:
|
1579
|
+
readonly modelType: ModelType;
|
1604
1580
|
constructor({ modelId, modelType, message, }: {
|
1605
1581
|
modelId: string;
|
1606
|
-
modelType:
|
1582
|
+
modelType: ModelType;
|
1607
1583
|
message?: string;
|
1608
1584
|
});
|
1585
|
+
static isInstance(error: unknown): error is NoSuchModelError;
|
1586
|
+
/**
|
1587
|
+
* @deprecated use `isInstance` instead
|
1588
|
+
*/
|
1609
1589
|
static isNoSuchModelError(error: unknown): error is NoSuchModelError;
|
1590
|
+
/**
|
1591
|
+
* @deprecated Do not use this method. It will be removed in the next major version.
|
1592
|
+
*/
|
1610
1593
|
toJSON(): {
|
1611
1594
|
name: string;
|
1612
1595
|
message: string;
|
1613
1596
|
stack: string | undefined;
|
1614
1597
|
modelId: string;
|
1615
|
-
modelType:
|
1598
|
+
modelType: ModelType;
|
1616
1599
|
};
|
1617
1600
|
}
|
1618
1601
|
|
1619
|
-
declare
|
1602
|
+
declare const symbol$8: unique symbol;
|
1603
|
+
declare class NoSuchProviderError extends AISDKError {
|
1604
|
+
private readonly [symbol$8];
|
1620
1605
|
readonly providerId: string;
|
1621
1606
|
readonly availableProviders: string[];
|
1622
1607
|
constructor({ providerId, availableProviders, message, }: {
|
@@ -1624,7 +1609,14 @@ declare class NoSuchProviderError extends Error {
|
|
1624
1609
|
availableProviders: string[];
|
1625
1610
|
message?: string;
|
1626
1611
|
});
|
1612
|
+
static isInstance(error: unknown): error is NoSuchProviderError;
|
1613
|
+
/**
|
1614
|
+
* @deprecated use `isInstance` instead
|
1615
|
+
*/
|
1627
1616
|
static isNoSuchProviderError(error: unknown): error is NoSuchProviderError;
|
1617
|
+
/**
|
1618
|
+
* @deprecated Do not use this method. It will be removed in the next major version.
|
1619
|
+
*/
|
1628
1620
|
toJSON(): {
|
1629
1621
|
name: string;
|
1630
1622
|
message: string;
|
@@ -1634,6 +1626,50 @@ declare class NoSuchProviderError extends Error {
|
|
1634
1626
|
};
|
1635
1627
|
}
|
1636
1628
|
|
1629
|
+
/**
|
1630
|
+
* Provides for language and text embedding models.
|
1631
|
+
*/
|
1632
|
+
interface experimental_Provider {
|
1633
|
+
/**
|
1634
|
+
Returns the language model with the given id in the format `providerId:modelId`.
|
1635
|
+
The model id is then passed to the provider function to get the model.
|
1636
|
+
|
1637
|
+
@param {string} id - The id of the model to return.
|
1638
|
+
|
1639
|
+
@throws {NoSuchModelError} If no model with the given id exists.
|
1640
|
+
@throws {NoSuchProviderError} If no provider with the given id exists.
|
1641
|
+
|
1642
|
+
@returns {LanguageModel} The language model associated with the id.
|
1643
|
+
*/
|
1644
|
+
languageModel?: (modelId: string) => LanguageModel;
|
1645
|
+
/**
|
1646
|
+
Returns the text embedding model with the given id in the format `providerId:modelId`.
|
1647
|
+
The model id is then passed to the provider function to get the model.
|
1648
|
+
|
1649
|
+
@param {string} id - The id of the model to return.
|
1650
|
+
|
1651
|
+
@throws {NoSuchModelError} If no model with the given id exists.
|
1652
|
+
@throws {NoSuchProviderError} If no provider with the given id exists.
|
1653
|
+
|
1654
|
+
@returns {LanguageModel} The language model associated with the id.
|
1655
|
+
*/
|
1656
|
+
textEmbeddingModel?: (modelId: string) => EmbeddingModel<string>;
|
1657
|
+
/**
|
1658
|
+
Returns the text embedding model with the given id in the format `providerId:modelId`.
|
1659
|
+
The model id is then passed to the provider function to get the model.
|
1660
|
+
|
1661
|
+
@param {string} id - The id of the model to return.
|
1662
|
+
|
1663
|
+
@throws {NoSuchModelError} If no model with the given id exists.
|
1664
|
+
@throws {NoSuchProviderError} If no provider with the given id exists.
|
1665
|
+
|
1666
|
+
@returns {LanguageModel} The language model associated with the id.
|
1667
|
+
|
1668
|
+
@deprecated use `textEmbeddingModel` instead.
|
1669
|
+
*/
|
1670
|
+
textEmbedding?: (modelId: string) => EmbeddingModel<string>;
|
1671
|
+
}
|
1672
|
+
|
1637
1673
|
/**
|
1638
1674
|
Registry for managing models. It enables getting a model with a string id.
|
1639
1675
|
*/
|
@@ -1667,24 +1703,10 @@ type experimental_ProviderRegistry = {
|
|
1667
1703
|
* @deprecated Use `experimental_ProviderRegistry` instead.
|
1668
1704
|
*/
|
1669
1705
|
type experimental_ModelRegistry = experimental_ProviderRegistry;
|
1670
|
-
/**
|
1671
|
-
* Provider for language and text embedding models. Compatible with the
|
1672
|
-
* provider registry.
|
1673
|
-
*/
|
1674
|
-
interface Provider {
|
1675
|
-
/**
|
1676
|
-
* Returns a language model with the given id.
|
1677
|
-
*/
|
1678
|
-
languageModel?: (modelId: string) => LanguageModel;
|
1679
|
-
/**
|
1680
|
-
* Returns a text embedding model with the given id.
|
1681
|
-
*/
|
1682
|
-
textEmbedding?: (modelId: string) => EmbeddingModel<string>;
|
1683
|
-
}
|
1684
1706
|
/**
|
1685
1707
|
* Creates a registry for the given providers.
|
1686
1708
|
*/
|
1687
|
-
declare function experimental_createProviderRegistry(providers: Record<string,
|
1709
|
+
declare function experimental_createProviderRegistry(providers: Record<string, experimental_Provider>): experimental_ProviderRegistry;
|
1688
1710
|
/**
|
1689
1711
|
* @deprecated Use `experimental_createProviderRegistry` instead.
|
1690
1712
|
*/
|
@@ -2678,4 +2700,4 @@ declare const generateId: (size?: number | undefined) => string;
|
|
2678
2700
|
*/
|
2679
2701
|
declare const nanoid: (size?: number | undefined) => string;
|
2680
2702
|
|
2681
|
-
export { AIStream, AIStreamCallbacksAndOptions, AIStreamParser, AIStreamParserOptions, AWSBedrockAnthropicMessagesStream, AWSBedrockAnthropicStream, AWSBedrockCohereStream, AWSBedrockLlama2Stream, AWSBedrockStream, AnthropicStream, AssistantContent, AssistantResponse, CallWarning, CohereStream, CompletionTokenUsage, CompletionUsage, CoreAssistantMessage, CoreMessage, CoreSystemMessage, CoreTool, CoreToolChoice, CoreToolMessage, CoreUserMessage, DataContent, DownloadError, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingTokenUsage, ExperimentalAssistantMessage, ExperimentalMessage, ExperimentalTool, ExperimentalToolMessage, ExperimentalUserMessage, FinishReason, FunctionCallPayload, GenerateObjectResult, GenerateTextResult, GoogleGenerativeAIStream, HuggingFaceStream, ImagePart, InkeepAIStreamCallbacksAndOptions, InkeepChatResultCallbacks, InkeepOnFinalMetadata, InkeepStream, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidModelIdError, InvalidToolArgumentsError, langchainAdapter as LangChainAdapter, LangChainStream, LanguageModel, LogProbs, MistralStream, NoObjectGeneratedError, NoSuchModelError, NoSuchProviderError, NoSuchToolError, ObjectStreamInputPart, ObjectStreamPart, OpenAIStream, OpenAIStreamCallbacks, ReplicateStream, RetryError,
|
2703
|
+
export { AIStream, AIStreamCallbacksAndOptions, AIStreamParser, AIStreamParserOptions, AWSBedrockAnthropicMessagesStream, AWSBedrockAnthropicStream, AWSBedrockCohereStream, AWSBedrockLlama2Stream, AWSBedrockStream, AnthropicStream, AssistantContent, AssistantResponse, CallWarning, CohereStream, CompletionTokenUsage, CompletionUsage, CoreAssistantMessage, CoreMessage, CoreSystemMessage, CoreTool, CoreToolChoice, CoreToolMessage, CoreUserMessage, DataContent, DownloadError, EmbedManyResult, EmbedResult, Embedding, EmbeddingModel, EmbeddingTokenUsage, ExperimentalAssistantMessage, ExperimentalMessage, ExperimentalTool, ExperimentalToolMessage, ExperimentalUserMessage, FinishReason, FunctionCallPayload, GenerateObjectResult, GenerateTextResult, GoogleGenerativeAIStream, HuggingFaceStream, ImagePart, InkeepAIStreamCallbacksAndOptions, InkeepChatResultCallbacks, InkeepOnFinalMetadata, InkeepStream, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidModelIdError, InvalidToolArgumentsError, langchainAdapter as LangChainAdapter, LangChainStream, LanguageModel, LogProbs, MistralStream, ModelType, NoObjectGeneratedError, NoSuchModelError, NoSuchProviderError, NoSuchToolError, ObjectStreamInputPart, ObjectStreamPart, OpenAIStream, OpenAIStreamCallbacks, ReplicateStream, RetryError, StreamData, StreamObjectResult, StreamTextResult, StreamingTextResponse, TextPart$1 as TextPart, TextStreamPart, TokenUsage, ToolCallPart, ToolCallPayload, ToolContent, ToolResultPart, UserContent, convertDataContentToBase64String, convertDataContentToUint8Array, convertToCoreMessages, convertUint8ArrayToText, cosineSimilarity, createCallbacksTransformer, createEventStreamTransformer, createStreamDataTransformer, embed, embedMany, experimental_AssistantResponse, experimental_ModelRegistry, experimental_Provider, experimental_ProviderRegistry, experimental_StreamData, experimental_createModelRegistry, experimental_createProviderRegistry, experimental_generateObject, experimental_generateText, experimental_streamObject, experimental_streamText, generateId, generateObject, generateText, nanoid, readableFromAsyncIterable, streamObject, streamText, streamToResponse, tool, trimStartOfStreamHelper };
|