diff --git a/README.md b/README.md index 4b3d3750..e0de4f3a 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ A powerful, type-safe AI SDK for building AI-powered applications. Import only the functionality you need for smaller bundle sizes: ```typescript -// Only chat functionality - no embedding or summarization code bundled +// Only chat functionality - no summarization code bundled import { openaiText } from '@tanstack/ai-openai/adapters' import { generate } from '@tanstack/ai' diff --git a/docs/adapters/anthropic.md b/docs/adapters/anthropic.md index bdf3d1a1..ec844602 100644 --- a/docs/adapters/anthropic.md +++ b/docs/adapters/anthropic.md @@ -221,7 +221,6 @@ Creates an Anthropic summarization adapter with an explicit API key. ## Limitations -- **Embeddings**: Anthropic does not support embeddings natively. Use OpenAI or Gemini for embedding needs. - **Image Generation**: Anthropic does not support image generation. Use OpenAI or Gemini for image generation. ## Next Steps diff --git a/docs/adapters/gemini.md b/docs/adapters/gemini.md index 57d2451b..24e390e3 100644 --- a/docs/adapters/gemini.md +++ b/docs/adapters/gemini.md @@ -4,7 +4,7 @@ id: gemini-adapter order: 3 --- -The Google Gemini adapter provides access to Google's Gemini models, including text generation, embeddings, image generation with Imagen, and experimental text-to-speech. +The Google Gemini adapter provides access to Google's Gemini models, including text generation, image generation with Imagen, and experimental text-to-speech. ## Installation @@ -138,47 +138,6 @@ modelOptions: { } ``` -## Embeddings - -Generate text embeddings for semantic search and similarity: - -```typescript -import { embedding } from "@tanstack/ai"; -import { geminiEmbedding } from "@tanstack/ai-gemini"; - -const result = await embedding({ - adapter: geminiEmbedding("gemini-embedding-001"), - input: "The quick brown fox jumps over the lazy dog", -}); - -console.log(result.embeddings); -``` - -### Batch Embeddings - -```typescript -const result = await embedding({ - adapter: geminiEmbedding("gemini-embedding-001"), - input: [ - "First text to embed", - "Second text to embed", - "Third text to embed", - ], -}); -``` - -### Embedding Model Options - -```typescript -const result = await embedding({ - adapter: geminiEmbedding("gemini-embedding-001"), - input: "...", - modelOptions: { - taskType: "RETRIEVAL_DOCUMENT", // or "RETRIEVAL_QUERY", "SEMANTIC_SIMILARITY", etc. - }, -}); -``` - ## Summarization Summarize long text content: @@ -281,18 +240,6 @@ Creates a Gemini text/chat adapter with an explicit API key. **Returns:** A Gemini text adapter instance. -### `geminiEmbed(config?)` - -Creates a Gemini embedding adapter using environment variables. - -**Returns:** A Gemini embed adapter instance. - -### `createGeminiEmbed(apiKey, config?)` - -Creates a Gemini embedding adapter with an explicit API key. - -**Returns:** A Gemini embed adapter instance. - ### `geminiSummarize(config?)` Creates a Gemini summarization adapter using environment variables. diff --git a/docs/adapters/ollama.md b/docs/adapters/ollama.md index 5d955fb1..d17a9985 100644 --- a/docs/adapters/ollama.md +++ b/docs/adapters/ollama.md @@ -170,45 +170,6 @@ modelOptions: { } ``` -## Embeddings - -Generate text embeddings locally: - -```typescript -import { embedding } from "@tanstack/ai"; -import { ollamaEmbedding } from "@tanstack/ai-ollama"; - -const result = await embedding({ - adapter: ollamaEmbedding("nomic-embed-text"), - input: "The quick brown fox jumps over the lazy dog", -}); - -console.log(result.embeddings); -``` - -### Embedding Models - -First, pull an embedding model: - -```bash -ollama pull nomic-embed-text -# or -ollama pull mxbai-embed-large -``` - -### Batch Embeddings - -```typescript -const result = await embedding({ - adapter: ollamaEmbedding("nomic-embed-text"), - input: [ - "First text to embed", - "Second text to embed", - "Third text to embed", - ], -}); -``` - ## Summarization Summarize long text content locally: @@ -299,18 +260,6 @@ Creates an Ollama text/chat adapter with a custom host. **Returns:** An Ollama text adapter instance. -### `ollamaEmbed(options?)` - -Creates an Ollama embedding adapter. - -**Returns:** An Ollama embed adapter instance. - -### `createOllamaEmbed(host?, options?)` - -Creates an Ollama embedding adapter with a custom host. - -**Returns:** An Ollama embed adapter instance. - ### `ollamaSummarize(options?)` Creates an Ollama summarization adapter. diff --git a/docs/adapters/openai.md b/docs/adapters/openai.md index 597e8706..f4c999b2 100644 --- a/docs/adapters/openai.md +++ b/docs/adapters/openai.md @@ -4,7 +4,7 @@ id: openai-adapter order: 1 --- -The OpenAI adapter provides access to OpenAI's models, including GPT-4o, GPT-5, embeddings, image generation (DALL-E), text-to-speech (TTS), and audio transcription (Whisper). +The OpenAI adapter provides access to OpenAI's models, including GPT-4o, GPT-5, image generation (DALL-E), text-to-speech (TTS), and audio transcription (Whisper). ## Installation @@ -132,49 +132,6 @@ modelOptions: { When reasoning is enabled, the model's reasoning process is streamed separately from the response text and appears as a collapsible thinking section in the UI. -## Embeddings - -Generate text embeddings for semantic search and similarity: - -```typescript -import { embedding } from "@tanstack/ai"; -import { openaiEmbedding } from "@tanstack/ai-openai"; - -const result = await embedding({ - adapter: openaiEmbedding("text-embedding-3-small"), - input: "The quick brown fox jumps over the lazy dog", -}); - -console.log(result.embeddings); // Array of embedding vectors -``` - -### Batch Embeddings - -```typescript -const result = await embedding({ - adapter: openaiEmbedding("text-embedding-3-small"), - input: [ - "First text to embed", - "Second text to embed", - "Third text to embed", - ], -}); - -// result.embeddings contains an array of vectors -``` - -### Embedding Model Options - -```typescript -const result = await embedding({ - adapter: openaiEmbedding("text-embedding-3-small"), - input: "...", - modelOptions: { - dimensions: 512, // Reduce dimensions for smaller storage - }, -}); -``` - ## Summarization Summarize long text content: @@ -321,18 +278,6 @@ Creates an OpenAI chat adapter with an explicit API key. **Returns:** An OpenAI chat adapter instance. -### `openaiEmbedding(config?)` - -Creates an OpenAI embedding adapter using environment variables. - -**Returns:** An OpenAI embedding adapter instance. - -### `createOpenaiEmbedding(apiKey, config?)` - -Creates an OpenAI embedding adapter with an explicit API key. - -**Returns:** An OpenAI embed adapter instance. - ### `openaiSummarize(config?)` Creates an OpenAI summarization adapter using environment variables. diff --git a/docs/api/ai.md b/docs/api/ai.md index 09cbc8a1..626fa047 100644 --- a/docs/api/ai.md +++ b/docs/api/ai.md @@ -71,30 +71,6 @@ const result = await summarize({ A `SummarizationResult` with the summary text. -## `embedding(options)` - -Creates embeddings for text input. - -```typescript -import { embedding } from "@tanstack/ai"; -import { openaiEmbedding } from "@tanstack/ai-openai"; - -const result = await embedding({ - adapter: openaiEmbedding("text-embedding-3-small"), - input: "Text to embed", -}); -``` - -### Parameters - -- `adapter` - An AI adapter instance with model -- `input` - Text or array of texts to embed -- `modelOptions?` - Model-specific options - -### Returns - -An `EmbeddingResult` with embeddings array. - ## `toolDefinition(config)` Creates an isomorphic tool definition that can be instantiated for server or client execution. @@ -289,11 +265,10 @@ interface Tool { ## Usage Examples ```typescript -import { chat, summarize, embedding, generateImage } from "@tanstack/ai"; +import { chat, summarize, generateImage } from "@tanstack/ai"; import { openaiText, openaiSummarize, - openaiEmbedding, openaiImage, } from "@tanstack/ai-openai"; @@ -356,12 +331,6 @@ const summary = await summarize({ maxLength: 100, }); -// --- Embeddings -const embeddings = await embedding({ - adapter: openaiEmbedding("text-embedding-3-small"), - input: "Text to embed", -}); - // --- Image generation const image = await generateImage({ adapter: openaiImage("dall-e-3"), diff --git a/docs/guides/tree-shaking.md b/docs/guides/tree-shaking.md index 9c02a332..5829c74e 100644 --- a/docs/guides/tree-shaking.md +++ b/docs/guides/tree-shaking.md @@ -12,12 +12,12 @@ TanStack AI is designed from the ground up for maximum tree-shakeability. The en Instead of a monolithic API that includes everything, TanStack AI provides: -- **Individual activity functions** - Import only the activities you need (`chat`, `embedding`, `summarize`, etc.) -- **Individual adapter functions** - Import only the adapters you need (`openaiText`, `openaiEmbedding`, etc.) +- **Individual activity functions** - Import only the activities you need (`chat`, `summarize`, etc.) +- **Individual adapter functions** - Import only the adapters you need (`openaiText`, `openaiSummarize`, etc.) - **Functional API design** - Pure functions that can be easily eliminated by bundlers - **Separate modules** - Each activity and adapter lives in its own module -This design means that if you only use `chat` with OpenAI, you won't bundle code for embeddings, summarization, image generation, or other providers. +This design means that if you only use `chat` with OpenAI, you won't bundle code for summarization, image generation, or other providers. ## Activity Functions @@ -26,7 +26,6 @@ Each AI activity is exported as a separate function from `@tanstack/ai`: ```ts // Import only the activities you need import { chat } from '@tanstack/ai' // Chat/text generation -import { embedding } from '@tanstack/ai' // Embeddings import { summarize } from '@tanstack/ai' // Summarization import { generateImage } from '@tanstack/ai' // Image generation import { generateSpeech } from '@tanstack/ai' // Text-to-speech @@ -50,7 +49,6 @@ const stream = chat({ ``` Your bundle will **not** include: -- Embedding logic - Summarization logic - Image generation logic - Other activity implementations @@ -64,7 +62,6 @@ Each provider package exports individual adapter functions for each activity typ ```ts import { openaiText, // Chat/text generation - openaiEmbedding, // Embeddings openaiSummarize, // Summarization openaiImage, // Image generation openaiSpeech, // Text-to-speech @@ -82,14 +79,11 @@ import { } from '@tanstack/ai-anthropic' ``` -> Note: Anthropic does not support embeddings natively. - ### Gemini ```ts import { geminiText, // Chat/text generation - geminiEmbedding, // Embeddings geminiSummarize, // Summarization geminiImage, // Image generation geminiSpeech, // Text-to-speech (experimental) @@ -101,7 +95,6 @@ import { ```ts import { ollamaText, // Chat/text generation - ollamaEmbedding, // Embeddings ollamaSummarize, // Summarization } from '@tanstack/ai-ollama' ``` @@ -132,7 +125,6 @@ for await (const chunk of chatResult) { - ✅ Chat-specific streaming and tool handling logic **What doesn't get bundled:** -- ❌ `embedding` function - ❌ `summarize` function - ❌ `generateImage` function - ❌ Other adapter implementations (Anthropic, Gemini, etc.) @@ -143,11 +135,10 @@ for await (const chunk of chatResult) { If you need multiple activities, import only what you use: ```ts -import { chat, embedding, summarize } from '@tanstack/ai' -import { - openaiText, - openaiEmbedding, - openaiSummarize +import { chat, summarize } from '@tanstack/ai' +import { + openaiText, + openaiSummarize } from '@tanstack/ai-openai' // Each activity is independent @@ -156,11 +147,6 @@ const chatResult = chat({ messages: [{ role: 'user', content: 'Hello!' }], }) -const embedResult = await embedding({ - adapter: openaiEmbedding('text-embedding-3-small'), - input: 'Hello, world!', -}) - const summarizeResult = await summarize({ adapter: openaiSummarize('gpt-4o-mini'), text: 'Long text to summarize...', @@ -188,10 +174,9 @@ const model2: OpenAIChatModel = 'invalid' // ✗ Type error The `create___Options` functions are also tree-shakeable: ```ts -import { +import { createChatOptions, - createEmbeddingOptions, - createImageOptions + createImageOptions } from '@tanstack/ai' // Only import what you need @@ -275,7 +260,6 @@ import * as openai from '@tanstack/ai-openai' Each adapter type implements a specific interface: - `ChatAdapter` - Provides `chatStream()` method for streaming chat responses -- `EmbeddingAdapter` - Provides `createEmbeddings()` method for vector embeddings - `SummarizeAdapter` - Provides `summarize()` method for text summarization - `ImageAdapter` - Provides `generateImage()` method for image generation - `TTSAdapter` - Provides `generateSpeech()` method for text-to-speech @@ -288,9 +272,6 @@ All adapters have a `kind` property that indicates their type: const chatAdapter = openaiText() console.log(chatAdapter.kind) // 'text' -const embedAdapter = openaiEmbedding() -console.log(embedAdapter.kind) // 'embedding' - const summarizeAdapter = openaiSummarize() console.log(summarizeAdapter.kind) // 'summarize' ``` diff --git a/docs/reference/classes/BaseAdapter.md b/docs/reference/classes/BaseAdapter.md deleted file mode 100644 index 94e8007c..00000000 --- a/docs/reference/classes/BaseAdapter.md +++ /dev/null @@ -1,310 +0,0 @@ ---- -id: BaseAdapter -title: BaseAdapter ---- - -# Abstract Class: BaseAdapter\ - -Defined in: [base-adapter.ts:26](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/base-adapter.ts#L26) - -Base adapter class with support for endpoint-specific models and provider options. - -Generic parameters: -- TChatModels: Models that support chat/text completion -- TEmbeddingModels: Models that support embeddings -- TChatProviderOptions: Provider-specific options for chat endpoint -- TEmbeddingProviderOptions: Provider-specific options for embedding endpoint -- TModelProviderOptionsByName: Provider-specific options for model by name -- TModelInputModalitiesByName: Map from model name to its supported input modalities -- TMessageMetadataByModality: Map from modality type to adapter-specific metadata types - -## Type Parameters - -### TChatModels - -`TChatModels` *extends* `ReadonlyArray`\<`string`\> = `ReadonlyArray`\<`string`\> - -### TEmbeddingModels - -`TEmbeddingModels` *extends* `ReadonlyArray`\<`string`\> = `ReadonlyArray`\<`string`\> - -### TChatProviderOptions - -`TChatProviderOptions` *extends* `Record`\<`string`, `any`\> = `Record`\<`string`, `any`\> - -### TEmbeddingProviderOptions - -`TEmbeddingProviderOptions` *extends* `Record`\<`string`, `any`\> = `Record`\<`string`, `any`\> - -### TModelProviderOptionsByName - -`TModelProviderOptionsByName` *extends* `Record`\<`string`, `any`\> = `Record`\<`string`, `any`\> - -### TModelInputModalitiesByName - -`TModelInputModalitiesByName` *extends* `Record`\<`string`, `ReadonlyArray`\<[`Modality`](../type-aliases/Modality.md)\>\> = `Record`\<`string`, `ReadonlyArray`\<[`Modality`](../type-aliases/Modality.md)\>\> - -### TMessageMetadataByModality - -`TMessageMetadataByModality` *extends* `object` = [`DefaultMessageMetadataByModality`](../interfaces/DefaultMessageMetadataByModality.md) - -## Implements - -- [`AIAdapter`](../interfaces/AIAdapter.md)\<`TChatModels`, `TEmbeddingModels`, `TChatProviderOptions`, `TEmbeddingProviderOptions`, `TModelProviderOptionsByName`, `TModelInputModalitiesByName`, `TMessageMetadataByModality`\> - -## Constructors - -### Constructor - -```ts -new BaseAdapter(config): BaseAdapter; -``` - -Defined in: [base-adapter.ts:70](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/base-adapter.ts#L70) - -#### Parameters - -##### config - -[`AIAdapterConfig`](../interfaces/AIAdapterConfig.md) = `{}` - -#### Returns - -`BaseAdapter`\<`TChatModels`, `TEmbeddingModels`, `TChatProviderOptions`, `TEmbeddingProviderOptions`, `TModelProviderOptionsByName`, `TModelInputModalitiesByName`, `TMessageMetadataByModality`\> - -## Properties - -### \_chatProviderOptions? - -```ts -optional _chatProviderOptions: TChatProviderOptions; -``` - -Defined in: [base-adapter.ts:61](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/base-adapter.ts#L61) - -#### Implementation of - -[`AIAdapter`](../interfaces/AIAdapter.md).[`_chatProviderOptions`](../interfaces/AIAdapter.md#_chatprovideroptions) - -*** - -### \_embeddingProviderOptions? - -```ts -optional _embeddingProviderOptions: TEmbeddingProviderOptions; -``` - -Defined in: [base-adapter.ts:62](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/base-adapter.ts#L62) - -#### Implementation of - -[`AIAdapter`](../interfaces/AIAdapter.md).[`_embeddingProviderOptions`](../interfaces/AIAdapter.md#_embeddingprovideroptions) - -*** - -### \_messageMetadataByModality? - -```ts -optional _messageMetadataByModality: TMessageMetadataByModality; -``` - -Defined in: [base-adapter.ts:68](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/base-adapter.ts#L68) - -Type-only map from modality type to adapter-specific metadata types. -Used to provide type-safe autocomplete for metadata on content parts. - -#### Implementation of - -[`AIAdapter`](../interfaces/AIAdapter.md).[`_messageMetadataByModality`](../interfaces/AIAdapter.md#_messagemetadatabymodality) - -*** - -### \_modelInputModalitiesByName? - -```ts -optional _modelInputModalitiesByName: TModelInputModalitiesByName; -``` - -Defined in: [base-adapter.ts:66](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/base-adapter.ts#L66) - -Type-only map from model name to its supported input modalities. -Used by the core AI types to narrow ContentPart types based on the selected model. -Must be provided by all adapters. - -#### Implementation of - -[`AIAdapter`](../interfaces/AIAdapter.md).[`_modelInputModalitiesByName`](../interfaces/AIAdapter.md#_modelinputmodalitiesbyname) - -*** - -### \_modelProviderOptionsByName - -```ts -_modelProviderOptionsByName: TModelProviderOptionsByName; -``` - -Defined in: [base-adapter.ts:64](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/base-adapter.ts#L64) - -Type-only map from model name to its specific provider options. -Used by the core AI types to narrow providerOptions based on the selected model. -Must be provided by all adapters. - -#### Implementation of - -[`AIAdapter`](../interfaces/AIAdapter.md).[`_modelProviderOptionsByName`](../interfaces/AIAdapter.md#_modelprovideroptionsbyname) - -*** - -### \_providerOptions? - -```ts -optional _providerOptions: TChatProviderOptions; -``` - -Defined in: [base-adapter.ts:60](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/base-adapter.ts#L60) - -#### Implementation of - -[`AIAdapter`](../interfaces/AIAdapter.md).[`_providerOptions`](../interfaces/AIAdapter.md#_provideroptions) - -*** - -### config - -```ts -protected config: AIAdapterConfig; -``` - -Defined in: [base-adapter.ts:57](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/base-adapter.ts#L57) - -*** - -### embeddingModels? - -```ts -optional embeddingModels: TEmbeddingModels; -``` - -Defined in: [base-adapter.ts:56](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/base-adapter.ts#L56) - -Models that support embeddings - -#### Implementation of - -[`AIAdapter`](../interfaces/AIAdapter.md).[`embeddingModels`](../interfaces/AIAdapter.md#embeddingmodels) - -*** - -### models - -```ts -abstract models: TChatModels; -``` - -Defined in: [base-adapter.ts:55](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/base-adapter.ts#L55) - -Models that support chat/text completion - -#### Implementation of - -[`AIAdapter`](../interfaces/AIAdapter.md).[`models`](../interfaces/AIAdapter.md#models) - -*** - -### name - -```ts -abstract name: string; -``` - -Defined in: [base-adapter.ts:54](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/base-adapter.ts#L54) - -#### Implementation of - -[`AIAdapter`](../interfaces/AIAdapter.md).[`name`](../interfaces/AIAdapter.md#name) - -## Methods - -### chatStream() - -```ts -abstract chatStream(options): AsyncIterable; -``` - -Defined in: [base-adapter.ts:74](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/base-adapter.ts#L74) - -#### Parameters - -##### options - -[`TextOptions`](../interfaces/TextOptions.md) - -#### Returns - -`AsyncIterable`\<[`StreamChunk`](../type-aliases/StreamChunk.md)\> - -#### Implementation of - -[`AIAdapter`](../interfaces/AIAdapter.md).[`chatStream`](../interfaces/AIAdapter.md#chatstream) - -*** - -### createEmbeddings() - -```ts -abstract createEmbeddings(options): Promise; -``` - -Defined in: [base-adapter.ts:79](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/base-adapter.ts#L79) - -#### Parameters - -##### options - -[`EmbeddingOptions`](../interfaces/EmbeddingOptions.md) - -#### Returns - -`Promise`\<[`EmbeddingResult`](../interfaces/EmbeddingResult.md)\> - -#### Implementation of - -[`AIAdapter`](../interfaces/AIAdapter.md).[`createEmbeddings`](../interfaces/AIAdapter.md#createembeddings) - -*** - -### generateId() - -```ts -protected generateId(): string; -``` - -Defined in: [base-adapter.ts:81](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/base-adapter.ts#L81) - -#### Returns - -`string` - -*** - -### summarize() - -```ts -abstract summarize(options): Promise; -``` - -Defined in: [base-adapter.ts:76](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/base-adapter.ts#L76) - -#### Parameters - -##### options - -[`SummarizationOptions`](../interfaces/SummarizationOptions.md) - -#### Returns - -`Promise`\<[`SummarizationResult`](../interfaces/SummarizationResult.md)\> - -#### Implementation of - -[`AIAdapter`](../interfaces/AIAdapter.md).[`summarize`](../interfaces/AIAdapter.md#summarize) diff --git a/docs/reference/classes/BatchStrategy.md b/docs/reference/classes/BatchStrategy.md index a437b0aa..555db34f 100644 --- a/docs/reference/classes/BatchStrategy.md +++ b/docs/reference/classes/BatchStrategy.md @@ -5,7 +5,7 @@ title: BatchStrategy # Class: BatchStrategy -Defined in: [stream/strategies.ts:34](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/strategies.ts#L34) +Defined in: [activities/chat/stream/strategies.ts:34](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/strategies.ts#L34) Batch Strategy - emit every N chunks Useful for reducing UI update frequency @@ -22,7 +22,7 @@ Useful for reducing UI update frequency new BatchStrategy(batchSize): BatchStrategy; ``` -Defined in: [stream/strategies.ts:37](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/strategies.ts#L37) +Defined in: [activities/chat/stream/strategies.ts:37](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/strategies.ts#L37) #### Parameters @@ -42,7 +42,7 @@ Defined in: [stream/strategies.ts:37](https://github.com/TanStack/ai/blob/main/p reset(): void; ``` -Defined in: [stream/strategies.ts:48](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/strategies.ts#L48) +Defined in: [activities/chat/stream/strategies.ts:48](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/strategies.ts#L48) Optional: Reset strategy state (called when streaming starts) @@ -62,7 +62,7 @@ Optional: Reset strategy state (called when streaming starts) shouldEmit(_chunk, _accumulated): boolean; ``` -Defined in: [stream/strategies.ts:39](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/strategies.ts#L39) +Defined in: [activities/chat/stream/strategies.ts:39](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/strategies.ts#L39) Called for each text chunk received diff --git a/docs/reference/classes/CompositeStrategy.md b/docs/reference/classes/CompositeStrategy.md index 5c6f71e3..2b4e0347 100644 --- a/docs/reference/classes/CompositeStrategy.md +++ b/docs/reference/classes/CompositeStrategy.md @@ -5,7 +5,7 @@ title: CompositeStrategy # Class: CompositeStrategy -Defined in: [stream/strategies.ts:68](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/strategies.ts#L68) +Defined in: [activities/chat/stream/strategies.ts:68](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/strategies.ts#L68) Composite Strategy - combine multiple strategies (OR logic) Emits if ANY strategy says to emit @@ -22,7 +22,7 @@ Emits if ANY strategy says to emit new CompositeStrategy(strategies): CompositeStrategy; ``` -Defined in: [stream/strategies.ts:69](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/strategies.ts#L69) +Defined in: [activities/chat/stream/strategies.ts:69](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/strategies.ts#L69) #### Parameters @@ -42,7 +42,7 @@ Defined in: [stream/strategies.ts:69](https://github.com/TanStack/ai/blob/main/p reset(): void; ``` -Defined in: [stream/strategies.ts:75](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/strategies.ts#L75) +Defined in: [activities/chat/stream/strategies.ts:75](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/strategies.ts#L75) Optional: Reset strategy state (called when streaming starts) @@ -62,7 +62,7 @@ Optional: Reset strategy state (called when streaming starts) shouldEmit(chunk, accumulated): boolean; ``` -Defined in: [stream/strategies.ts:71](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/strategies.ts#L71) +Defined in: [activities/chat/stream/strategies.ts:71](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/strategies.ts#L71) Called for each text chunk received diff --git a/docs/reference/classes/ImmediateStrategy.md b/docs/reference/classes/ImmediateStrategy.md index fcf89ea0..7d3504e0 100644 --- a/docs/reference/classes/ImmediateStrategy.md +++ b/docs/reference/classes/ImmediateStrategy.md @@ -5,7 +5,7 @@ title: ImmediateStrategy # Class: ImmediateStrategy -Defined in: [stream/strategies.ts:12](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/strategies.ts#L12) +Defined in: [activities/chat/stream/strategies.ts:12](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/strategies.ts#L12) Immediate Strategy - emit on every chunk (default behavior) @@ -33,7 +33,7 @@ new ImmediateStrategy(): ImmediateStrategy; shouldEmit(_chunk, _accumulated): boolean; ``` -Defined in: [stream/strategies.ts:13](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/strategies.ts#L13) +Defined in: [activities/chat/stream/strategies.ts:13](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/strategies.ts#L13) Called for each text chunk received diff --git a/docs/reference/classes/PartialJSONParser.md b/docs/reference/classes/PartialJSONParser.md index 59fdcfb0..d60510d4 100644 --- a/docs/reference/classes/PartialJSONParser.md +++ b/docs/reference/classes/PartialJSONParser.md @@ -5,7 +5,7 @@ title: PartialJSONParser # Class: PartialJSONParser -Defined in: [stream/json-parser.ts:25](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/json-parser.ts#L25) +Defined in: [activities/chat/stream/json-parser.ts:25](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/json-parser.ts#L25) Partial JSON Parser implementation using the partial-json library This parser can handle incomplete JSON strings during streaming @@ -34,7 +34,7 @@ new PartialJSONParser(): PartialJSONParser; parse(jsonString): any; ``` -Defined in: [stream/json-parser.ts:31](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/json-parser.ts#L31) +Defined in: [activities/chat/stream/json-parser.ts:31](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/json-parser.ts#L31) Parse a potentially incomplete JSON string diff --git a/docs/reference/classes/PunctuationStrategy.md b/docs/reference/classes/PunctuationStrategy.md index f5e1ebe4..cdc403db 100644 --- a/docs/reference/classes/PunctuationStrategy.md +++ b/docs/reference/classes/PunctuationStrategy.md @@ -5,7 +5,7 @@ title: PunctuationStrategy # Class: PunctuationStrategy -Defined in: [stream/strategies.ts:22](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/strategies.ts#L22) +Defined in: [activities/chat/stream/strategies.ts:22](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/strategies.ts#L22) Punctuation Strategy - emit when chunk contains punctuation Useful for natural text flow in UI @@ -34,7 +34,7 @@ new PunctuationStrategy(): PunctuationStrategy; shouldEmit(chunk, _accumulated): boolean; ``` -Defined in: [stream/strategies.ts:25](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/strategies.ts#L25) +Defined in: [activities/chat/stream/strategies.ts:25](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/strategies.ts#L25) Called for each text chunk received diff --git a/docs/reference/classes/StreamProcessor.md b/docs/reference/classes/StreamProcessor.md index 8acdf904..8c13ab36 100644 --- a/docs/reference/classes/StreamProcessor.md +++ b/docs/reference/classes/StreamProcessor.md @@ -5,7 +5,7 @@ title: StreamProcessor # Class: StreamProcessor -Defined in: [stream/processor.ts:171](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L171) +Defined in: [activities/chat/stream/processor.ts:168](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L168) StreamProcessor - State machine for processing AI response streams @@ -31,7 +31,7 @@ Tool call completion is detected when: new StreamProcessor(options): StreamProcessor; ``` -Defined in: [stream/processor.ts:200](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L200) +Defined in: [activities/chat/stream/processor.ts:197](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L197) #### Parameters @@ -51,7 +51,7 @@ Defined in: [stream/processor.ts:200](https://github.com/TanStack/ai/blob/main/p addToolApprovalResponse(approvalId, approved): void; ``` -Defined in: [stream/processor.ts:314](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L314) +Defined in: [activities/chat/stream/processor.ts:311](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L311) Add an approval response (called by client after handling onApprovalRequest) @@ -80,7 +80,7 @@ addToolResult( error?): void; ``` -Defined in: [stream/processor.ts:270](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L270) +Defined in: [activities/chat/stream/processor.ts:267](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L267) Add a tool result (called by client after handling onToolCall) @@ -110,7 +110,7 @@ Add a tool result (called by client after handling onToolCall) addUserMessage(content): UIMessage; ``` -Defined in: [stream/processor.ts:228](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L228) +Defined in: [activities/chat/stream/processor.ts:225](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L225) Add a user message to the conversation @@ -132,7 +132,7 @@ Add a user message to the conversation areAllToolsComplete(): boolean; ``` -Defined in: [stream/processor.ts:345](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L345) +Defined in: [activities/chat/stream/processor.ts:342](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L342) Check if all tool calls in the last assistant message are complete Useful for auto-continue logic @@ -149,7 +149,7 @@ Useful for auto-continue logic clearMessages(): void; ``` -Defined in: [stream/processor.ts:377](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L377) +Defined in: [activities/chat/stream/processor.ts:374](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L374) Clear all messages @@ -165,7 +165,7 @@ Clear all messages finalizeStream(): void; ``` -Defined in: [stream/processor.ts:951](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L951) +Defined in: [activities/chat/stream/processor.ts:948](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L948) Finalize the stream - complete all pending operations @@ -181,7 +181,7 @@ Finalize the stream - complete all pending operations getMessages(): UIMessage[]; ``` -Defined in: [stream/processor.ts:337](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L337) +Defined in: [activities/chat/stream/processor.ts:334](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L334) Get current messages @@ -197,7 +197,7 @@ Get current messages getRecording(): ChunkRecording | null; ``` -Defined in: [stream/processor.ts:1037](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L1037) +Defined in: [activities/chat/stream/processor.ts:1034](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L1034) Get the current recording @@ -213,7 +213,7 @@ Get the current recording getState(): ProcessorState; ``` -Defined in: [stream/processor.ts:1010](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L1010) +Defined in: [activities/chat/stream/processor.ts:1007](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L1007) Get current processor state (legacy) @@ -229,7 +229,7 @@ Get current processor state (legacy) process(stream): Promise; ``` -Defined in: [stream/processor.ts:390](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L390) +Defined in: [activities/chat/stream/processor.ts:387](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L387) Process a stream and emit events through handlers @@ -251,7 +251,7 @@ Process a stream and emit events through handlers processChunk(chunk): void; ``` -Defined in: [stream/processor.ts:418](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L418) +Defined in: [activities/chat/stream/processor.ts:415](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L415) Process a single chunk from the stream @@ -273,7 +273,7 @@ Process a single chunk from the stream removeMessagesAfter(index): void; ``` -Defined in: [stream/processor.ts:369](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L369) +Defined in: [activities/chat/stream/processor.ts:366](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L366) Remove messages after a certain index (for reload/retry) @@ -295,7 +295,7 @@ Remove messages after a certain index (for reload/retry) reset(): void; ``` -Defined in: [stream/processor.ts:1060](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L1060) +Defined in: [activities/chat/stream/processor.ts:1057](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L1057) Full reset (including messages) @@ -311,7 +311,7 @@ Full reset (including messages) setMessages(messages): void; ``` -Defined in: [stream/processor.ts:220](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L220) +Defined in: [activities/chat/stream/processor.ts:217](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L217) Set the messages array (e.g., from persisted state) @@ -333,7 +333,7 @@ Set the messages array (e.g., from persisted state) startAssistantMessage(): string; ``` -Defined in: [stream/processor.ts:246](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L246) +Defined in: [activities/chat/stream/processor.ts:243](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L243) Start streaming a new assistant message Returns the message ID @@ -350,7 +350,7 @@ Returns the message ID startRecording(): void; ``` -Defined in: [stream/processor.ts:1024](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L1024) +Defined in: [activities/chat/stream/processor.ts:1021](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L1021) Start recording chunks @@ -369,7 +369,7 @@ toModelMessages(): ModelMessage< | null>[]; ``` -Defined in: [stream/processor.ts:326](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L326) +Defined in: [activities/chat/stream/processor.ts:323](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L323) Get the conversation as ModelMessages (for sending to LLM) @@ -388,7 +388,7 @@ Get the conversation as ModelMessages (for sending to LLM) static replay(recording, options?): Promise; ``` -Defined in: [stream/processor.ts:1069](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L1069) +Defined in: [activities/chat/stream/processor.ts:1066](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L1066) Replay a recording through the processor diff --git a/docs/reference/classes/ToolCallManager.md b/docs/reference/classes/ToolCallManager.md index 7b0c7894..dc52cb47 100644 --- a/docs/reference/classes/ToolCallManager.md +++ b/docs/reference/classes/ToolCallManager.md @@ -5,7 +5,7 @@ title: ToolCallManager # Class: ToolCallManager -Defined in: [tools/tool-calls.ts:51](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/tools/tool-calls.ts#L51) +Defined in: [activities/chat/tools/tool-calls.ts:51](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/tools/tool-calls.ts#L51) Manages tool call accumulation and execution for the chat() method's automatic tool execution loop. @@ -47,7 +47,7 @@ if (manager.hasToolCalls()) { new ToolCallManager(tools): ToolCallManager; ``` -Defined in: [tools/tool-calls.ts:55](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/tools/tool-calls.ts#L55) +Defined in: [activities/chat/tools/tool-calls.ts:55](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/tools/tool-calls.ts#L55) #### Parameters @@ -67,7 +67,7 @@ readonly [`Tool`](../interfaces/Tool.md)\<`ZodType`\<`unknown`, `unknown`, `$Zod addToolCallChunk(chunk): void; ``` -Defined in: [tools/tool-calls.ts:63](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/tools/tool-calls.ts#L63) +Defined in: [activities/chat/tools/tool-calls.ts:63](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/tools/tool-calls.ts#L63) Add a tool call chunk to the accumulator Handles streaming tool calls by accumulating arguments @@ -126,7 +126,7 @@ Handles streaming tool calls by accumulating arguments clear(): void; ``` -Defined in: [tools/tool-calls.ts:208](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/tools/tool-calls.ts#L208) +Defined in: [activities/chat/tools/tool-calls.ts:208](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/tools/tool-calls.ts#L208) Clear the tool calls map for the next iteration @@ -145,7 +145,7 @@ executeTools(doneChunk): AsyncGenerator[], void>; ``` -Defined in: [tools/tool-calls.ts:121](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/tools/tool-calls.ts#L121) +Defined in: [activities/chat/tools/tool-calls.ts:121](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/tools/tool-calls.ts#L121) Execute all tool calls and return tool result messages Also yields tool_result chunks for streaming @@ -171,7 +171,7 @@ Also yields tool_result chunks for streaming getToolCalls(): ToolCall[]; ``` -Defined in: [tools/tool-calls.ts:111](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/tools/tool-calls.ts#L111) +Defined in: [activities/chat/tools/tool-calls.ts:111](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/tools/tool-calls.ts#L111) Get all complete tool calls (filtered for valid ID and name) @@ -187,7 +187,7 @@ Get all complete tool calls (filtered for valid ID and name) hasToolCalls(): boolean; ``` -Defined in: [tools/tool-calls.ts:104](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/tools/tool-calls.ts#L104) +Defined in: [activities/chat/tools/tool-calls.ts:104](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/tools/tool-calls.ts#L104) Check if there are any complete tool calls to execute diff --git a/docs/reference/classes/WordBoundaryStrategy.md b/docs/reference/classes/WordBoundaryStrategy.md index 985ce4f6..3f54ff3d 100644 --- a/docs/reference/classes/WordBoundaryStrategy.md +++ b/docs/reference/classes/WordBoundaryStrategy.md @@ -5,7 +5,7 @@ title: WordBoundaryStrategy # Class: WordBoundaryStrategy -Defined in: [stream/strategies.ts:57](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/strategies.ts#L57) +Defined in: [activities/chat/stream/strategies.ts:57](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/strategies.ts#L57) Word Boundary Strategy - emit at word boundaries Prevents cutting words in half @@ -34,7 +34,7 @@ new WordBoundaryStrategy(): WordBoundaryStrategy; shouldEmit(chunk, _accumulated): boolean; ``` -Defined in: [stream/strategies.ts:58](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/strategies.ts#L58) +Defined in: [activities/chat/stream/strategies.ts:58](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/strategies.ts#L58) Called for each text chunk received diff --git a/docs/reference/functions/chat.md b/docs/reference/functions/chat.md new file mode 100644 index 00000000..e41d36a7 --- /dev/null +++ b/docs/reference/functions/chat.md @@ -0,0 +1,96 @@ +--- +id: chat +title: chat +--- + +# Function: chat() + +```ts +function chat(options): TextActivityResult; +``` + +Defined in: [activities/chat/index.ts:945](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/index.ts#L945) + +Text activity - handles agentic text generation, one-shot text generation, and agentic structured output. + +This activity supports four modes: +1. **Streaming agentic text**: Stream responses with automatic tool execution +2. **Streaming one-shot text**: Simple streaming request/response without tools +3. **Non-streaming text**: Returns collected text as a string (stream: false) +4. **Agentic structured output**: Run tools, then return structured data + +## Type Parameters + +### TAdapter + +`TAdapter` *extends* `AnyTextAdapter` + +### TSchema + +`TSchema` *extends* + \| `ZodType`\<`unknown`, `unknown`, `$ZodTypeInternals`\<`unknown`, `unknown`\>\> + \| `undefined` = `undefined` + +### TStream + +`TStream` *extends* `boolean` = `true` + +## Parameters + +### options + +`TextActivityOptions`\<`TAdapter`, `TSchema`, `TStream`\> + +## Returns + +`TextActivityResult`\<`TSchema`, `TStream`\> + +## Examples + +```ts +import { chat } from '@tanstack/ai' +import { openaiText } from '@tanstack/ai-openai' + +for await (const chunk of chat({ + adapter: openaiText('gpt-4o'), + messages: [{ role: 'user', content: 'What is the weather?' }], + tools: [weatherTool] +})) { + if (chunk.type === 'content') { + console.log(chunk.delta) + } +} +``` + +```ts +for await (const chunk of chat({ + adapter: openaiText('gpt-4o'), + messages: [{ role: 'user', content: 'Hello!' }] +})) { + console.log(chunk) +} +``` + +```ts +const text = await chat({ + adapter: openaiText('gpt-4o'), + messages: [{ role: 'user', content: 'Hello!' }], + stream: false +}) +// text is a string with the full response +``` + +```ts +import { z } from 'zod' + +const result = await chat({ + adapter: openaiText('gpt-4o'), + messages: [{ role: 'user', content: 'Research and summarize the topic' }], + tools: [researchTool, analyzeTool], + outputSchema: z.object({ + summary: z.string(), + keyPoints: z.array(z.string()) + }) +}) +// result is { summary: string, keyPoints: string[] } +``` diff --git a/docs/reference/functions/combineStrategies.md b/docs/reference/functions/combineStrategies.md index 71c10bba..618f93a9 100644 --- a/docs/reference/functions/combineStrategies.md +++ b/docs/reference/functions/combineStrategies.md @@ -9,7 +9,7 @@ title: combineStrategies function combineStrategies(strategies): AgentLoopStrategy; ``` -Defined in: [utilities/agent-loop-strategies.ts:79](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/utilities/agent-loop-strategies.ts#L79) +Defined in: [activities/chat/agent-loop-strategies.ts:79](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/agent-loop-strategies.ts#L79) Creates a strategy that combines multiple strategies with AND logic All strategies must return true to continue @@ -32,7 +32,8 @@ AgentLoopStrategy that continues only if all strategies return true ```typescript const stream = chat({ - adapter: openaiText("gpt-4o"), + adapter: openaiText(), + model: "gpt-4o", messages: [...], tools: [weatherTool], agentLoopStrategy: combineStrategies([ diff --git a/docs/reference/functions/convertMessagesToModelMessages.md b/docs/reference/functions/convertMessagesToModelMessages.md index 00224ace..7ba8d96d 100644 --- a/docs/reference/functions/convertMessagesToModelMessages.md +++ b/docs/reference/functions/convertMessagesToModelMessages.md @@ -12,7 +12,7 @@ function convertMessagesToModelMessages(messages): ModelMessage< | null>[]; ``` -Defined in: [message-converters.ts:38](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/message-converters.ts#L38) +Defined in: [activities/chat/messages.ts:35](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/messages.ts#L35) Convert UIMessages or ModelMessages to ModelMessages diff --git a/docs/reference/functions/convertZodToJsonSchema.md b/docs/reference/functions/convertZodToJsonSchema.md index 97097eb9..23b46ffb 100644 --- a/docs/reference/functions/convertZodToJsonSchema.md +++ b/docs/reference/functions/convertZodToJsonSchema.md @@ -6,10 +6,10 @@ title: convertZodToJsonSchema # Function: convertZodToJsonSchema() ```ts -function convertZodToJsonSchema(schema): Record | undefined; +function convertZodToJsonSchema(schema, options): Record | undefined; ``` -Defined in: [tools/zod-converter.ts:57](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/tools/zod-converter.ts#L57) +Defined in: [activities/chat/tools/zod-converter.ts:161](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/tools/zod-converter.ts#L161) Converts a schema (Zod or JSONSchema) to JSON Schema format compatible with LLM providers. If the input is already a JSONSchema object, it is returned as-is. @@ -23,6 +23,12 @@ Zod schema or JSONSchema object to convert [`SchemaInput`](../type-aliases/SchemaInput.md) | `undefined` +### options + +`ConvertSchemaOptions` = `{}` + +Conversion options + ## Returns `Record`\<`string`, `any`\> \| `undefined` @@ -51,6 +57,19 @@ const jsonSchema = convertZodToJsonSchema(zodSchema); // required: ['location'] // } +// For OpenAI structured output (all fields required, optional fields nullable) +const structuredSchema = convertZodToJsonSchema(zodSchema, { forStructuredOutput: true }); +// Returns: +// { +// type: 'object', +// properties: { +// location: { type: 'string', description: 'City name' }, +// unit: { type: ['string', 'null'], enum: ['celsius', 'fahrenheit'] } +// }, +// required: ['location', 'unit'], +// additionalProperties: false +// } + // Using JSONSchema directly (passes through unchanged) const rawSchema = { type: 'object', diff --git a/docs/reference/functions/createChatOptions.md b/docs/reference/functions/createChatOptions.md new file mode 100644 index 00000000..0d2abf6d --- /dev/null +++ b/docs/reference/functions/createChatOptions.md @@ -0,0 +1,51 @@ +--- +id: createChatOptions +title: createChatOptions +--- + +# Function: createChatOptions() + +```ts +function createChatOptions(options): TextActivityOptions; +``` + +Defined in: [activities/chat/index.ts:135](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/index.ts#L135) + +Create typed options for the chat() function without executing. +This is useful for pre-defining configurations with full type inference. + +## Type Parameters + +### TAdapter + +`TAdapter` *extends* `AnyTextAdapter` + +### TSchema + +`TSchema` *extends* + \| `ZodType`\<`unknown`, `unknown`, `$ZodTypeInternals`\<`unknown`, `unknown`\>\> + \| `undefined` = `undefined` + +### TStream + +`TStream` *extends* `boolean` = `true` + +## Parameters + +### options + +`TextActivityOptions`\<`TAdapter`, `TSchema`, `TStream`\> + +## Returns + +`TextActivityOptions`\<`TAdapter`, `TSchema`, `TStream`\> + +## Example + +```ts +const chatOptions = createChatOptions({ + adapter: anthropicText('claude-sonnet-4-5'), +}) + +const stream = chat({ ...chatOptions, messages }) +``` diff --git a/docs/reference/functions/createImageOptions.md b/docs/reference/functions/createImageOptions.md new file mode 100644 index 00000000..c535fddc --- /dev/null +++ b/docs/reference/functions/createImageOptions.md @@ -0,0 +1,30 @@ +--- +id: createImageOptions +title: createImageOptions +--- + +# Function: createImageOptions() + +```ts +function createImageOptions(options): ImageActivityOptions; +``` + +Defined in: [activities/generateImage/index.ts:150](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/generateImage/index.ts#L150) + +Create typed options for the generateImage() function without executing. + +## Type Parameters + +### TAdapter + +`TAdapter` *extends* `ImageAdapter`\<`string`, `object`, `any`, `any`\> + +## Parameters + +### options + +`ImageActivityOptions`\<`TAdapter`\> + +## Returns + +`ImageActivityOptions`\<`TAdapter`\> diff --git a/docs/reference/functions/createReplayStream.md b/docs/reference/functions/createReplayStream.md index 39ec2a49..72a9a3d8 100644 --- a/docs/reference/functions/createReplayStream.md +++ b/docs/reference/functions/createReplayStream.md @@ -9,7 +9,7 @@ title: createReplayStream function createReplayStream(recording): AsyncIterable; ``` -Defined in: [stream/processor.ts:1081](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L1081) +Defined in: [activities/chat/stream/processor.ts:1078](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L1078) Create an async iterable from a recording diff --git a/docs/reference/functions/createSpeechOptions.md b/docs/reference/functions/createSpeechOptions.md new file mode 100644 index 00000000..e73aa765 --- /dev/null +++ b/docs/reference/functions/createSpeechOptions.md @@ -0,0 +1,30 @@ +--- +id: createSpeechOptions +title: createSpeechOptions +--- + +# Function: createSpeechOptions() + +```ts +function createSpeechOptions(options): TTSActivityOptions; +``` + +Defined in: [activities/generateSpeech/index.ts:114](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/generateSpeech/index.ts#L114) + +Create typed options for the generateSpeech() function without executing. + +## Type Parameters + +### TAdapter + +`TAdapter` *extends* `TTSAdapter`\<`string`, `object`\> + +## Parameters + +### options + +`TTSActivityOptions`\<`TAdapter`\> + +## Returns + +`TTSActivityOptions`\<`TAdapter`\> diff --git a/docs/reference/functions/createSummarizeOptions.md b/docs/reference/functions/createSummarizeOptions.md new file mode 100644 index 00000000..18870794 --- /dev/null +++ b/docs/reference/functions/createSummarizeOptions.md @@ -0,0 +1,34 @@ +--- +id: createSummarizeOptions +title: createSummarizeOptions +--- + +# Function: createSummarizeOptions() + +```ts +function createSummarizeOptions(options): SummarizeActivityOptions; +``` + +Defined in: [activities/summarize/index.ts:272](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/summarize/index.ts#L272) + +Create typed options for the summarize() function without executing. + +## Type Parameters + +### TAdapter + +`TAdapter` *extends* `SummarizeAdapter`\<`string`, `object`\> + +### TStream + +`TStream` *extends* `boolean` = `false` + +## Parameters + +### options + +`SummarizeActivityOptions`\<`TAdapter`, `TStream`\> + +## Returns + +`SummarizeActivityOptions`\<`TAdapter`, `TStream`\> diff --git a/docs/reference/functions/createTranscriptionOptions.md b/docs/reference/functions/createTranscriptionOptions.md new file mode 100644 index 00000000..3f2b112e --- /dev/null +++ b/docs/reference/functions/createTranscriptionOptions.md @@ -0,0 +1,30 @@ +--- +id: createTranscriptionOptions +title: createTranscriptionOptions +--- + +# Function: createTranscriptionOptions() + +```ts +function createTranscriptionOptions(options): TranscriptionActivityOptions; +``` + +Defined in: [activities/generateTranscription/index.ts:118](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/generateTranscription/index.ts#L118) + +Create typed options for the generateTranscription() function without executing. + +## Type Parameters + +### TAdapter + +`TAdapter` *extends* `TranscriptionAdapter`\<`string`, `object`\> + +## Parameters + +### options + +`TranscriptionActivityOptions`\<`TAdapter`\> + +## Returns + +`TranscriptionActivityOptions`\<`TAdapter`\> diff --git a/docs/reference/functions/createVideoOptions.md b/docs/reference/functions/createVideoOptions.md new file mode 100644 index 00000000..d88c05e7 --- /dev/null +++ b/docs/reference/functions/createVideoOptions.md @@ -0,0 +1,30 @@ +--- +id: createVideoOptions +title: createVideoOptions +--- + +# Function: createVideoOptions() + +```ts +function createVideoOptions(options): VideoCreateOptions; +``` + +Defined in: [activities/generateVideo/index.ts:249](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/generateVideo/index.ts#L249) + +Create typed options for the generateVideo() function without executing. + +## Type Parameters + +### TAdapter + +`TAdapter` *extends* `VideoAdapter`\<`string`, `object`\> + +## Parameters + +### options + +`VideoCreateOptions`\<`TAdapter`\> + +## Returns + +`VideoCreateOptions`\<`TAdapter`\> diff --git a/docs/reference/functions/embedding.md b/docs/reference/functions/embedding.md deleted file mode 100644 index 058e3ff4..00000000 --- a/docs/reference/functions/embedding.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -id: embedding -title: embedding ---- - -# Function: embedding() - -```ts -function embedding(options): Promise; -``` - -Defined in: [core/embedding.ts:16](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/core/embedding.ts#L16) - -Standalone embedding function with type inference from adapter - -## Type Parameters - -### TAdapter - -`TAdapter` *extends* [`AIAdapter`](../interfaces/AIAdapter.md)\<`any`, `any`, `any`, `any`, `any`, `Record`\<`string`, readonly [`Modality`](../type-aliases/Modality.md)[]\>, [`DefaultMessageMetadataByModality`](../interfaces/DefaultMessageMetadataByModality.md)\> - -## Parameters - -### options - -`Omit`\<[`EmbeddingOptions`](../interfaces/EmbeddingOptions.md), `"model"`\> & `object` - -## Returns - -`Promise`\<[`EmbeddingResult`](../interfaces/EmbeddingResult.md)\> diff --git a/docs/reference/functions/generateImage.md b/docs/reference/functions/generateImage.md new file mode 100644 index 00000000..39209296 --- /dev/null +++ b/docs/reference/functions/generateImage.md @@ -0,0 +1,71 @@ +--- +id: generateImage +title: generateImage +--- + +# Function: generateImage() + +```ts +function generateImage(options): ImageActivityResult; +``` + +Defined in: [activities/generateImage/index.ts:134](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/generateImage/index.ts#L134) + +Image activity - generates images from text prompts. + +Uses AI image generation models to create images based on natural language descriptions. + +## Type Parameters + +### TAdapter + +`TAdapter` *extends* `ImageAdapter`\<`string`, `object`, `any`, `any`\> + +## Parameters + +### options + +`ImageActivityOptions`\<`TAdapter`\> + +## Returns + +`ImageActivityResult` + +## Examples + +```ts +import { generateImage } from '@tanstack/ai' +import { openaiImage } from '@tanstack/ai-openai' + +const result = await generateImage({ + adapter: openaiImage('dall-e-3'), + prompt: 'A serene mountain landscape at sunset' +}) + +console.log(result.images[0].url) +``` + +```ts +const result = await generateImage({ + adapter: openaiImage('dall-e-2'), + prompt: 'A cute robot mascot', + numberOfImages: 4, + size: '512x512' +}) + +result.images.forEach((image, i) => { + console.log(`Image ${i + 1}: ${image.url}`) +}) +``` + +```ts +const result = await generateImage({ + adapter: openaiImage('dall-e-3'), + prompt: 'A professional headshot photo', + size: '1024x1024', + modelOptions: { + quality: 'hd', + style: 'natural' + } +}) +``` diff --git a/docs/reference/functions/generateMessageId.md b/docs/reference/functions/generateMessageId.md index 44568ce3..1e545ba6 100644 --- a/docs/reference/functions/generateMessageId.md +++ b/docs/reference/functions/generateMessageId.md @@ -9,7 +9,7 @@ title: generateMessageId function generateMessageId(): string; ``` -Defined in: [message-converters.ts:283](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/message-converters.ts#L283) +Defined in: [activities/chat/messages.ts:280](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/messages.ts#L280) Generate a unique message ID diff --git a/docs/reference/functions/generateSpeech.md b/docs/reference/functions/generateSpeech.md new file mode 100644 index 00000000..c48cbb19 --- /dev/null +++ b/docs/reference/functions/generateSpeech.md @@ -0,0 +1,57 @@ +--- +id: generateSpeech +title: generateSpeech +--- + +# Function: generateSpeech() + +```ts +function generateSpeech(options): TTSActivityResult; +``` + +Defined in: [activities/generateSpeech/index.ts:98](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/generateSpeech/index.ts#L98) + +TTS activity - generates speech from text. + +Uses AI text-to-speech models to create audio from natural language text. + +## Type Parameters + +### TAdapter + +`TAdapter` *extends* `TTSAdapter`\<`string`, `object`\> + +## Parameters + +### options + +`TTSActivityOptions`\<`TAdapter`\> + +## Returns + +`TTSActivityResult` + +## Examples + +```ts +import { generateSpeech } from '@tanstack/ai' +import { openaiTTS } from '@tanstack/ai-openai' + +const result = await generateSpeech({ + adapter: openaiTTS('tts-1-hd'), + text: 'Hello, welcome to TanStack AI!', + voice: 'nova' +}) + +console.log(result.audio) // base64-encoded audio +``` + +```ts +const result = await generateSpeech({ + adapter: openaiTTS('tts-1'), + text: 'This is slower speech.', + voice: 'alloy', + format: 'wav', + speed: 0.8 +}) +``` diff --git a/docs/reference/functions/generateTranscription.md b/docs/reference/functions/generateTranscription.md new file mode 100644 index 00000000..38703bc8 --- /dev/null +++ b/docs/reference/functions/generateTranscription.md @@ -0,0 +1,59 @@ +--- +id: generateTranscription +title: generateTranscription +--- + +# Function: generateTranscription() + +```ts +function generateTranscription(options): TranscriptionActivityResult; +``` + +Defined in: [activities/generateTranscription/index.ts:100](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/generateTranscription/index.ts#L100) + +Transcription activity - converts audio to text. + +Uses AI speech-to-text models to transcribe audio content. + +## Type Parameters + +### TAdapter + +`TAdapter` *extends* `TranscriptionAdapter`\<`string`, `object`\> + +## Parameters + +### options + +`TranscriptionActivityOptions`\<`TAdapter`\> + +## Returns + +`TranscriptionActivityResult` + +## Examples + +```ts +import { generateTranscription } from '@tanstack/ai' +import { openaiTranscription } from '@tanstack/ai-openai' + +const result = await generateTranscription({ + adapter: openaiTranscription('whisper-1'), + audio: audioFile, // File, Blob, or base64 string + language: 'en' +}) + +console.log(result.text) +``` + +```ts +const result = await generateTranscription({ + adapter: openaiTranscription('whisper-1'), + audio: audioFile, + responseFormat: 'verbose_json' +}) + +result.segments?.forEach(segment => { + console.log(`[${segment.start}s - ${segment.end}s]: ${segment.text}`) +}) +``` diff --git a/docs/reference/functions/generateVideo.md b/docs/reference/functions/generateVideo.md new file mode 100644 index 00000000..4a5a56b0 --- /dev/null +++ b/docs/reference/functions/generateVideo.md @@ -0,0 +1,52 @@ +--- +id: generateVideo +title: generateVideo +--- + +# Function: generateVideo() + +```ts +function generateVideo(options): Promise; +``` + +Defined in: [activities/generateVideo/index.ts:158](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/generateVideo/index.ts#L158) + +**`Experimental`** + +Generate video - creates a video generation job from a text prompt. + +Uses AI video generation models to create videos based on natural language descriptions. +Unlike image generation, video generation is asynchronous and requires polling for completion. + + Video generation is an experimental feature and may change. + +## Type Parameters + +### TAdapter + +`TAdapter` *extends* `VideoAdapter`\<`string`, `object`\> + +## Parameters + +### options + +`VideoCreateOptions`\<`TAdapter`\> + +## Returns + +`Promise`\<[`VideoJobResult`](../interfaces/VideoJobResult.md)\> + +## Example + +```ts +import { generateVideo } from '@tanstack/ai' +import { openaiVideo } from '@tanstack/ai-openai' + +// Start a video generation job +const { jobId } = await generateVideo({ + adapter: openaiVideo('sora-2'), + prompt: 'A cat chasing a dog in a sunny park' +}) + +console.log('Job started:', jobId) +``` diff --git a/docs/reference/functions/getVideoJobStatus.md b/docs/reference/functions/getVideoJobStatus.md new file mode 100644 index 00000000..40a498b1 --- /dev/null +++ b/docs/reference/functions/getVideoJobStatus.md @@ -0,0 +1,71 @@ +--- +id: getVideoJobStatus +title: getVideoJobStatus +--- + +# Function: getVideoJobStatus() + +```ts +function getVideoJobStatus(options): Promise<{ + error?: string; + progress?: number; + status: "pending" | "processing" | "completed" | "failed"; + url?: string; +}>; +``` + +Defined in: [activities/generateVideo/index.ts:198](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/generateVideo/index.ts#L198) + +**`Experimental`** + +Get video job status - returns the current status, progress, and URL if available. + +This function combines status checking and URL retrieval. If the job is completed, +it will automatically fetch and include the video URL. + + Video generation is an experimental feature and may change. + +## Type Parameters + +### TAdapter + +`TAdapter` *extends* `VideoAdapter`\<`string`, `object`\> + +## Parameters + +### options + +#### adapter + +`TAdapter` & `object` + +#### jobId + +`string` + +## Returns + +`Promise`\<\{ + `error?`: `string`; + `progress?`: `number`; + `status`: `"pending"` \| `"processing"` \| `"completed"` \| `"failed"`; + `url?`: `string`; +\}\> + +## Example + +```ts +import { getVideoJobStatus } from '@tanstack/ai' +import { openaiVideo } from '@tanstack/ai-openai' + +const result = await getVideoJobStatus({ + adapter: openaiVideo('sora-2'), + jobId: 'job-123' +}) + +console.log('Status:', result.status) +console.log('Progress:', result.progress) +if (result.url) { + console.log('Video URL:', result.url) +} +``` diff --git a/docs/reference/functions/maxIterations.md b/docs/reference/functions/maxIterations.md index 89933c7d..bdcab002 100644 --- a/docs/reference/functions/maxIterations.md +++ b/docs/reference/functions/maxIterations.md @@ -9,7 +9,7 @@ title: maxIterations function maxIterations(max): AgentLoopStrategy; ``` -Defined in: [utilities/agent-loop-strategies.ts:20](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/utilities/agent-loop-strategies.ts#L20) +Defined in: [activities/chat/agent-loop-strategies.ts:20](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/agent-loop-strategies.ts#L20) Creates a strategy that continues for a maximum number of iterations @@ -31,7 +31,8 @@ AgentLoopStrategy that stops after max iterations ```typescript const stream = chat({ - adapter: openaiText("gpt-4o"), + adapter: openaiText(), + model: "gpt-4o", messages: [...], tools: [weatherTool], agentLoopStrategy: maxIterations(3), // Max 3 iterations diff --git a/docs/reference/functions/messages.md b/docs/reference/functions/messages.md deleted file mode 100644 index 1969580d..00000000 --- a/docs/reference/functions/messages.md +++ /dev/null @@ -1,94 +0,0 @@ ---- -id: messages -title: messages ---- - -# Function: messages() - -```ts -function messages(_options, msgs): TAdapter extends AIAdapter ? TModel extends keyof ModelInputModalities ? ModelInputModalities[TModel] extends readonly Modality[] ? ConstrainedModelMessage[] : ModelMessage< - | string - | ContentPart[] - | null>[] : ModelMessage< - | string - | ContentPart[] - | null>[] : ModelMessage< - | string - | ContentPart[] - | null>[]; -``` - -Defined in: [utilities/messages.ts:33](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/utilities/messages.ts#L33) - -Type-safe helper to create a messages array constrained by a model's supported modalities. - -This function provides compile-time checking that your messages only contain -content types supported by the specified model. It's particularly useful when -combining typed messages with untyped data (like from request.json()). - -## Type Parameters - -### TAdapter - -`TAdapter` *extends* [`AIAdapter`](../interfaces/AIAdapter.md)\<`any`, `any`, `any`, `any`, `any`, `any`, [`DefaultMessageMetadataByModality`](../interfaces/DefaultMessageMetadataByModality.md)\> - -### TModel - -`TModel` *extends* `any` - -## Parameters - -### \_options - -#### adapter - -`TAdapter` - -#### model - -`TModel` - -### msgs - -`TAdapter` *extends* [`AIAdapter`](../interfaces/AIAdapter.md)\<`any`, `any`, `any`, `any`, `any`, `ModelInputModalities`, [`DefaultMessageMetadataByModality`](../interfaces/DefaultMessageMetadataByModality.md)\> ? `TModel` *extends* keyof `ModelInputModalities` ? `ModelInputModalities`\[`TModel`\<`TModel`\>\] *extends* readonly [`Modality`](../type-aliases/Modality.md)[] ? [`ConstrainedModelMessage`](../type-aliases/ConstrainedModelMessage.md)\<`any`\[`any`\]\>[] : [`ModelMessage`](../interfaces/ModelMessage.md)\< - \| `string` - \| [`ContentPart`](../type-aliases/ContentPart.md)\<`unknown`, `unknown`, `unknown`, `unknown`, `unknown`\>[] - \| `null`\>[] : [`ModelMessage`](../interfaces/ModelMessage.md)\< - \| `string` - \| [`ContentPart`](../type-aliases/ContentPart.md)\<`unknown`, `unknown`, `unknown`, `unknown`, `unknown`\>[] - \| `null`\>[] : [`ModelMessage`](../interfaces/ModelMessage.md)\< - \| `string` - \| [`ContentPart`](../type-aliases/ContentPart.md)\<`unknown`, `unknown`, `unknown`, `unknown`, `unknown`\>[] - \| `null`\>[] - -## Returns - -`TAdapter` *extends* [`AIAdapter`](../interfaces/AIAdapter.md)\<`any`, `any`, `any`, `any`, `any`, `ModelInputModalities`, [`DefaultMessageMetadataByModality`](../interfaces/DefaultMessageMetadataByModality.md)\> ? `TModel` *extends* keyof `ModelInputModalities` ? `ModelInputModalities`\[`TModel`\<`TModel`\>\] *extends* readonly [`Modality`](../type-aliases/Modality.md)[] ? [`ConstrainedModelMessage`](../type-aliases/ConstrainedModelMessage.md)\<`any`\[`any`\]\>[] : [`ModelMessage`](../interfaces/ModelMessage.md)\< - \| `string` - \| [`ContentPart`](../type-aliases/ContentPart.md)\<`unknown`, `unknown`, `unknown`, `unknown`, `unknown`\>[] - \| `null`\>[] : [`ModelMessage`](../interfaces/ModelMessage.md)\< - \| `string` - \| [`ContentPart`](../type-aliases/ContentPart.md)\<`unknown`, `unknown`, `unknown`, `unknown`, `unknown`\>[] - \| `null`\>[] : [`ModelMessage`](../interfaces/ModelMessage.md)\< - \| `string` - \| [`ContentPart`](../type-aliases/ContentPart.md)\<`unknown`, `unknown`, `unknown`, `unknown`, `unknown`\>[] - \| `null`\>[] - -## Example - -```typescript -import { messages, chat } from '@tanstack/ai' -import { openaiText } from '@tanstack/ai-openai' - -const adapter = openaiText('gpt-4o') - -// This will error at compile time because gpt-4o only supports text+image -const msgs = messages({ adapter }, [ - { - role: 'user', - content: [ - { type: 'video', source: { type: 'url', value: '...' } } // Error! - ] - } -]) -``` diff --git a/docs/reference/functions/modelMessageToUIMessage.md b/docs/reference/functions/modelMessageToUIMessage.md index 02e80f8d..f6bbeb2a 100644 --- a/docs/reference/functions/modelMessageToUIMessage.md +++ b/docs/reference/functions/modelMessageToUIMessage.md @@ -9,7 +9,7 @@ title: modelMessageToUIMessage function modelMessageToUIMessage(modelMessage, id?): UIMessage; ``` -Defined in: [message-converters.ts:158](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/message-converters.ts#L158) +Defined in: [activities/chat/messages.ts:155](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/messages.ts#L155) Convert a ModelMessage to UIMessage diff --git a/docs/reference/functions/modelMessagesToUIMessages.md b/docs/reference/functions/modelMessagesToUIMessages.md index dd50df71..02b20aed 100644 --- a/docs/reference/functions/modelMessagesToUIMessages.md +++ b/docs/reference/functions/modelMessagesToUIMessages.md @@ -9,7 +9,7 @@ title: modelMessagesToUIMessages function modelMessagesToUIMessages(modelMessages): UIMessage[]; ``` -Defined in: [message-converters.ts:211](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/message-converters.ts#L211) +Defined in: [activities/chat/messages.ts:208](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/messages.ts#L208) Convert an array of ModelMessages to UIMessages diff --git a/docs/reference/functions/normalizeToUIMessage.md b/docs/reference/functions/normalizeToUIMessage.md index a42310e3..f85ca4f0 100644 --- a/docs/reference/functions/normalizeToUIMessage.md +++ b/docs/reference/functions/normalizeToUIMessage.md @@ -9,7 +9,7 @@ title: normalizeToUIMessage function normalizeToUIMessage(message, generateId): UIMessage; ``` -Defined in: [message-converters.ts:260](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/message-converters.ts#L260) +Defined in: [activities/chat/messages.ts:257](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/messages.ts#L257) Normalize a message (UIMessage or ModelMessage) to a UIMessage Ensures the message has an ID and createdAt timestamp diff --git a/docs/reference/functions/parsePartialJSON.md b/docs/reference/functions/parsePartialJSON.md index c3fb3806..0afc5075 100644 --- a/docs/reference/functions/parsePartialJSON.md +++ b/docs/reference/functions/parsePartialJSON.md @@ -9,7 +9,7 @@ title: parsePartialJSON function parsePartialJSON(jsonString): any; ``` -Defined in: [stream/json-parser.ts:56](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/json-parser.ts#L56) +Defined in: [activities/chat/stream/json-parser.ts:56](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/json-parser.ts#L56) Parse partial JSON string (convenience function) diff --git a/docs/reference/functions/streamToText.md b/docs/reference/functions/streamToText.md new file mode 100644 index 00000000..9d281666 --- /dev/null +++ b/docs/reference/functions/streamToText.md @@ -0,0 +1,43 @@ +--- +id: streamToText +title: streamToText +--- + +# Function: streamToText() + +```ts +function streamToText(stream): Promise; +``` + +Defined in: [stream-to-response.ts:23](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream-to-response.ts#L23) + +Collect all text content from a StreamChunk async iterable and return as a string. + +This function consumes the entire stream, accumulating content from 'content' type chunks, +and returns the final concatenated text. + +## Parameters + +### stream + +`AsyncIterable`\<[`StreamChunk`](../type-aliases/StreamChunk.md)\> + +AsyncIterable of StreamChunks from chat() + +## Returns + +`Promise`\<`string`\> + +Promise - The accumulated text content + +## Example + +```typescript +const stream = chat({ + adapter: openaiText(), + model: 'gpt-4o', + messages: [{ role: 'user', content: 'Hello!' }] +}); +const text = await streamToText(stream); +console.log(text); // "Hello! How can I help you today?" +``` diff --git a/docs/reference/functions/summarize.md b/docs/reference/functions/summarize.md index 2ae9aead..3efaab3b 100644 --- a/docs/reference/functions/summarize.md +++ b/docs/reference/functions/summarize.md @@ -6,25 +6,74 @@ title: summarize # Function: summarize() ```ts -function summarize(options): Promise; +function summarize(options): SummarizeActivityResult; ``` -Defined in: [core/summarize.ts:16](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/core/summarize.ts#L16) +Defined in: [activities/summarize/index.ts:146](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/summarize/index.ts#L146) -Standalone summarize function with type inference from adapter +Summarize activity - generates summaries from text. + +Supports both streaming and non-streaming modes. ## Type Parameters ### TAdapter -`TAdapter` *extends* [`AIAdapter`](../interfaces/AIAdapter.md)\<`any`, `any`, `any`, `any`, `any`, `Record`\<`string`, readonly [`Modality`](../type-aliases/Modality.md)[]\>, [`DefaultMessageMetadataByModality`](../interfaces/DefaultMessageMetadataByModality.md)\> +`TAdapter` *extends* `SummarizeAdapter`\<`string`, `object`\> + +### TStream + +`TStream` *extends* `boolean` = `false` ## Parameters ### options -`Omit`\<[`SummarizationOptions`](../interfaces/SummarizationOptions.md), `"model"`\> & `object` +`SummarizeActivityOptions`\<`TAdapter`, `TStream`\> ## Returns -`Promise`\<[`SummarizationResult`](../interfaces/SummarizationResult.md)\> +`SummarizeActivityResult`\<`TStream`\> + +## Examples + +```ts +import { summarize } from '@tanstack/ai' +import { openaiSummarize } from '@tanstack/ai-openai' + +const result = await summarize({ + adapter: openaiSummarize('gpt-4o-mini'), + text: 'Long article text here...' +}) + +console.log(result.summary) +``` + +```ts +const result = await summarize({ + adapter: openaiSummarize('gpt-4o-mini'), + text: 'Long article text here...', + style: 'bullet-points', + maxLength: 100 +}) +``` + +```ts +const result = await summarize({ + adapter: openaiSummarize('gpt-4o-mini'), + text: 'Long technical document...', + focus: ['key findings', 'methodology'] +}) +``` + +```ts +for await (const chunk of summarize({ + adapter: openaiSummarize('gpt-4o-mini'), + text: 'Long article text here...', + stream: true +})) { + if (chunk.type === 'content') { + process.stdout.write(chunk.delta) + } +} +``` diff --git a/docs/reference/functions/text.md b/docs/reference/functions/text.md deleted file mode 100644 index 6735f79c..00000000 --- a/docs/reference/functions/text.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -id: chat -title: chat ---- - -# Function: chat() - -```ts -function chat(options): AsyncIterable; -``` - -Defined in: [core/chat.ts:741](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/core/chat.ts#L741) - -Standalone chat streaming function with type inference from adapter -Returns an async iterable of StreamChunks for streaming responses -Includes automatic tool execution loop - -## Type Parameters - -### TAdapter - -`TAdapter` *extends* [`AIAdapter`](../interfaces/AIAdapter.md)\<`any`, `any`, `any`, `any`, `any`, `any`, [`DefaultMessageMetadataByModality`](../interfaces/DefaultMessageMetadataByModality.md)\> - -### TModel - -`TModel` *extends* `any` - -## Parameters - -### options - -[`TextStreamOptionsForModel`](../type-aliases/TextStreamOptionsForModel.md)\<`TAdapter`, `TModel`\> - -Chat options - -## Returns - -`AsyncIterable`\<[`StreamChunk`](../type-aliases/StreamChunk.md)\> - -## Example - -```typescript -const stream = chat({ - adapter: openaiText('gpt-4o'), - messages: [{ role: 'user', content: 'Hello!' }], - tools: [weatherTool], // Optional: auto-executed when called -}); - -for await (const chunk of stream) { - if (chunk.type === 'content') { - console.log(chunk.delta); - } -} -``` diff --git a/docs/reference/functions/textOptions.md b/docs/reference/functions/textOptions.md deleted file mode 100644 index a9c7d386..00000000 --- a/docs/reference/functions/textOptions.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -id: textOptions -title: textOptions ---- - -# Function: textOptions() - -```ts -function textOptions(options): Omit, "model" | "providerOptions" | "messages" | "abortController"> & object; -``` - -Defined in: [utilities/chat-options.ts:3](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/utilities/chat-options.ts#L3) - -## Type Parameters - -### TAdapter - -`TAdapter` *extends* [`AIAdapter`](../interfaces/AIAdapter.md)\<`any`, `any`, `any`, `any`, `any`, `Record`\<`string`, readonly [`Modality`](../type-aliases/Modality.md)[]\>, [`DefaultMessageMetadataByModality`](../interfaces/DefaultMessageMetadataByModality.md)\> - -### TModel - -`TModel` *extends* `any` - -## Parameters - -### options - -`Omit`\<[`TextStreamOptionsUnion`](../type-aliases/TextStreamOptionsUnion.md)\<`TAdapter`\>, `"model"` \| `"providerOptions"` \| `"messages"` \| `"abortController"`\> & `object` - -## Returns - -`Omit`\<[`TextStreamOptionsUnion`](../type-aliases/TextStreamOptionsUnion.md)\<`TAdapter`\>, `"model"` \| `"providerOptions"` \| `"messages"` \| `"abortController"`\> & `object` diff --git a/docs/reference/functions/toServerSentEventsStream.md b/docs/reference/functions/toServerSentEventsStream.md index 2ae66801..633041c7 100644 --- a/docs/reference/functions/toServerSentEventsStream.md +++ b/docs/reference/functions/toServerSentEventsStream.md @@ -9,7 +9,7 @@ title: toServerSentEventsStream function toServerSentEventsStream(stream, abortController?): ReadableStream>; ``` -Defined in: [utilities/stream-to-response.ts:22](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/utilities/stream-to-response.ts#L22) +Defined in: [stream-to-response.ts:56](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream-to-response.ts#L56) Convert a StreamChunk async iterable to a ReadableStream in Server-Sent Events format @@ -41,7 +41,7 @@ ReadableStream in Server-Sent Events format ## Example ```typescript -const stream = chat({ adapter: openaiText("gpt-4o"), messages: [...] }); +const stream = chat({ adapter: openaiText(), model: "gpt-4o", messages: [...] }); const readableStream = toServerSentEventsStream(stream); // Use with Response, or any API that accepts ReadableStream ``` diff --git a/docs/reference/functions/toStreamResponse.md b/docs/reference/functions/toStreamResponse.md index 29843589..fcb6ce73 100644 --- a/docs/reference/functions/toStreamResponse.md +++ b/docs/reference/functions/toStreamResponse.md @@ -9,7 +9,7 @@ title: toStreamResponse function toStreamResponse(stream, init?): Response; ``` -Defined in: [utilities/stream-to-response.ts:102](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/utilities/stream-to-response.ts#L102) +Defined in: [stream-to-response.ts:136](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream-to-response.ts#L136) Create a streaming HTTP response from a StreamChunk async iterable Includes proper headers for Server-Sent Events @@ -41,7 +41,8 @@ export async function POST(request: Request) { const { messages } = await request.json(); const abortController = new AbortController(); const stream = chat({ - adapter: openaiText("gpt-4o"), + adapter: openaiText(), + model: "gpt-4o", messages, options: { abortSignal: abortController.signal } }); diff --git a/docs/reference/functions/toolDefinition.md b/docs/reference/functions/toolDefinition.md index 419cd4f4..53530f58 100644 --- a/docs/reference/functions/toolDefinition.md +++ b/docs/reference/functions/toolDefinition.md @@ -9,7 +9,7 @@ title: toolDefinition function toolDefinition(config): ToolDefinition; ``` -Defined in: [tools/tool-definition.ts:174](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/tools/tool-definition.ts#L174) +Defined in: [activities/chat/tools/tool-definition.ts:179](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/tools/tool-definition.ts#L179) Create an isomorphic tool definition that can be used directly or instantiated for server/client diff --git a/docs/reference/functions/uiMessageToModelMessages.md b/docs/reference/functions/uiMessageToModelMessages.md index 9b295ad6..7e35c05b 100644 --- a/docs/reference/functions/uiMessageToModelMessages.md +++ b/docs/reference/functions/uiMessageToModelMessages.md @@ -12,7 +12,7 @@ function uiMessageToModelMessages(uiMessage): ModelMessage< | null>[]; ``` -Defined in: [message-converters.ts:65](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/message-converters.ts#L65) +Defined in: [activities/chat/messages.ts:62](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/messages.ts#L62) Convert a UIMessage to ModelMessage(s) diff --git a/docs/reference/functions/untilFinishReason.md b/docs/reference/functions/untilFinishReason.md index 504401fd..0ad4c70d 100644 --- a/docs/reference/functions/untilFinishReason.md +++ b/docs/reference/functions/untilFinishReason.md @@ -9,7 +9,7 @@ title: untilFinishReason function untilFinishReason(stopReasons): AgentLoopStrategy; ``` -Defined in: [utilities/agent-loop-strategies.ts:41](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/utilities/agent-loop-strategies.ts#L41) +Defined in: [activities/chat/agent-loop-strategies.ts:41](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/agent-loop-strategies.ts#L41) Creates a strategy that continues until a specific finish reason is encountered @@ -31,7 +31,8 @@ AgentLoopStrategy that stops on specific finish reasons ```typescript const stream = chat({ - adapter: openaiText("gpt-4o"), + adapter: openaiText(), + model: "gpt-4o", messages: [...], tools: [weatherTool], agentLoopStrategy: untilFinishReason(["stop", "length"]), diff --git a/docs/reference/index.md b/docs/reference/index.md index b28dc1bc..d8edb0ea 100644 --- a/docs/reference/index.md +++ b/docs/reference/index.md @@ -7,7 +7,6 @@ title: "@tanstack/ai" ## Classes -- [BaseAdapter](classes/BaseAdapter.md) - [BatchStrategy](classes/BatchStrategy.md) - [CompositeStrategy](classes/CompositeStrategy.md) - [ImmediateStrategy](classes/ImmediateStrategy.md) @@ -20,24 +19,22 @@ title: "@tanstack/ai" ## Interfaces - [AgentLoopState](interfaces/AgentLoopState.md) -- [AIAdapter](interfaces/AIAdapter.md) -- [AIAdapterConfig](interfaces/AIAdapterConfig.md) - [ApprovalRequestedStreamChunk](interfaces/ApprovalRequestedStreamChunk.md) - [AudioPart](interfaces/AudioPart.md) - [BaseStreamChunk](interfaces/BaseStreamChunk.md) -- [TextCompletionChunk](interfaces/TextCompletionChunk.md) -- [TextOptions](interfaces/TextOptions.md) - [ChunkRecording](interfaces/ChunkRecording.md) - [ChunkStrategy](interfaces/ChunkStrategy.md) - [ClientTool](interfaces/ClientTool.md) +- [CommonOptions](interfaces/CommonOptions.md) - [ContentPartSource](interfaces/ContentPartSource.md) - [ContentStreamChunk](interfaces/ContentStreamChunk.md) - [DefaultMessageMetadataByModality](interfaces/DefaultMessageMetadataByModality.md) - [DocumentPart](interfaces/DocumentPart.md) - [DoneStreamChunk](interfaces/DoneStreamChunk.md) -- [EmbeddingOptions](interfaces/EmbeddingOptions.md) -- [EmbeddingResult](interfaces/EmbeddingResult.md) - [ErrorStreamChunk](interfaces/ErrorStreamChunk.md) +- [GeneratedImage](interfaces/GeneratedImage.md) +- [ImageGenerationOptions](interfaces/ImageGenerationOptions.md) +- [ImageGenerationResult](interfaces/ImageGenerationResult.md) - [ImagePart](interfaces/ImagePart.md) - [InternalToolCallState](interfaces/InternalToolCallState.md) - [JSONParser](interfaces/JSONParser.md) @@ -52,6 +49,8 @@ title: "@tanstack/ai" - [StreamProcessorOptions](interfaces/StreamProcessorOptions.md) - [SummarizationOptions](interfaces/SummarizationOptions.md) - [SummarizationResult](interfaces/SummarizationResult.md) +- [TextCompletionChunk](interfaces/TextCompletionChunk.md) +- [TextOptions](interfaces/TextOptions.md) - [TextPart](interfaces/TextPart.md) - [ThinkingPart](interfaces/ThinkingPart.md) - [ThinkingStreamChunk](interfaces/ThinkingStreamChunk.md) @@ -66,25 +65,33 @@ title: "@tanstack/ai" - [ToolInputAvailableStreamChunk](interfaces/ToolInputAvailableStreamChunk.md) - [ToolResultPart](interfaces/ToolResultPart.md) - [ToolResultStreamChunk](interfaces/ToolResultStreamChunk.md) +- [TranscriptionOptions](interfaces/TranscriptionOptions.md) +- [TranscriptionResult](interfaces/TranscriptionResult.md) +- [TranscriptionSegment](interfaces/TranscriptionSegment.md) +- [TranscriptionWord](interfaces/TranscriptionWord.md) +- [TTSOptions](interfaces/TTSOptions.md) +- [TTSResult](interfaces/TTSResult.md) - [UIMessage](interfaces/UIMessage.md) +- [VideoGenerationOptions](interfaces/VideoGenerationOptions.md) +- [VideoJobResult](interfaces/VideoJobResult.md) - [VideoPart](interfaces/VideoPart.md) +- [VideoStatusResult](interfaces/VideoStatusResult.md) +- [VideoUrlResult](interfaces/VideoUrlResult.md) ## Type Aliases - [AgentLoopStrategy](type-aliases/AgentLoopStrategy.md) +- [AIAdapter](type-aliases/AIAdapter.md) - [AnyClientTool](type-aliases/AnyClientTool.md) -- [TextStreamOptionsForModel](type-aliases/TextStreamOptionsForModel.md) -- [TextStreamOptionsUnion](type-aliases/TextStreamOptionsUnion.md) - [ConstrainedContent](type-aliases/ConstrainedContent.md) - [ConstrainedModelMessage](type-aliases/ConstrainedModelMessage.md) - [ContentPart](type-aliases/ContentPart.md) -- [ContentPartForModalities](type-aliases/ContentPartForModalities.md) -- [ExtractModalitiesForModel](type-aliases/ExtractModalitiesForModel.md) -- [ExtractModelsFromAdapter](type-aliases/ExtractModelsFromAdapter.md) +- [ContentPartForInputModalitiesTypes](type-aliases/ContentPartForInputModalitiesTypes.md) - [InferSchemaType](type-aliases/InferSchemaType.md) - [InferToolInput](type-aliases/InferToolInput.md) - [InferToolName](type-aliases/InferToolName.md) - [InferToolOutput](type-aliases/InferToolOutput.md) +- [InputModalitiesTypes](type-aliases/InputModalitiesTypes.md) - [MessagePart](type-aliases/MessagePart.md) - [ModalitiesArrayToUnion](type-aliases/ModalitiesArrayToUnion.md) - [Modality](type-aliases/Modality.md) @@ -101,20 +108,29 @@ title: "@tanstack/ai" ## Functions -- [chat](functions/text.md) -- [textOptions](functions/textOptions.md) +- [chat](functions/chat.md) - [combineStrategies](functions/combineStrategies.md) - [convertMessagesToModelMessages](functions/convertMessagesToModelMessages.md) - [convertZodToJsonSchema](functions/convertZodToJsonSchema.md) +- [createChatOptions](functions/createChatOptions.md) +- [createImageOptions](functions/createImageOptions.md) - [createReplayStream](functions/createReplayStream.md) -- [embedding](functions/embedding.md) +- [createSpeechOptions](functions/createSpeechOptions.md) +- [createSummarizeOptions](functions/createSummarizeOptions.md) +- [createTranscriptionOptions](functions/createTranscriptionOptions.md) +- [createVideoOptions](functions/createVideoOptions.md) +- [generateImage](functions/generateImage.md) - [generateMessageId](functions/generateMessageId.md) +- [generateSpeech](functions/generateSpeech.md) +- [generateTranscription](functions/generateTranscription.md) +- [generateVideo](functions/generateVideo.md) +- [getVideoJobStatus](functions/getVideoJobStatus.md) - [maxIterations](functions/maxIterations.md) -- [messages](functions/messages.md) - [modelMessagesToUIMessages](functions/modelMessagesToUIMessages.md) - [modelMessageToUIMessage](functions/modelMessageToUIMessage.md) - [normalizeToUIMessage](functions/normalizeToUIMessage.md) - [parsePartialJSON](functions/parsePartialJSON.md) +- [streamToText](functions/streamToText.md) - [summarize](functions/summarize.md) - [toolDefinition](functions/toolDefinition.md) - [toServerSentEventsStream](functions/toServerSentEventsStream.md) diff --git a/docs/reference/interfaces/AIAdapter.md b/docs/reference/interfaces/AIAdapter.md deleted file mode 100644 index 96bb97d4..00000000 --- a/docs/reference/interfaces/AIAdapter.md +++ /dev/null @@ -1,214 +0,0 @@ ---- -id: AIAdapter -title: AIAdapter ---- - -# Interface: AIAdapter\ - -Defined in: [types.ts:756](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L756) - -AI adapter interface with support for endpoint-specific models and provider options. - -Generic parameters: -- TChatModels: Models that support chat/text completion -- TEmbeddingModels: Models that support embeddings -- TChatProviderOptions: Provider-specific options for chat endpoint -- TEmbeddingProviderOptions: Provider-specific options for embedding endpoint -- TModelProviderOptionsByName: Map from model name to its specific provider options -- TModelInputModalitiesByName: Map from model name to its supported input modalities -- TMessageMetadataByModality: Map from modality type to adapter-specific metadata types - -## Type Parameters - -### TChatModels - -`TChatModels` *extends* `ReadonlyArray`\<`string`\> = `ReadonlyArray`\<`string`\> - -### TEmbeddingModels - -`TEmbeddingModels` *extends* `ReadonlyArray`\<`string`\> = `ReadonlyArray`\<`string`\> - -### TChatProviderOptions - -`TChatProviderOptions` *extends* `Record`\<`string`, `any`\> = `Record`\<`string`, `any`\> - -### TEmbeddingProviderOptions - -`TEmbeddingProviderOptions` *extends* `Record`\<`string`, `any`\> = `Record`\<`string`, `any`\> - -### TModelProviderOptionsByName - -`TModelProviderOptionsByName` *extends* `Record`\<`string`, `any`\> = `Record`\<`string`, `any`\> - -### TModelInputModalitiesByName - -`TModelInputModalitiesByName` *extends* `Record`\<`string`, `ReadonlyArray`\<[`Modality`](../type-aliases/Modality.md)\>\> = `Record`\<`string`, `ReadonlyArray`\<[`Modality`](../type-aliases/Modality.md)\>\> - -### TMessageMetadataByModality - -`TMessageMetadataByModality` *extends* `object` = [`DefaultMessageMetadataByModality`](DefaultMessageMetadataByModality.md) - -## Properties - -### \_chatProviderOptions? - -```ts -optional _chatProviderOptions: TChatProviderOptions; -``` - -Defined in: [types.ts:783](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L783) - -*** - -### \_embeddingProviderOptions? - -```ts -optional _embeddingProviderOptions: TEmbeddingProviderOptions; -``` - -Defined in: [types.ts:784](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L784) - -*** - -### \_messageMetadataByModality? - -```ts -optional _messageMetadataByModality: TMessageMetadataByModality; -``` - -Defined in: [types.ts:801](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L801) - -Type-only map from modality type to adapter-specific metadata types. -Used to provide type-safe autocomplete for metadata on content parts. - -*** - -### \_modelInputModalitiesByName? - -```ts -optional _modelInputModalitiesByName: TModelInputModalitiesByName; -``` - -Defined in: [types.ts:796](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L796) - -Type-only map from model name to its supported input modalities. -Used by the core AI types to narrow ContentPart types based on the selected model. -Must be provided by all adapters. - -*** - -### \_modelProviderOptionsByName - -```ts -_modelProviderOptionsByName: TModelProviderOptionsByName; -``` - -Defined in: [types.ts:790](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L790) - -Type-only map from model name to its specific provider options. -Used by the core AI types to narrow providerOptions based on the selected model. -Must be provided by all adapters. - -*** - -### \_providerOptions? - -```ts -optional _providerOptions: TChatProviderOptions; -``` - -Defined in: [types.ts:782](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L782) - -*** - -### chatStream() - -```ts -chatStream: (options) => AsyncIterable; -``` - -Defined in: [types.ts:804](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L804) - -#### Parameters - -##### options - -[`TextOptions`](TextOptions.md)\<`string`, `TChatProviderOptions`\> - -#### Returns - -`AsyncIterable`\<[`StreamChunk`](../type-aliases/StreamChunk.md)\> - -*** - -### createEmbeddings() - -```ts -createEmbeddings: (options) => Promise; -``` - -Defined in: [types.ts:812](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L812) - -#### Parameters - -##### options - -[`EmbeddingOptions`](EmbeddingOptions.md) - -#### Returns - -`Promise`\<[`EmbeddingResult`](EmbeddingResult.md)\> - -*** - -### embeddingModels? - -```ts -optional embeddingModels: TEmbeddingModels; -``` - -Defined in: [types.ts:779](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L779) - -Models that support embeddings - -*** - -### models - -```ts -models: TChatModels; -``` - -Defined in: [types.ts:776](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L776) - -Models that support chat/text completion - -*** - -### name - -```ts -name: string; -``` - -Defined in: [types.ts:774](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L774) - -*** - -### summarize() - -```ts -summarize: (options) => Promise; -``` - -Defined in: [types.ts:809](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L809) - -#### Parameters - -##### options - -[`SummarizationOptions`](SummarizationOptions.md) - -#### Returns - -`Promise`\<[`SummarizationResult`](SummarizationResult.md)\> diff --git a/docs/reference/interfaces/AIAdapterConfig.md b/docs/reference/interfaces/AIAdapterConfig.md deleted file mode 100644 index 76abb781..00000000 --- a/docs/reference/interfaces/AIAdapterConfig.md +++ /dev/null @@ -1,58 +0,0 @@ ---- -id: AIAdapterConfig -title: AIAdapterConfig ---- - -# Interface: AIAdapterConfig - -Defined in: [types.ts:815](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L815) - -## Properties - -### apiKey? - -```ts -optional apiKey: string; -``` - -Defined in: [types.ts:816](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L816) - -*** - -### baseUrl? - -```ts -optional baseUrl: string; -``` - -Defined in: [types.ts:817](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L817) - -*** - -### headers? - -```ts -optional headers: Record; -``` - -Defined in: [types.ts:820](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L820) - -*** - -### maxRetries? - -```ts -optional maxRetries: number; -``` - -Defined in: [types.ts:819](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L819) - -*** - -### timeout? - -```ts -optional timeout: number; -``` - -Defined in: [types.ts:818](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L818) diff --git a/docs/reference/interfaces/AgentLoopState.md b/docs/reference/interfaces/AgentLoopState.md index dff4f90b..11245920 100644 --- a/docs/reference/interfaces/AgentLoopState.md +++ b/docs/reference/interfaces/AgentLoopState.md @@ -5,7 +5,7 @@ title: AgentLoopState # Interface: AgentLoopState -Defined in: [types.ts:522](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L522) +Defined in: [types.ts:579](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L579) State passed to agent loop strategy for determining whether to continue @@ -17,7 +17,7 @@ State passed to agent loop strategy for determining whether to continue finishReason: string | null; ``` -Defined in: [types.ts:528](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L528) +Defined in: [types.ts:585](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L585) Finish reason from the last response @@ -29,7 +29,7 @@ Finish reason from the last response iterationCount: number; ``` -Defined in: [types.ts:524](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L524) +Defined in: [types.ts:581](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L581) Current iteration count (0-indexed) @@ -44,6 +44,6 @@ messages: ModelMessage< | null>[]; ``` -Defined in: [types.ts:526](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L526) +Defined in: [types.ts:583](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L583) Current messages array diff --git a/docs/reference/interfaces/ApprovalRequestedStreamChunk.md b/docs/reference/interfaces/ApprovalRequestedStreamChunk.md index ab57b5dd..1cd6ec0c 100644 --- a/docs/reference/interfaces/ApprovalRequestedStreamChunk.md +++ b/docs/reference/interfaces/ApprovalRequestedStreamChunk.md @@ -5,7 +5,7 @@ title: ApprovalRequestedStreamChunk # Interface: ApprovalRequestedStreamChunk -Defined in: [types.ts:645](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L645) +Defined in: [types.ts:708](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L708) ## Extends @@ -19,7 +19,7 @@ Defined in: [types.ts:645](https://github.com/TanStack/ai/blob/main/packages/typ approval: object; ``` -Defined in: [types.ts:650](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L650) +Defined in: [types.ts:713](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L713) #### id @@ -41,7 +41,7 @@ needsApproval: true; id: string; ``` -Defined in: [types.ts:596](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L596) +Defined in: [types.ts:659](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L659) #### Inherited from @@ -55,7 +55,7 @@ Defined in: [types.ts:596](https://github.com/TanStack/ai/blob/main/packages/typ input: any; ``` -Defined in: [types.ts:649](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L649) +Defined in: [types.ts:712](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L712) *** @@ -65,7 +65,7 @@ Defined in: [types.ts:649](https://github.com/TanStack/ai/blob/main/packages/typ model: string; ``` -Defined in: [types.ts:597](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L597) +Defined in: [types.ts:660](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L660) #### Inherited from @@ -79,7 +79,7 @@ Defined in: [types.ts:597](https://github.com/TanStack/ai/blob/main/packages/typ timestamp: number; ``` -Defined in: [types.ts:598](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L598) +Defined in: [types.ts:661](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L661) #### Inherited from @@ -93,7 +93,7 @@ Defined in: [types.ts:598](https://github.com/TanStack/ai/blob/main/packages/typ toolCallId: string; ``` -Defined in: [types.ts:647](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L647) +Defined in: [types.ts:710](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L710) *** @@ -103,7 +103,7 @@ Defined in: [types.ts:647](https://github.com/TanStack/ai/blob/main/packages/typ toolName: string; ``` -Defined in: [types.ts:648](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L648) +Defined in: [types.ts:711](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L711) *** @@ -113,7 +113,7 @@ Defined in: [types.ts:648](https://github.com/TanStack/ai/blob/main/packages/typ type: "approval-requested"; ``` -Defined in: [types.ts:646](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L646) +Defined in: [types.ts:709](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L709) #### Overrides diff --git a/docs/reference/interfaces/AudioPart.md b/docs/reference/interfaces/AudioPart.md index 836e16d1..1038e5d8 100644 --- a/docs/reference/interfaces/AudioPart.md +++ b/docs/reference/interfaces/AudioPart.md @@ -5,7 +5,7 @@ title: AudioPart # Interface: AudioPart\ -Defined in: [types.ts:120](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L120) +Defined in: [types.ts:196](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L196) Audio content part for multimodal messages. @@ -25,7 +25,7 @@ Provider-specific metadata type optional metadata: TMetadata; ``` -Defined in: [types.ts:125](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L125) +Defined in: [types.ts:201](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L201) Provider-specific metadata (e.g., format, sample rate) @@ -37,7 +37,7 @@ Provider-specific metadata (e.g., format, sample rate) source: ContentPartSource; ``` -Defined in: [types.ts:123](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L123) +Defined in: [types.ts:199](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L199) Source of the audio content @@ -49,4 +49,4 @@ Source of the audio content type: "audio"; ``` -Defined in: [types.ts:121](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L121) +Defined in: [types.ts:197](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L197) diff --git a/docs/reference/interfaces/BaseStreamChunk.md b/docs/reference/interfaces/BaseStreamChunk.md index 81481d16..3b00b198 100644 --- a/docs/reference/interfaces/BaseStreamChunk.md +++ b/docs/reference/interfaces/BaseStreamChunk.md @@ -5,7 +5,7 @@ title: BaseStreamChunk # Interface: BaseStreamChunk -Defined in: [types.ts:594](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L594) +Defined in: [types.ts:657](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L657) ## Extended by @@ -26,7 +26,7 @@ Defined in: [types.ts:594](https://github.com/TanStack/ai/blob/main/packages/typ id: string; ``` -Defined in: [types.ts:596](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L596) +Defined in: [types.ts:659](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L659) *** @@ -36,7 +36,7 @@ Defined in: [types.ts:596](https://github.com/TanStack/ai/blob/main/packages/typ model: string; ``` -Defined in: [types.ts:597](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L597) +Defined in: [types.ts:660](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L660) *** @@ -46,7 +46,7 @@ Defined in: [types.ts:597](https://github.com/TanStack/ai/blob/main/packages/typ timestamp: number; ``` -Defined in: [types.ts:598](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L598) +Defined in: [types.ts:661](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L661) *** @@ -56,4 +56,4 @@ Defined in: [types.ts:598](https://github.com/TanStack/ai/blob/main/packages/typ type: StreamChunkType; ``` -Defined in: [types.ts:595](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L595) +Defined in: [types.ts:658](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L658) diff --git a/docs/reference/interfaces/ChunkRecording.md b/docs/reference/interfaces/ChunkRecording.md index 3833f041..984fa148 100644 --- a/docs/reference/interfaces/ChunkRecording.md +++ b/docs/reference/interfaces/ChunkRecording.md @@ -5,7 +5,7 @@ title: ChunkRecording # Interface: ChunkRecording -Defined in: [stream/types.ts:83](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/types.ts#L83) +Defined in: [activities/chat/stream/types.ts:73](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/types.ts#L73) Recording format for replay testing @@ -17,7 +17,7 @@ Recording format for replay testing chunks: object[]; ``` -Defined in: [stream/types.ts:88](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/types.ts#L88) +Defined in: [activities/chat/stream/types.ts:78](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/types.ts#L78) #### chunk @@ -45,7 +45,7 @@ timestamp: number; optional model: string; ``` -Defined in: [stream/types.ts:86](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/types.ts#L86) +Defined in: [activities/chat/stream/types.ts:76](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/types.ts#L76) *** @@ -55,7 +55,7 @@ Defined in: [stream/types.ts:86](https://github.com/TanStack/ai/blob/main/packag optional provider: string; ``` -Defined in: [stream/types.ts:87](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/types.ts#L87) +Defined in: [activities/chat/stream/types.ts:77](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/types.ts#L77) *** @@ -65,7 +65,7 @@ Defined in: [stream/types.ts:87](https://github.com/TanStack/ai/blob/main/packag optional result: ProcessorResult; ``` -Defined in: [stream/types.ts:93](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/types.ts#L93) +Defined in: [activities/chat/stream/types.ts:83](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/types.ts#L83) *** @@ -75,7 +75,7 @@ Defined in: [stream/types.ts:93](https://github.com/TanStack/ai/blob/main/packag timestamp: number; ``` -Defined in: [stream/types.ts:85](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/types.ts#L85) +Defined in: [activities/chat/stream/types.ts:75](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/types.ts#L75) *** @@ -85,4 +85,4 @@ Defined in: [stream/types.ts:85](https://github.com/TanStack/ai/blob/main/packag version: "1.0"; ``` -Defined in: [stream/types.ts:84](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/types.ts#L84) +Defined in: [activities/chat/stream/types.ts:74](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/types.ts#L74) diff --git a/docs/reference/interfaces/ChunkStrategy.md b/docs/reference/interfaces/ChunkStrategy.md index c9b06168..a6652233 100644 --- a/docs/reference/interfaces/ChunkStrategy.md +++ b/docs/reference/interfaces/ChunkStrategy.md @@ -5,7 +5,7 @@ title: ChunkStrategy # Interface: ChunkStrategy -Defined in: [stream/types.ts:43](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/types.ts#L43) +Defined in: [activities/chat/stream/types.ts:33](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/types.ts#L33) Strategy for determining when to emit text updates @@ -17,7 +17,7 @@ Strategy for determining when to emit text updates optional reset: () => void; ``` -Defined in: [stream/types.ts:55](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/types.ts#L55) +Defined in: [activities/chat/stream/types.ts:45](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/types.ts#L45) Optional: Reset strategy state (called when streaming starts) @@ -33,7 +33,7 @@ Optional: Reset strategy state (called when streaming starts) shouldEmit: (chunk, accumulated) => boolean; ``` -Defined in: [stream/types.ts:50](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/types.ts#L50) +Defined in: [activities/chat/stream/types.ts:40](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/types.ts#L40) Called for each text chunk received diff --git a/docs/reference/interfaces/ClientTool.md b/docs/reference/interfaces/ClientTool.md index 9dc73d7c..71a7de65 100644 --- a/docs/reference/interfaces/ClientTool.md +++ b/docs/reference/interfaces/ClientTool.md @@ -5,7 +5,7 @@ title: ClientTool # Interface: ClientTool\ -Defined in: [tools/tool-definition.ts:18](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/tools/tool-definition.ts#L18) +Defined in: [activities/chat/tools/tool-definition.ts:23](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/tools/tool-definition.ts#L23) Marker type for client-side tools @@ -31,7 +31,7 @@ Marker type for client-side tools __toolSide: "client"; ``` -Defined in: [tools/tool-definition.ts:23](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/tools/tool-definition.ts#L23) +Defined in: [activities/chat/tools/tool-definition.ts:28](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/tools/tool-definition.ts#L28) *** @@ -41,7 +41,7 @@ Defined in: [tools/tool-definition.ts:23](https://github.com/TanStack/ai/blob/ma description: string; ``` -Defined in: [tools/tool-definition.ts:25](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/tools/tool-definition.ts#L25) +Defined in: [activities/chat/tools/tool-definition.ts:30](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/tools/tool-definition.ts#L30) *** @@ -53,7 +53,7 @@ optional execute: (args) => | Promise>; ``` -Defined in: [tools/tool-definition.ts:30](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/tools/tool-definition.ts#L30) +Defined in: [activities/chat/tools/tool-definition.ts:35](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/tools/tool-definition.ts#L35) #### Parameters @@ -74,7 +74,7 @@ Defined in: [tools/tool-definition.ts:30](https://github.com/TanStack/ai/blob/ma optional inputSchema: TInput; ``` -Defined in: [tools/tool-definition.ts:26](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/tools/tool-definition.ts#L26) +Defined in: [activities/chat/tools/tool-definition.ts:31](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/tools/tool-definition.ts#L31) *** @@ -84,7 +84,7 @@ Defined in: [tools/tool-definition.ts:26](https://github.com/TanStack/ai/blob/ma optional metadata: Record; ``` -Defined in: [tools/tool-definition.ts:29](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/tools/tool-definition.ts#L29) +Defined in: [activities/chat/tools/tool-definition.ts:34](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/tools/tool-definition.ts#L34) *** @@ -94,7 +94,7 @@ Defined in: [tools/tool-definition.ts:29](https://github.com/TanStack/ai/blob/ma name: TName; ``` -Defined in: [tools/tool-definition.ts:24](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/tools/tool-definition.ts#L24) +Defined in: [activities/chat/tools/tool-definition.ts:29](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/tools/tool-definition.ts#L29) *** @@ -104,7 +104,7 @@ Defined in: [tools/tool-definition.ts:24](https://github.com/TanStack/ai/blob/ma optional needsApproval: boolean; ``` -Defined in: [tools/tool-definition.ts:28](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/tools/tool-definition.ts#L28) +Defined in: [activities/chat/tools/tool-definition.ts:33](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/tools/tool-definition.ts#L33) *** @@ -114,4 +114,4 @@ Defined in: [tools/tool-definition.ts:28](https://github.com/TanStack/ai/blob/ma optional outputSchema: TOutput; ``` -Defined in: [tools/tool-definition.ts:27](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/tools/tool-definition.ts#L27) +Defined in: [activities/chat/tools/tool-definition.ts:32](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/tools/tool-definition.ts#L32) diff --git a/docs/reference/interfaces/CommonOptions.md b/docs/reference/interfaces/CommonOptions.md new file mode 100644 index 00000000..9241c1d2 --- /dev/null +++ b/docs/reference/interfaces/CommonOptions.md @@ -0,0 +1,89 @@ +--- +id: CommonOptions +title: CommonOptions +--- + +# Interface: CommonOptions + +Defined in: [types.ts:29](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L29) + +Common options shared across different AI provider implementations. +These options represent the standard parameters that work across OpenAI, Anthropic, and Gemini. + +## Properties + +### maxTokens? + +```ts +optional maxTokens: number; +``` + +Defined in: [types.ts:66](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L66) + +The maximum number of tokens to generate in the response. + +Provider usage: +- OpenAI: `max_output_tokens` (number) - includes visible output and reasoning tokens +- Anthropic: `max_tokens` (number, required) - range x >= 1 +- Gemini: `generationConfig.maxOutputTokens` (number) + +*** + +### metadata? + +```ts +optional metadata: Record; +``` + +Defined in: [types.ts:78](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L78) + +Additional metadata to attach to the request. +Can be used for tracking, debugging, or passing custom information. +Structure and constraints vary by provider. + +Provider usage: +- OpenAI: `metadata` (Record) - max 16 key-value pairs, keys max 64 chars, values max 512 chars +- Anthropic: `metadata` (Record) - includes optional user_id (max 256 chars) +- Gemini: Not directly available in TextProviderOptions + +*** + +### temperature? + +```ts +optional temperature: number; +``` + +Defined in: [types.ts:42](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L42) + +Controls the randomness of the output. +Higher values (e.g., 0.8) make output more random, lower values (e.g., 0.2) make it more focused and deterministic. +Range: [0.0, 2.0] + +Note: Generally recommended to use either temperature or topP, but not both. + +Provider usage: +- OpenAI: `temperature` (number) - in text.top_p field +- Anthropic: `temperature` (number) - ranges from 0.0 to 1.0, default 1.0 +- Gemini: `generationConfig.temperature` (number) - ranges from 0.0 to 2.0 + +*** + +### topP? + +```ts +optional topP: number; +``` + +Defined in: [types.ts:56](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L56) + +Nucleus sampling parameter. An alternative to temperature sampling. +The model considers the results of tokens with topP probability mass. +For example, 0.1 means only tokens comprising the top 10% probability mass are considered. + +Note: Generally recommended to use either temperature or topP, but not both. + +Provider usage: +- OpenAI: `text.top_p` (number) +- Anthropic: `top_p` (number | null) +- Gemini: `generationConfig.topP` (number) diff --git a/docs/reference/interfaces/ContentPartSource.md b/docs/reference/interfaces/ContentPartSource.md index 45dea6a6..eb9e5957 100644 --- a/docs/reference/interfaces/ContentPartSource.md +++ b/docs/reference/interfaces/ContentPartSource.md @@ -5,7 +5,7 @@ title: ContentPartSource # Interface: ContentPartSource -Defined in: [types.ts:89](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L89) +Defined in: [types.ts:165](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L165) Source specification for multimodal content. Supports both inline data (base64) and URL-based content. @@ -18,7 +18,7 @@ Supports both inline data (base64) and URL-based content. type: "data" | "url"; ``` -Defined in: [types.ts:95](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L95) +Defined in: [types.ts:171](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L171) The type of source: - 'data': Inline data (typically base64 encoded) @@ -32,7 +32,7 @@ The type of source: value: string; ``` -Defined in: [types.ts:101](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L101) +Defined in: [types.ts:177](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L177) The actual content value: - For 'data': base64-encoded string diff --git a/docs/reference/interfaces/ContentStreamChunk.md b/docs/reference/interfaces/ContentStreamChunk.md index e03782a4..3071e638 100644 --- a/docs/reference/interfaces/ContentStreamChunk.md +++ b/docs/reference/interfaces/ContentStreamChunk.md @@ -5,7 +5,7 @@ title: ContentStreamChunk # Interface: ContentStreamChunk -Defined in: [types.ts:601](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L601) +Defined in: [types.ts:664](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L664) ## Extends @@ -19,7 +19,7 @@ Defined in: [types.ts:601](https://github.com/TanStack/ai/blob/main/packages/typ content: string; ``` -Defined in: [types.ts:604](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L604) +Defined in: [types.ts:667](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L667) *** @@ -29,7 +29,7 @@ Defined in: [types.ts:604](https://github.com/TanStack/ai/blob/main/packages/typ delta: string; ``` -Defined in: [types.ts:603](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L603) +Defined in: [types.ts:666](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L666) *** @@ -39,7 +39,7 @@ Defined in: [types.ts:603](https://github.com/TanStack/ai/blob/main/packages/typ id: string; ``` -Defined in: [types.ts:596](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L596) +Defined in: [types.ts:659](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L659) #### Inherited from @@ -53,7 +53,7 @@ Defined in: [types.ts:596](https://github.com/TanStack/ai/blob/main/packages/typ model: string; ``` -Defined in: [types.ts:597](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L597) +Defined in: [types.ts:660](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L660) #### Inherited from @@ -67,7 +67,7 @@ Defined in: [types.ts:597](https://github.com/TanStack/ai/blob/main/packages/typ optional role: "assistant"; ``` -Defined in: [types.ts:605](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L605) +Defined in: [types.ts:668](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L668) *** @@ -77,7 +77,7 @@ Defined in: [types.ts:605](https://github.com/TanStack/ai/blob/main/packages/typ timestamp: number; ``` -Defined in: [types.ts:598](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L598) +Defined in: [types.ts:661](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L661) #### Inherited from @@ -91,7 +91,7 @@ Defined in: [types.ts:598](https://github.com/TanStack/ai/blob/main/packages/typ type: "content"; ``` -Defined in: [types.ts:602](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L602) +Defined in: [types.ts:665](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L665) #### Overrides diff --git a/docs/reference/interfaces/DefaultMessageMetadataByModality.md b/docs/reference/interfaces/DefaultMessageMetadataByModality.md index d13b5888..ec33a6ef 100644 --- a/docs/reference/interfaces/DefaultMessageMetadataByModality.md +++ b/docs/reference/interfaces/DefaultMessageMetadataByModality.md @@ -5,7 +5,7 @@ title: DefaultMessageMetadataByModality # Interface: DefaultMessageMetadataByModality -Defined in: [types.ts:736](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L736) +Defined in: [types.ts:1019](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L1019) Default metadata type for adapters that don't define custom metadata. Uses unknown for all modalities. @@ -18,7 +18,7 @@ Uses unknown for all modalities. audio: unknown; ``` -Defined in: [types.ts:739](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L739) +Defined in: [types.ts:1022](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L1022) *** @@ -28,7 +28,7 @@ Defined in: [types.ts:739](https://github.com/TanStack/ai/blob/main/packages/typ document: unknown; ``` -Defined in: [types.ts:741](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L741) +Defined in: [types.ts:1024](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L1024) *** @@ -38,7 +38,7 @@ Defined in: [types.ts:741](https://github.com/TanStack/ai/blob/main/packages/typ image: unknown; ``` -Defined in: [types.ts:738](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L738) +Defined in: [types.ts:1021](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L1021) *** @@ -48,7 +48,7 @@ Defined in: [types.ts:738](https://github.com/TanStack/ai/blob/main/packages/typ text: unknown; ``` -Defined in: [types.ts:737](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L737) +Defined in: [types.ts:1020](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L1020) *** @@ -58,4 +58,4 @@ Defined in: [types.ts:737](https://github.com/TanStack/ai/blob/main/packages/typ video: unknown; ``` -Defined in: [types.ts:740](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L740) +Defined in: [types.ts:1023](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L1023) diff --git a/docs/reference/interfaces/DocumentPart.md b/docs/reference/interfaces/DocumentPart.md index f29a80b7..ae1f10d0 100644 --- a/docs/reference/interfaces/DocumentPart.md +++ b/docs/reference/interfaces/DocumentPart.md @@ -5,7 +5,7 @@ title: DocumentPart # Interface: DocumentPart\ -Defined in: [types.ts:144](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L144) +Defined in: [types.ts:220](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L220) Document content part for multimodal messages (e.g., PDFs). @@ -25,7 +25,7 @@ Provider-specific metadata type (e.g., Anthropic's media_type) optional metadata: TMetadata; ``` -Defined in: [types.ts:149](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L149) +Defined in: [types.ts:225](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L225) Provider-specific metadata (e.g., media_type for PDFs) @@ -37,7 +37,7 @@ Provider-specific metadata (e.g., media_type for PDFs) source: ContentPartSource; ``` -Defined in: [types.ts:147](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L147) +Defined in: [types.ts:223](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L223) Source of the document content @@ -49,4 +49,4 @@ Source of the document content type: "document"; ``` -Defined in: [types.ts:145](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L145) +Defined in: [types.ts:221](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L221) diff --git a/docs/reference/interfaces/DoneStreamChunk.md b/docs/reference/interfaces/DoneStreamChunk.md index a62e11e8..99c53e29 100644 --- a/docs/reference/interfaces/DoneStreamChunk.md +++ b/docs/reference/interfaces/DoneStreamChunk.md @@ -5,7 +5,7 @@ title: DoneStreamChunk # Interface: DoneStreamChunk -Defined in: [types.ts:627](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L627) +Defined in: [types.ts:690](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L690) ## Extends @@ -19,7 +19,7 @@ Defined in: [types.ts:627](https://github.com/TanStack/ai/blob/main/packages/typ finishReason: "length" | "stop" | "content_filter" | "tool_calls" | null; ``` -Defined in: [types.ts:629](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L629) +Defined in: [types.ts:692](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L692) *** @@ -29,7 +29,7 @@ Defined in: [types.ts:629](https://github.com/TanStack/ai/blob/main/packages/typ id: string; ``` -Defined in: [types.ts:596](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L596) +Defined in: [types.ts:659](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L659) #### Inherited from @@ -43,7 +43,7 @@ Defined in: [types.ts:596](https://github.com/TanStack/ai/blob/main/packages/typ model: string; ``` -Defined in: [types.ts:597](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L597) +Defined in: [types.ts:660](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L660) #### Inherited from @@ -57,7 +57,7 @@ Defined in: [types.ts:597](https://github.com/TanStack/ai/blob/main/packages/typ timestamp: number; ``` -Defined in: [types.ts:598](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L598) +Defined in: [types.ts:661](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L661) #### Inherited from @@ -71,7 +71,7 @@ Defined in: [types.ts:598](https://github.com/TanStack/ai/blob/main/packages/typ type: "done"; ``` -Defined in: [types.ts:628](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L628) +Defined in: [types.ts:691](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L691) #### Overrides @@ -85,7 +85,7 @@ Defined in: [types.ts:628](https://github.com/TanStack/ai/blob/main/packages/typ optional usage: object; ``` -Defined in: [types.ts:630](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L630) +Defined in: [types.ts:693](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L693) #### completionTokens diff --git a/docs/reference/interfaces/EmbeddingOptions.md b/docs/reference/interfaces/EmbeddingOptions.md deleted file mode 100644 index 471035f6..00000000 --- a/docs/reference/interfaces/EmbeddingOptions.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -id: EmbeddingOptions -title: EmbeddingOptions ---- - -# Interface: EmbeddingOptions - -Defined in: [types.ts:716](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L716) - -## Properties - -### dimensions? - -```ts -optional dimensions: number; -``` - -Defined in: [types.ts:719](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L719) - -*** - -### input - -```ts -input: string | string[]; -``` - -Defined in: [types.ts:718](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L718) - -*** - -### model - -```ts -model: string; -``` - -Defined in: [types.ts:717](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L717) diff --git a/docs/reference/interfaces/EmbeddingResult.md b/docs/reference/interfaces/EmbeddingResult.md deleted file mode 100644 index 39e385e4..00000000 --- a/docs/reference/interfaces/EmbeddingResult.md +++ /dev/null @@ -1,60 +0,0 @@ ---- -id: EmbeddingResult -title: EmbeddingResult ---- - -# Interface: EmbeddingResult - -Defined in: [types.ts:722](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L722) - -## Properties - -### embeddings - -```ts -embeddings: number[][]; -``` - -Defined in: [types.ts:725](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L725) - -*** - -### id - -```ts -id: string; -``` - -Defined in: [types.ts:723](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L723) - -*** - -### model - -```ts -model: string; -``` - -Defined in: [types.ts:724](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L724) - -*** - -### usage - -```ts -usage: object; -``` - -Defined in: [types.ts:726](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L726) - -#### promptTokens - -```ts -promptTokens: number; -``` - -#### totalTokens - -```ts -totalTokens: number; -``` diff --git a/docs/reference/interfaces/ErrorStreamChunk.md b/docs/reference/interfaces/ErrorStreamChunk.md index 57cb491d..a55bf1d6 100644 --- a/docs/reference/interfaces/ErrorStreamChunk.md +++ b/docs/reference/interfaces/ErrorStreamChunk.md @@ -5,7 +5,7 @@ title: ErrorStreamChunk # Interface: ErrorStreamChunk -Defined in: [types.ts:637](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L637) +Defined in: [types.ts:700](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L700) ## Extends @@ -19,7 +19,7 @@ Defined in: [types.ts:637](https://github.com/TanStack/ai/blob/main/packages/typ error: object; ``` -Defined in: [types.ts:639](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L639) +Defined in: [types.ts:702](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L702) #### code? @@ -41,7 +41,7 @@ message: string; id: string; ``` -Defined in: [types.ts:596](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L596) +Defined in: [types.ts:659](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L659) #### Inherited from @@ -55,7 +55,7 @@ Defined in: [types.ts:596](https://github.com/TanStack/ai/blob/main/packages/typ model: string; ``` -Defined in: [types.ts:597](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L597) +Defined in: [types.ts:660](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L660) #### Inherited from @@ -69,7 +69,7 @@ Defined in: [types.ts:597](https://github.com/TanStack/ai/blob/main/packages/typ timestamp: number; ``` -Defined in: [types.ts:598](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L598) +Defined in: [types.ts:661](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L661) #### Inherited from @@ -83,7 +83,7 @@ Defined in: [types.ts:598](https://github.com/TanStack/ai/blob/main/packages/typ type: "error"; ``` -Defined in: [types.ts:638](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L638) +Defined in: [types.ts:701](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L701) #### Overrides diff --git a/docs/reference/interfaces/GeneratedImage.md b/docs/reference/interfaces/GeneratedImage.md new file mode 100644 index 00000000..978b8e02 --- /dev/null +++ b/docs/reference/interfaces/GeneratedImage.md @@ -0,0 +1,46 @@ +--- +id: GeneratedImage +title: GeneratedImage +--- + +# Interface: GeneratedImage + +Defined in: [types.ts:805](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L805) + +A single generated image + +## Properties + +### b64Json? + +```ts +optional b64Json: string; +``` + +Defined in: [types.ts:807](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L807) + +Base64-encoded image data + +*** + +### revisedPrompt? + +```ts +optional revisedPrompt: string; +``` + +Defined in: [types.ts:811](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L811) + +Revised prompt used by the model (if applicable) + +*** + +### url? + +```ts +optional url: string; +``` + +Defined in: [types.ts:809](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L809) + +URL to the generated image (may be temporary) diff --git a/docs/reference/interfaces/ImageGenerationOptions.md b/docs/reference/interfaces/ImageGenerationOptions.md new file mode 100644 index 00000000..bcb8bec3 --- /dev/null +++ b/docs/reference/interfaces/ImageGenerationOptions.md @@ -0,0 +1,77 @@ +--- +id: ImageGenerationOptions +title: ImageGenerationOptions +--- + +# Interface: ImageGenerationOptions\ + +Defined in: [types.ts:787](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L787) + +Options for image generation. +These are the common options supported across providers. + +## Type Parameters + +### TProviderOptions + +`TProviderOptions` *extends* `object` = `object` + +## Properties + +### model + +```ts +model: string; +``` + +Defined in: [types.ts:791](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L791) + +The model to use for image generation + +*** + +### modelOptions? + +```ts +optional modelOptions: TProviderOptions; +``` + +Defined in: [types.ts:799](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L799) + +Model-specific options for image generation + +*** + +### numberOfImages? + +```ts +optional numberOfImages: number; +``` + +Defined in: [types.ts:795](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L795) + +Number of images to generate (default: 1) + +*** + +### prompt + +```ts +prompt: string; +``` + +Defined in: [types.ts:793](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L793) + +Text description of the desired image(s) + +*** + +### size? + +```ts +optional size: string; +``` + +Defined in: [types.ts:797](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L797) + +Image size in WIDTHxHEIGHT format (e.g., "1024x1024") diff --git a/docs/reference/interfaces/ImageGenerationResult.md b/docs/reference/interfaces/ImageGenerationResult.md new file mode 100644 index 00000000..060d9b22 --- /dev/null +++ b/docs/reference/interfaces/ImageGenerationResult.md @@ -0,0 +1,76 @@ +--- +id: ImageGenerationResult +title: ImageGenerationResult +--- + +# Interface: ImageGenerationResult + +Defined in: [types.ts:817](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L817) + +Result of image generation + +## Properties + +### id + +```ts +id: string; +``` + +Defined in: [types.ts:819](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L819) + +Unique identifier for the generation + +*** + +### images + +```ts +images: GeneratedImage[]; +``` + +Defined in: [types.ts:823](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L823) + +Array of generated images + +*** + +### model + +```ts +model: string; +``` + +Defined in: [types.ts:821](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L821) + +Model used for generation + +*** + +### usage? + +```ts +optional usage: object; +``` + +Defined in: [types.ts:825](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L825) + +Token usage information (if available) + +#### inputTokens? + +```ts +optional inputTokens: number; +``` + +#### outputTokens? + +```ts +optional outputTokens: number; +``` + +#### totalTokens? + +```ts +optional totalTokens: number; +``` diff --git a/docs/reference/interfaces/ImagePart.md b/docs/reference/interfaces/ImagePart.md index 25e0f890..6ba2d826 100644 --- a/docs/reference/interfaces/ImagePart.md +++ b/docs/reference/interfaces/ImagePart.md @@ -5,7 +5,7 @@ title: ImagePart # Interface: ImagePart\ -Defined in: [types.ts:108](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L108) +Defined in: [types.ts:184](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L184) Image content part for multimodal messages. @@ -25,7 +25,7 @@ Provider-specific metadata type (e.g., OpenAI's detail level) optional metadata: TMetadata; ``` -Defined in: [types.ts:113](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L113) +Defined in: [types.ts:189](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L189) Provider-specific metadata (e.g., OpenAI's detail: 'auto' | 'low' | 'high') @@ -37,7 +37,7 @@ Provider-specific metadata (e.g., OpenAI's detail: 'auto' | 'low' | 'high') source: ContentPartSource; ``` -Defined in: [types.ts:111](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L111) +Defined in: [types.ts:187](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L187) Source of the image content @@ -49,4 +49,4 @@ Source of the image content type: "image"; ``` -Defined in: [types.ts:109](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L109) +Defined in: [types.ts:185](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L185) diff --git a/docs/reference/interfaces/InternalToolCallState.md b/docs/reference/interfaces/InternalToolCallState.md index e8607bce..2f8e5014 100644 --- a/docs/reference/interfaces/InternalToolCallState.md +++ b/docs/reference/interfaces/InternalToolCallState.md @@ -5,7 +5,7 @@ title: InternalToolCallState # Interface: InternalToolCallState -Defined in: [stream/types.ts:31](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/types.ts#L31) +Defined in: [activities/chat/stream/types.ts:21](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/types.ts#L21) Internal state for a tool call being tracked @@ -17,7 +17,7 @@ Internal state for a tool call being tracked arguments: string; ``` -Defined in: [stream/types.ts:34](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/types.ts#L34) +Defined in: [activities/chat/stream/types.ts:24](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/types.ts#L24) *** @@ -27,7 +27,7 @@ Defined in: [stream/types.ts:34](https://github.com/TanStack/ai/blob/main/packag id: string; ``` -Defined in: [stream/types.ts:32](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/types.ts#L32) +Defined in: [activities/chat/stream/types.ts:22](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/types.ts#L22) *** @@ -37,7 +37,7 @@ Defined in: [stream/types.ts:32](https://github.com/TanStack/ai/blob/main/packag index: number; ``` -Defined in: [stream/types.ts:37](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/types.ts#L37) +Defined in: [activities/chat/stream/types.ts:27](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/types.ts#L27) *** @@ -47,7 +47,7 @@ Defined in: [stream/types.ts:37](https://github.com/TanStack/ai/blob/main/packag name: string; ``` -Defined in: [stream/types.ts:33](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/types.ts#L33) +Defined in: [activities/chat/stream/types.ts:23](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/types.ts#L23) *** @@ -57,7 +57,7 @@ Defined in: [stream/types.ts:33](https://github.com/TanStack/ai/blob/main/packag optional parsedArguments: any; ``` -Defined in: [stream/types.ts:36](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/types.ts#L36) +Defined in: [activities/chat/stream/types.ts:26](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/types.ts#L26) *** @@ -67,4 +67,4 @@ Defined in: [stream/types.ts:36](https://github.com/TanStack/ai/blob/main/packag state: ToolCallState; ``` -Defined in: [stream/types.ts:35](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/types.ts#L35) +Defined in: [activities/chat/stream/types.ts:25](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/types.ts#L25) diff --git a/docs/reference/interfaces/JSONParser.md b/docs/reference/interfaces/JSONParser.md index 228cd1a2..b0b665af 100644 --- a/docs/reference/interfaces/JSONParser.md +++ b/docs/reference/interfaces/JSONParser.md @@ -5,7 +5,7 @@ title: JSONParser # Interface: JSONParser -Defined in: [stream/json-parser.ts:12](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/json-parser.ts#L12) +Defined in: [activities/chat/stream/json-parser.ts:12](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/json-parser.ts#L12) JSON Parser interface - allows for custom parser implementations @@ -17,7 +17,7 @@ JSON Parser interface - allows for custom parser implementations parse: (jsonString) => any; ``` -Defined in: [stream/json-parser.ts:18](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/json-parser.ts#L18) +Defined in: [activities/chat/stream/json-parser.ts:18](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/json-parser.ts#L18) Parse a JSON string (may be incomplete/partial) diff --git a/docs/reference/interfaces/JSONSchema.md b/docs/reference/interfaces/JSONSchema.md index 6c86f49b..de9fdfb7 100644 --- a/docs/reference/interfaces/JSONSchema.md +++ b/docs/reference/interfaces/JSONSchema.md @@ -5,7 +5,7 @@ title: JSONSchema # Interface: JSONSchema -Defined in: [types.ts:9](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L9) +Defined in: [types.ts:85](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L85) JSON Schema type for defining tool input/output schemas as raw JSON Schema objects. This allows tools to be defined without Zod when you have JSON Schema definitions available. @@ -24,7 +24,7 @@ This allows tools to be defined without Zod when you have JSON Schema definition optional $defs: Record; ``` -Defined in: [types.ts:19](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L19) +Defined in: [types.ts:95](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L95) *** @@ -34,7 +34,7 @@ Defined in: [types.ts:19](https://github.com/TanStack/ai/blob/main/packages/type optional $ref: string; ``` -Defined in: [types.ts:18](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L18) +Defined in: [types.ts:94](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L94) *** @@ -44,7 +44,7 @@ Defined in: [types.ts:18](https://github.com/TanStack/ai/blob/main/packages/type optional additionalItems: boolean | JSONSchema; ``` -Defined in: [types.ts:40](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L40) +Defined in: [types.ts:116](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L116) *** @@ -54,7 +54,7 @@ Defined in: [types.ts:40](https://github.com/TanStack/ai/blob/main/packages/type optional additionalProperties: boolean | JSONSchema; ``` -Defined in: [types.ts:39](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L39) +Defined in: [types.ts:115](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L115) *** @@ -64,7 +64,7 @@ Defined in: [types.ts:39](https://github.com/TanStack/ai/blob/main/packages/type optional allOf: JSONSchema[]; ``` -Defined in: [types.ts:21](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L21) +Defined in: [types.ts:97](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L97) *** @@ -74,7 +74,7 @@ Defined in: [types.ts:21](https://github.com/TanStack/ai/blob/main/packages/type optional anyOf: JSONSchema[]; ``` -Defined in: [types.ts:22](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L22) +Defined in: [types.ts:98](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L98) *** @@ -84,7 +84,7 @@ Defined in: [types.ts:22](https://github.com/TanStack/ai/blob/main/packages/type optional const: any; ``` -Defined in: [types.ts:15](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L15) +Defined in: [types.ts:91](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L91) *** @@ -94,7 +94,7 @@ Defined in: [types.ts:15](https://github.com/TanStack/ai/blob/main/packages/type optional default: any; ``` -Defined in: [types.ts:17](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L17) +Defined in: [types.ts:93](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L93) *** @@ -104,7 +104,7 @@ Defined in: [types.ts:17](https://github.com/TanStack/ai/blob/main/packages/type optional definitions: Record; ``` -Defined in: [types.ts:20](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L20) +Defined in: [types.ts:96](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L96) *** @@ -114,7 +114,7 @@ Defined in: [types.ts:20](https://github.com/TanStack/ai/blob/main/packages/type optional description: string; ``` -Defined in: [types.ts:16](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L16) +Defined in: [types.ts:92](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L92) *** @@ -124,7 +124,7 @@ Defined in: [types.ts:16](https://github.com/TanStack/ai/blob/main/packages/type optional else: JSONSchema; ``` -Defined in: [types.ts:27](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L27) +Defined in: [types.ts:103](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L103) *** @@ -134,7 +134,7 @@ Defined in: [types.ts:27](https://github.com/TanStack/ai/blob/main/packages/type optional enum: any[]; ``` -Defined in: [types.ts:14](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L14) +Defined in: [types.ts:90](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L90) *** @@ -144,7 +144,7 @@ Defined in: [types.ts:14](https://github.com/TanStack/ai/blob/main/packages/type optional examples: any[]; ``` -Defined in: [types.ts:46](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L46) +Defined in: [types.ts:122](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L122) *** @@ -154,7 +154,7 @@ Defined in: [types.ts:46](https://github.com/TanStack/ai/blob/main/packages/type optional exclusiveMaximum: number; ``` -Defined in: [types.ts:31](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L31) +Defined in: [types.ts:107](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L107) *** @@ -164,7 +164,7 @@ Defined in: [types.ts:31](https://github.com/TanStack/ai/blob/main/packages/type optional exclusiveMinimum: number; ``` -Defined in: [types.ts:30](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L30) +Defined in: [types.ts:106](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L106) *** @@ -174,7 +174,7 @@ Defined in: [types.ts:30](https://github.com/TanStack/ai/blob/main/packages/type optional format: string; ``` -Defined in: [types.ts:35](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L35) +Defined in: [types.ts:111](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L111) *** @@ -184,7 +184,7 @@ Defined in: [types.ts:35](https://github.com/TanStack/ai/blob/main/packages/type optional if: JSONSchema; ``` -Defined in: [types.ts:25](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L25) +Defined in: [types.ts:101](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L101) *** @@ -194,7 +194,7 @@ Defined in: [types.ts:25](https://github.com/TanStack/ai/blob/main/packages/type optional items: JSONSchema | JSONSchema[]; ``` -Defined in: [types.ts:12](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L12) +Defined in: [types.ts:88](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L88) *** @@ -204,7 +204,7 @@ Defined in: [types.ts:12](https://github.com/TanStack/ai/blob/main/packages/type optional maximum: number; ``` -Defined in: [types.ts:29](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L29) +Defined in: [types.ts:105](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L105) *** @@ -214,7 +214,7 @@ Defined in: [types.ts:29](https://github.com/TanStack/ai/blob/main/packages/type optional maxItems: number; ``` -Defined in: [types.ts:37](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L37) +Defined in: [types.ts:113](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L113) *** @@ -224,7 +224,7 @@ Defined in: [types.ts:37](https://github.com/TanStack/ai/blob/main/packages/type optional maxLength: number; ``` -Defined in: [types.ts:33](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L33) +Defined in: [types.ts:109](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L109) *** @@ -234,7 +234,7 @@ Defined in: [types.ts:33](https://github.com/TanStack/ai/blob/main/packages/type optional maxProperties: number; ``` -Defined in: [types.ts:44](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L44) +Defined in: [types.ts:120](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L120) *** @@ -244,7 +244,7 @@ Defined in: [types.ts:44](https://github.com/TanStack/ai/blob/main/packages/type optional minimum: number; ``` -Defined in: [types.ts:28](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L28) +Defined in: [types.ts:104](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L104) *** @@ -254,7 +254,7 @@ Defined in: [types.ts:28](https://github.com/TanStack/ai/blob/main/packages/type optional minItems: number; ``` -Defined in: [types.ts:36](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L36) +Defined in: [types.ts:112](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L112) *** @@ -264,7 +264,7 @@ Defined in: [types.ts:36](https://github.com/TanStack/ai/blob/main/packages/type optional minLength: number; ``` -Defined in: [types.ts:32](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L32) +Defined in: [types.ts:108](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L108) *** @@ -274,7 +274,7 @@ Defined in: [types.ts:32](https://github.com/TanStack/ai/blob/main/packages/type optional minProperties: number; ``` -Defined in: [types.ts:43](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L43) +Defined in: [types.ts:119](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L119) *** @@ -284,7 +284,7 @@ Defined in: [types.ts:43](https://github.com/TanStack/ai/blob/main/packages/type optional not: JSONSchema; ``` -Defined in: [types.ts:24](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L24) +Defined in: [types.ts:100](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L100) *** @@ -294,7 +294,7 @@ Defined in: [types.ts:24](https://github.com/TanStack/ai/blob/main/packages/type optional oneOf: JSONSchema[]; ``` -Defined in: [types.ts:23](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L23) +Defined in: [types.ts:99](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L99) *** @@ -304,7 +304,7 @@ Defined in: [types.ts:23](https://github.com/TanStack/ai/blob/main/packages/type optional pattern: string; ``` -Defined in: [types.ts:34](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L34) +Defined in: [types.ts:110](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L110) *** @@ -314,7 +314,7 @@ Defined in: [types.ts:34](https://github.com/TanStack/ai/blob/main/packages/type optional patternProperties: Record; ``` -Defined in: [types.ts:41](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L41) +Defined in: [types.ts:117](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L117) *** @@ -324,7 +324,7 @@ Defined in: [types.ts:41](https://github.com/TanStack/ai/blob/main/packages/type optional properties: Record; ``` -Defined in: [types.ts:11](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L11) +Defined in: [types.ts:87](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L87) *** @@ -334,7 +334,7 @@ Defined in: [types.ts:11](https://github.com/TanStack/ai/blob/main/packages/type optional propertyNames: JSONSchema; ``` -Defined in: [types.ts:42](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L42) +Defined in: [types.ts:118](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L118) *** @@ -344,7 +344,7 @@ Defined in: [types.ts:42](https://github.com/TanStack/ai/blob/main/packages/type optional required: string[]; ``` -Defined in: [types.ts:13](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L13) +Defined in: [types.ts:89](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L89) *** @@ -354,7 +354,7 @@ Defined in: [types.ts:13](https://github.com/TanStack/ai/blob/main/packages/type optional then: JSONSchema; ``` -Defined in: [types.ts:26](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L26) +Defined in: [types.ts:102](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L102) *** @@ -364,7 +364,7 @@ Defined in: [types.ts:26](https://github.com/TanStack/ai/blob/main/packages/type optional title: string; ``` -Defined in: [types.ts:45](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L45) +Defined in: [types.ts:121](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L121) *** @@ -374,7 +374,7 @@ Defined in: [types.ts:45](https://github.com/TanStack/ai/blob/main/packages/type optional type: string | string[]; ``` -Defined in: [types.ts:10](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L10) +Defined in: [types.ts:86](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L86) *** @@ -384,4 +384,4 @@ Defined in: [types.ts:10](https://github.com/TanStack/ai/blob/main/packages/type optional uniqueItems: boolean; ``` -Defined in: [types.ts:38](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L38) +Defined in: [types.ts:114](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L114) diff --git a/docs/reference/interfaces/ModelMessage.md b/docs/reference/interfaces/ModelMessage.md index 075cb3c5..9b50467c 100644 --- a/docs/reference/interfaces/ModelMessage.md +++ b/docs/reference/interfaces/ModelMessage.md @@ -5,7 +5,7 @@ title: ModelMessage # Interface: ModelMessage\ -Defined in: [types.ts:220](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L220) +Defined in: [types.ts:283](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L283) ## Type Parameters @@ -21,7 +21,7 @@ Defined in: [types.ts:220](https://github.com/TanStack/ai/blob/main/packages/typ content: TContent; ``` -Defined in: [types.ts:227](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L227) +Defined in: [types.ts:290](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L290) *** @@ -31,7 +31,7 @@ Defined in: [types.ts:227](https://github.com/TanStack/ai/blob/main/packages/typ optional name: string; ``` -Defined in: [types.ts:228](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L228) +Defined in: [types.ts:291](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L291) *** @@ -41,7 +41,7 @@ Defined in: [types.ts:228](https://github.com/TanStack/ai/blob/main/packages/typ role: "user" | "assistant" | "tool"; ``` -Defined in: [types.ts:226](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L226) +Defined in: [types.ts:289](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L289) *** @@ -51,7 +51,7 @@ Defined in: [types.ts:226](https://github.com/TanStack/ai/blob/main/packages/typ optional toolCallId: string; ``` -Defined in: [types.ts:230](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L230) +Defined in: [types.ts:293](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L293) *** @@ -61,4 +61,4 @@ Defined in: [types.ts:230](https://github.com/TanStack/ai/blob/main/packages/typ optional toolCalls: ToolCall[]; ``` -Defined in: [types.ts:229](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L229) +Defined in: [types.ts:292](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L292) diff --git a/docs/reference/interfaces/ProcessorResult.md b/docs/reference/interfaces/ProcessorResult.md index 9fb65250..f6531c94 100644 --- a/docs/reference/interfaces/ProcessorResult.md +++ b/docs/reference/interfaces/ProcessorResult.md @@ -5,7 +5,7 @@ title: ProcessorResult # Interface: ProcessorResult -Defined in: [stream/types.ts:61](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/types.ts#L61) +Defined in: [activities/chat/stream/types.ts:51](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/types.ts#L51) Result from processing a stream @@ -17,7 +17,7 @@ Result from processing a stream content: string; ``` -Defined in: [stream/types.ts:62](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/types.ts#L62) +Defined in: [activities/chat/stream/types.ts:52](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/types.ts#L52) *** @@ -27,7 +27,7 @@ Defined in: [stream/types.ts:62](https://github.com/TanStack/ai/blob/main/packag optional finishReason: string | null; ``` -Defined in: [stream/types.ts:65](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/types.ts#L65) +Defined in: [activities/chat/stream/types.ts:55](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/types.ts#L55) *** @@ -37,7 +37,7 @@ Defined in: [stream/types.ts:65](https://github.com/TanStack/ai/blob/main/packag optional thinking: string; ``` -Defined in: [stream/types.ts:63](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/types.ts#L63) +Defined in: [activities/chat/stream/types.ts:53](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/types.ts#L53) *** @@ -47,4 +47,4 @@ Defined in: [stream/types.ts:63](https://github.com/TanStack/ai/blob/main/packag optional toolCalls: ToolCall[]; ``` -Defined in: [stream/types.ts:64](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/types.ts#L64) +Defined in: [activities/chat/stream/types.ts:54](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/types.ts#L54) diff --git a/docs/reference/interfaces/ProcessorState.md b/docs/reference/interfaces/ProcessorState.md index 7ef5bba6..c5efbbd2 100644 --- a/docs/reference/interfaces/ProcessorState.md +++ b/docs/reference/interfaces/ProcessorState.md @@ -5,7 +5,7 @@ title: ProcessorState # Interface: ProcessorState -Defined in: [stream/types.ts:71](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/types.ts#L71) +Defined in: [activities/chat/stream/types.ts:61](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/types.ts#L61) Current state of the processor @@ -17,7 +17,7 @@ Current state of the processor content: string; ``` -Defined in: [stream/types.ts:72](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/types.ts#L72) +Defined in: [activities/chat/stream/types.ts:62](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/types.ts#L62) *** @@ -27,7 +27,7 @@ Defined in: [stream/types.ts:72](https://github.com/TanStack/ai/blob/main/packag done: boolean; ``` -Defined in: [stream/types.ts:77](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/types.ts#L77) +Defined in: [activities/chat/stream/types.ts:67](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/types.ts#L67) *** @@ -37,7 +37,7 @@ Defined in: [stream/types.ts:77](https://github.com/TanStack/ai/blob/main/packag finishReason: string | null; ``` -Defined in: [stream/types.ts:76](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/types.ts#L76) +Defined in: [activities/chat/stream/types.ts:66](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/types.ts#L66) *** @@ -47,7 +47,7 @@ Defined in: [stream/types.ts:76](https://github.com/TanStack/ai/blob/main/packag thinking: string; ``` -Defined in: [stream/types.ts:73](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/types.ts#L73) +Defined in: [activities/chat/stream/types.ts:63](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/types.ts#L63) *** @@ -57,7 +57,7 @@ Defined in: [stream/types.ts:73](https://github.com/TanStack/ai/blob/main/packag toolCallOrder: string[]; ``` -Defined in: [stream/types.ts:75](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/types.ts#L75) +Defined in: [activities/chat/stream/types.ts:65](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/types.ts#L65) *** @@ -67,4 +67,4 @@ Defined in: [stream/types.ts:75](https://github.com/TanStack/ai/blob/main/packag toolCalls: Map; ``` -Defined in: [stream/types.ts:74](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/types.ts#L74) +Defined in: [activities/chat/stream/types.ts:64](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/types.ts#L64) diff --git a/docs/reference/interfaces/ResponseFormat.md b/docs/reference/interfaces/ResponseFormat.md index 5e141882..9bebaeeb 100644 --- a/docs/reference/interfaces/ResponseFormat.md +++ b/docs/reference/interfaces/ResponseFormat.md @@ -5,7 +5,7 @@ title: ResponseFormat # Interface: ResponseFormat\ -Defined in: [types.ts:438](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L438) +Defined in: [types.ts:495](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L495) Structured output format specification. @@ -33,7 +33,7 @@ TypeScript type of the expected data structure (for type safety) optional __data: TData; ``` -Defined in: [types.ts:516](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L516) +Defined in: [types.ts:573](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L573) **`Internal`** @@ -50,7 +50,7 @@ Allows the SDK to know what type to expect when parsing the response. optional json_schema: object; ``` -Defined in: [types.ts:455](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L455) +Defined in: [types.ts:512](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L512) JSON schema specification (required when type is "json_schema"). @@ -139,7 +139,7 @@ https://platform.openai.com/docs/guides/structured-outputs#strict-mode type: "json_object" | "json_schema"; ``` -Defined in: [types.ts:447](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L447) +Defined in: [types.ts:504](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L504) Type of structured output. diff --git a/docs/reference/interfaces/ServerTool.md b/docs/reference/interfaces/ServerTool.md index 00c7bbbb..a0a66e4a 100644 --- a/docs/reference/interfaces/ServerTool.md +++ b/docs/reference/interfaces/ServerTool.md @@ -5,7 +5,7 @@ title: ServerTool # Interface: ServerTool\ -Defined in: [tools/tool-definition.ts:7](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/tools/tool-definition.ts#L7) +Defined in: [activities/chat/tools/tool-definition.ts:12](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/tools/tool-definition.ts#L12) Marker type for server-side tools @@ -35,7 +35,7 @@ Marker type for server-side tools __toolSide: "server"; ``` -Defined in: [tools/tool-definition.ts:12](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/tools/tool-definition.ts#L12) +Defined in: [activities/chat/tools/tool-definition.ts:17](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/tools/tool-definition.ts#L17) *** @@ -45,7 +45,7 @@ Defined in: [tools/tool-definition.ts:12](https://github.com/TanStack/ai/blob/ma description: string; ``` -Defined in: [types.ts:343](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L343) +Defined in: [types.ts:400](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L400) Clear description of what the tool does. @@ -70,7 +70,7 @@ Be specific about what the tool does, what parameters it needs, and what it retu optional execute: (args) => any; ``` -Defined in: [types.ts:414](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L414) +Defined in: [types.ts:471](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L471) Optional function to execute when the model calls this tool. @@ -114,7 +114,7 @@ execute: async (args) => { optional inputSchema: TInput; ``` -Defined in: [types.ts:375](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L375) +Defined in: [types.ts:432](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L432) Schema describing the tool's input parameters. @@ -163,7 +163,7 @@ z.object({ optional metadata: Record; ``` -Defined in: [types.ts:420](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L420) +Defined in: [types.ts:477](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L477) Additional metadata for adapters or custom extensions @@ -179,7 +179,7 @@ Additional metadata for adapters or custom extensions name: TName; ``` -Defined in: [types.ts:333](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L333) +Defined in: [types.ts:390](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L390) Unique name of the tool (used by the model to call it). @@ -204,7 +204,7 @@ Must be unique within the tools array. optional needsApproval: boolean; ``` -Defined in: [types.ts:417](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L417) +Defined in: [types.ts:474](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L474) If true, tool execution requires user approval before running. Works with both server and client tools. @@ -220,7 +220,7 @@ If true, tool execution requires user approval before running. Works with both s optional outputSchema: TOutput; ``` -Defined in: [types.ts:395](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L395) +Defined in: [types.ts:452](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L452) Optional schema for validating tool output. diff --git a/docs/reference/interfaces/StreamProcessorEvents.md b/docs/reference/interfaces/StreamProcessorEvents.md index 313e1987..a3546357 100644 --- a/docs/reference/interfaces/StreamProcessorEvents.md +++ b/docs/reference/interfaces/StreamProcessorEvents.md @@ -5,7 +5,7 @@ title: StreamProcessorEvents # Interface: StreamProcessorEvents -Defined in: [stream/processor.ts:51](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L51) +Defined in: [activities/chat/stream/processor.ts:48](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L48) Events emitted by the StreamProcessor @@ -17,7 +17,7 @@ Events emitted by the StreamProcessor optional onApprovalRequest: (args) => void; ``` -Defined in: [stream/processor.ts:66](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L66) +Defined in: [activities/chat/stream/processor.ts:63](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L63) #### Parameters @@ -51,7 +51,7 @@ Defined in: [stream/processor.ts:66](https://github.com/TanStack/ai/blob/main/pa optional onError: (error) => void; ``` -Defined in: [stream/processor.ts:58](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L58) +Defined in: [activities/chat/stream/processor.ts:55](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L55) #### Parameters @@ -71,7 +71,7 @@ Defined in: [stream/processor.ts:58](https://github.com/TanStack/ai/blob/main/pa optional onMessagesChange: (messages) => void; ``` -Defined in: [stream/processor.ts:53](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L53) +Defined in: [activities/chat/stream/processor.ts:50](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L50) #### Parameters @@ -91,7 +91,7 @@ Defined in: [stream/processor.ts:53](https://github.com/TanStack/ai/blob/main/pa optional onStreamEnd: (message) => void; ``` -Defined in: [stream/processor.ts:57](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L57) +Defined in: [activities/chat/stream/processor.ts:54](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L54) #### Parameters @@ -111,7 +111,7 @@ Defined in: [stream/processor.ts:57](https://github.com/TanStack/ai/blob/main/pa optional onStreamStart: () => void; ``` -Defined in: [stream/processor.ts:56](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L56) +Defined in: [activities/chat/stream/processor.ts:53](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L53) #### Returns @@ -125,7 +125,7 @@ Defined in: [stream/processor.ts:56](https://github.com/TanStack/ai/blob/main/pa optional onTextUpdate: (messageId, content) => void; ``` -Defined in: [stream/processor.ts:74](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L74) +Defined in: [activities/chat/stream/processor.ts:71](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L71) #### Parameters @@ -149,7 +149,7 @@ Defined in: [stream/processor.ts:74](https://github.com/TanStack/ai/blob/main/pa optional onThinkingUpdate: (messageId, content) => void; ``` -Defined in: [stream/processor.ts:81](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L81) +Defined in: [activities/chat/stream/processor.ts:78](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L78) #### Parameters @@ -173,7 +173,7 @@ Defined in: [stream/processor.ts:81](https://github.com/TanStack/ai/blob/main/pa optional onToolCall: (args) => void; ``` -Defined in: [stream/processor.ts:61](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L61) +Defined in: [activities/chat/stream/processor.ts:58](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L58) #### Parameters @@ -203,7 +203,7 @@ Defined in: [stream/processor.ts:61](https://github.com/TanStack/ai/blob/main/pa optional onToolCallStateChange: (messageId, toolCallId, state, args) => void; ``` -Defined in: [stream/processor.ts:75](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L75) +Defined in: [activities/chat/stream/processor.ts:72](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L72) #### Parameters diff --git a/docs/reference/interfaces/StreamProcessorHandlers.md b/docs/reference/interfaces/StreamProcessorHandlers.md index c4e50f56..32d2cd4d 100644 --- a/docs/reference/interfaces/StreamProcessorHandlers.md +++ b/docs/reference/interfaces/StreamProcessorHandlers.md @@ -5,7 +5,7 @@ title: StreamProcessorHandlers # Interface: StreamProcessorHandlers -Defined in: [stream/processor.ts:88](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L88) +Defined in: [activities/chat/stream/processor.ts:85](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L85) Legacy handlers for backward compatibility These are the old callback-style handlers @@ -18,7 +18,7 @@ These are the old callback-style handlers optional onApprovalRequested: (toolCallId, toolName, input, approvalId) => void; ``` -Defined in: [stream/processor.ts:119](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L119) +Defined in: [activities/chat/stream/processor.ts:116](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L116) #### Parameters @@ -50,7 +50,7 @@ Defined in: [stream/processor.ts:119](https://github.com/TanStack/ai/blob/main/p optional onError: (error) => void; ``` -Defined in: [stream/processor.ts:133](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L133) +Defined in: [activities/chat/stream/processor.ts:130](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L130) #### Parameters @@ -76,7 +76,7 @@ Defined in: [stream/processor.ts:133](https://github.com/TanStack/ai/blob/main/p optional onStreamEnd: (content, toolCalls?) => void; ``` -Defined in: [stream/processor.ts:132](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L132) +Defined in: [activities/chat/stream/processor.ts:129](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L129) #### Parameters @@ -100,7 +100,7 @@ Defined in: [stream/processor.ts:132](https://github.com/TanStack/ai/blob/main/p optional onTextUpdate: (content) => void; ``` -Defined in: [stream/processor.ts:89](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L89) +Defined in: [activities/chat/stream/processor.ts:86](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L86) #### Parameters @@ -120,7 +120,7 @@ Defined in: [stream/processor.ts:89](https://github.com/TanStack/ai/blob/main/pa optional onThinkingUpdate: (content) => void; ``` -Defined in: [stream/processor.ts:90](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L90) +Defined in: [activities/chat/stream/processor.ts:87](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L87) #### Parameters @@ -140,7 +140,7 @@ Defined in: [stream/processor.ts:90](https://github.com/TanStack/ai/blob/main/pa optional onToolCallComplete: (index, id, name, args) => void; ``` -Defined in: [stream/processor.ts:95](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L95) +Defined in: [activities/chat/stream/processor.ts:92](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L92) #### Parameters @@ -172,7 +172,7 @@ Defined in: [stream/processor.ts:95](https://github.com/TanStack/ai/blob/main/pa optional onToolCallDelta: (index, args) => void; ``` -Defined in: [stream/processor.ts:94](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L94) +Defined in: [activities/chat/stream/processor.ts:91](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L91) #### Parameters @@ -196,7 +196,7 @@ Defined in: [stream/processor.ts:94](https://github.com/TanStack/ai/blob/main/pa optional onToolCallStart: (index, id, name) => void; ``` -Defined in: [stream/processor.ts:93](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L93) +Defined in: [activities/chat/stream/processor.ts:90](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L90) #### Parameters @@ -224,7 +224,7 @@ Defined in: [stream/processor.ts:93](https://github.com/TanStack/ai/blob/main/pa optional onToolCallStateChange: (index, id, name, state, args, parsedArgs?) => void; ``` -Defined in: [stream/processor.ts:101](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L101) +Defined in: [activities/chat/stream/processor.ts:98](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L98) #### Parameters @@ -264,7 +264,7 @@ Defined in: [stream/processor.ts:101](https://github.com/TanStack/ai/blob/main/p optional onToolInputAvailable: (toolCallId, toolName, input) => void; ``` -Defined in: [stream/processor.ts:125](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L125) +Defined in: [activities/chat/stream/processor.ts:122](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L122) #### Parameters @@ -292,7 +292,7 @@ Defined in: [stream/processor.ts:125](https://github.com/TanStack/ai/blob/main/p optional onToolResultStateChange: (toolCallId, content, state, error?) => void; ``` -Defined in: [stream/processor.ts:111](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L111) +Defined in: [activities/chat/stream/processor.ts:108](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L108) #### Parameters diff --git a/docs/reference/interfaces/StreamProcessorOptions.md b/docs/reference/interfaces/StreamProcessorOptions.md index ebe37672..61668336 100644 --- a/docs/reference/interfaces/StreamProcessorOptions.md +++ b/docs/reference/interfaces/StreamProcessorOptions.md @@ -5,7 +5,7 @@ title: StreamProcessorOptions # Interface: StreamProcessorOptions -Defined in: [stream/processor.ts:139](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L139) +Defined in: [activities/chat/stream/processor.ts:136](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L136) Options for StreamProcessor @@ -17,7 +17,7 @@ Options for StreamProcessor optional chunkStrategy: ChunkStrategy; ``` -Defined in: [stream/processor.ts:140](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L140) +Defined in: [activities/chat/stream/processor.ts:137](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L137) *** @@ -27,7 +27,7 @@ Defined in: [stream/processor.ts:140](https://github.com/TanStack/ai/blob/main/p optional events: StreamProcessorEvents; ``` -Defined in: [stream/processor.ts:142](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L142) +Defined in: [activities/chat/stream/processor.ts:139](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L139) New event-driven handlers @@ -39,7 +39,7 @@ New event-driven handlers optional handlers: StreamProcessorHandlers; ``` -Defined in: [stream/processor.ts:144](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L144) +Defined in: [activities/chat/stream/processor.ts:141](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L141) Legacy callback handlers (for backward compatibility) @@ -51,7 +51,7 @@ Legacy callback handlers (for backward compatibility) optional initialMessages: UIMessage[]; ``` -Defined in: [stream/processor.ts:151](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L151) +Defined in: [activities/chat/stream/processor.ts:148](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L148) Initial messages to populate the processor @@ -63,7 +63,7 @@ Initial messages to populate the processor optional jsonParser: object; ``` -Defined in: [stream/processor.ts:145](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L145) +Defined in: [activities/chat/stream/processor.ts:142](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L142) #### parse() @@ -89,6 +89,6 @@ parse: (jsonString) => any; optional recording: boolean; ``` -Defined in: [stream/processor.ts:149](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/processor.ts#L149) +Defined in: [activities/chat/stream/processor.ts:146](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/processor.ts#L146) Enable recording for replay testing diff --git a/docs/reference/interfaces/SummarizationOptions.md b/docs/reference/interfaces/SummarizationOptions.md index 575580e2..8f67c7b6 100644 --- a/docs/reference/interfaces/SummarizationOptions.md +++ b/docs/reference/interfaces/SummarizationOptions.md @@ -5,7 +5,7 @@ title: SummarizationOptions # Interface: SummarizationOptions -Defined in: [types.ts:697](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L697) +Defined in: [types.ts:760](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L760) ## Properties @@ -15,7 +15,7 @@ Defined in: [types.ts:697](https://github.com/TanStack/ai/blob/main/packages/typ optional focus: string[]; ``` -Defined in: [types.ts:702](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L702) +Defined in: [types.ts:765](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L765) *** @@ -25,7 +25,7 @@ Defined in: [types.ts:702](https://github.com/TanStack/ai/blob/main/packages/typ optional maxLength: number; ``` -Defined in: [types.ts:700](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L700) +Defined in: [types.ts:763](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L763) *** @@ -35,7 +35,7 @@ Defined in: [types.ts:700](https://github.com/TanStack/ai/blob/main/packages/typ model: string; ``` -Defined in: [types.ts:698](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L698) +Defined in: [types.ts:761](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L761) *** @@ -45,7 +45,7 @@ Defined in: [types.ts:698](https://github.com/TanStack/ai/blob/main/packages/typ optional style: "bullet-points" | "paragraph" | "concise"; ``` -Defined in: [types.ts:701](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L701) +Defined in: [types.ts:764](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L764) *** @@ -55,4 +55,4 @@ Defined in: [types.ts:701](https://github.com/TanStack/ai/blob/main/packages/typ text: string; ``` -Defined in: [types.ts:699](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L699) +Defined in: [types.ts:762](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L762) diff --git a/docs/reference/interfaces/SummarizationResult.md b/docs/reference/interfaces/SummarizationResult.md index 390814d8..a30ed860 100644 --- a/docs/reference/interfaces/SummarizationResult.md +++ b/docs/reference/interfaces/SummarizationResult.md @@ -5,7 +5,7 @@ title: SummarizationResult # Interface: SummarizationResult -Defined in: [types.ts:705](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L705) +Defined in: [types.ts:768](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L768) ## Properties @@ -15,7 +15,7 @@ Defined in: [types.ts:705](https://github.com/TanStack/ai/blob/main/packages/typ id: string; ``` -Defined in: [types.ts:706](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L706) +Defined in: [types.ts:769](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L769) *** @@ -25,7 +25,7 @@ Defined in: [types.ts:706](https://github.com/TanStack/ai/blob/main/packages/typ model: string; ``` -Defined in: [types.ts:707](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L707) +Defined in: [types.ts:770](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L770) *** @@ -35,7 +35,7 @@ Defined in: [types.ts:707](https://github.com/TanStack/ai/blob/main/packages/typ summary: string; ``` -Defined in: [types.ts:708](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L708) +Defined in: [types.ts:771](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L771) *** @@ -45,7 +45,7 @@ Defined in: [types.ts:708](https://github.com/TanStack/ai/blob/main/packages/typ usage: object; ``` -Defined in: [types.ts:709](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L709) +Defined in: [types.ts:772](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L772) #### completionTokens diff --git a/docs/reference/interfaces/TTSOptions.md b/docs/reference/interfaces/TTSOptions.md new file mode 100644 index 00000000..5ed2f309 --- /dev/null +++ b/docs/reference/interfaces/TTSOptions.md @@ -0,0 +1,89 @@ +--- +id: TTSOptions +title: TTSOptions +--- + +# Interface: TTSOptions\ + +Defined in: [types.ts:907](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L907) + +Options for text-to-speech generation. +These are the common options supported across providers. + +## Type Parameters + +### TProviderOptions + +`TProviderOptions` *extends* `object` = `object` + +## Properties + +### format? + +```ts +optional format: "mp3" | "opus" | "aac" | "flac" | "wav" | "pcm"; +``` + +Defined in: [types.ts:915](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L915) + +The output audio format + +*** + +### model + +```ts +model: string; +``` + +Defined in: [types.ts:909](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L909) + +The model to use for TTS generation + +*** + +### modelOptions? + +```ts +optional modelOptions: TProviderOptions; +``` + +Defined in: [types.ts:919](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L919) + +Model-specific options for TTS generation + +*** + +### speed? + +```ts +optional speed: number; +``` + +Defined in: [types.ts:917](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L917) + +The speed of the generated audio (0.25 to 4.0) + +*** + +### text + +```ts +text: string; +``` + +Defined in: [types.ts:911](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L911) + +The text to convert to speech + +*** + +### voice? + +```ts +optional voice: string; +``` + +Defined in: [types.ts:913](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L913) + +The voice to use for generation diff --git a/docs/reference/interfaces/TTSResult.md b/docs/reference/interfaces/TTSResult.md new file mode 100644 index 00000000..5a3bb4e0 --- /dev/null +++ b/docs/reference/interfaces/TTSResult.md @@ -0,0 +1,82 @@ +--- +id: TTSResult +title: TTSResult +--- + +# Interface: TTSResult + +Defined in: [types.ts:925](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L925) + +Result of text-to-speech generation. + +## Properties + +### audio + +```ts +audio: string; +``` + +Defined in: [types.ts:931](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L931) + +Base64-encoded audio data + +*** + +### contentType? + +```ts +optional contentType: string; +``` + +Defined in: [types.ts:937](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L937) + +Content type of the audio (e.g., 'audio/mp3') + +*** + +### duration? + +```ts +optional duration: number; +``` + +Defined in: [types.ts:935](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L935) + +Duration of the audio in seconds, if available + +*** + +### format + +```ts +format: string; +``` + +Defined in: [types.ts:933](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L933) + +Audio format of the generated audio + +*** + +### id + +```ts +id: string; +``` + +Defined in: [types.ts:927](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L927) + +Unique identifier for the generation + +*** + +### model + +```ts +model: string; +``` + +Defined in: [types.ts:929](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L929) + +Model used for generation diff --git a/docs/reference/interfaces/TextCompletionChunk.md b/docs/reference/interfaces/TextCompletionChunk.md index fe2db802..6afadd6b 100644 --- a/docs/reference/interfaces/TextCompletionChunk.md +++ b/docs/reference/interfaces/TextCompletionChunk.md @@ -5,7 +5,7 @@ title: TextCompletionChunk # Interface: TextCompletionChunk -Defined in: [types.ts:684](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L684) +Defined in: [types.ts:747](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L747) ## Properties @@ -15,7 +15,7 @@ Defined in: [types.ts:684](https://github.com/TanStack/ai/blob/main/packages/typ content: string; ``` -Defined in: [types.ts:687](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L687) +Defined in: [types.ts:750](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L750) *** @@ -25,7 +25,7 @@ Defined in: [types.ts:687](https://github.com/TanStack/ai/blob/main/packages/typ optional finishReason: "length" | "stop" | "content_filter" | null; ``` -Defined in: [types.ts:689](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L689) +Defined in: [types.ts:752](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L752) *** @@ -35,7 +35,7 @@ Defined in: [types.ts:689](https://github.com/TanStack/ai/blob/main/packages/typ id: string; ``` -Defined in: [types.ts:685](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L685) +Defined in: [types.ts:748](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L748) *** @@ -45,7 +45,7 @@ Defined in: [types.ts:685](https://github.com/TanStack/ai/blob/main/packages/typ model: string; ``` -Defined in: [types.ts:686](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L686) +Defined in: [types.ts:749](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L749) *** @@ -55,7 +55,7 @@ Defined in: [types.ts:686](https://github.com/TanStack/ai/blob/main/packages/typ optional role: "assistant"; ``` -Defined in: [types.ts:688](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L688) +Defined in: [types.ts:751](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L751) *** @@ -65,7 +65,7 @@ Defined in: [types.ts:688](https://github.com/TanStack/ai/blob/main/packages/typ optional usage: object; ``` -Defined in: [types.ts:690](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L690) +Defined in: [types.ts:753](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L753) #### completionTokens diff --git a/docs/reference/interfaces/TextOptions.md b/docs/reference/interfaces/TextOptions.md index 123ad406..d5dc1731 100644 --- a/docs/reference/interfaces/TextOptions.md +++ b/docs/reference/interfaces/TextOptions.md @@ -3,18 +3,14 @@ id: TextOptions title: TextOptions --- -# Interface: TextOptions\ +# Interface: TextOptions\ -Defined in: [types.ts:548](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L548) +Defined in: [types.ts:605](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L605) Options passed into the SDK and further piped to the AI provider. ## Type Parameters -### TModel - -`TModel` *extends* `string` = `string` - ### TProviderOptionsSuperset `TProviderOptionsSuperset` *extends* `Record`\<`string`, `any`\> = `Record`\<`string`, `any`\> @@ -35,7 +31,7 @@ Options passed into the SDK and further piped to the AI provider. optional abortController: AbortController; ``` -Defined in: [types.ts:581](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L581) +Defined in: [types.ts:644](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L644) AbortController for request cancellation. @@ -62,7 +58,7 @@ https://developer.mozilla.org/en-US/docs/Web/API/AbortController optional agentLoopStrategy: AgentLoopStrategy; ``` -Defined in: [types.ts:558](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L558) +Defined in: [types.ts:614](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L614) *** @@ -72,7 +68,7 @@ Defined in: [types.ts:558](https://github.com/TanStack/ai/blob/main/packages/typ optional conversationId: string; ``` -Defined in: [types.ts:567](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L567) +Defined in: [types.ts:630](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L630) Conversation ID for correlating client and server-side devtools events. When provided, server-side events will be linked to the client conversation in devtools. @@ -88,17 +84,27 @@ messages: ModelMessage< | null>[]; ``` -Defined in: [types.ts:555](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L555) +Defined in: [types.ts:611](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L611) *** ### model ```ts -model: TModel; +model: string; +``` + +Defined in: [types.ts:610](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L610) + +*** + +### modelOptions? + +```ts +optional modelOptions: TProviderOptionsForModel; ``` -Defined in: [types.ts:554](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L554) +Defined in: [types.ts:616](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L616) *** @@ -108,7 +114,7 @@ Defined in: [types.ts:554](https://github.com/TanStack/ai/blob/main/packages/typ optional options: CommonOptions; ``` -Defined in: [types.ts:559](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L559) +Defined in: [types.ts:615](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L615) *** @@ -118,17 +124,22 @@ Defined in: [types.ts:559](https://github.com/TanStack/ai/blob/main/packages/typ optional output: TOutput; ``` -Defined in: [types.ts:562](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L562) +Defined in: [types.ts:618](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L618) *** -### providerOptions? +### outputSchema? ```ts -optional providerOptions: TProviderOptionsForModel; +optional outputSchema: ZodType>; ``` -Defined in: [types.ts:560](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L560) +Defined in: [types.ts:625](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L625) + +Zod schema for structured output. +When provided, the adapter should use the provider's native structured output API +to ensure the response conforms to this schema. +The schema will be converted to JSON Schema format before being sent to the provider. *** @@ -138,7 +149,7 @@ Defined in: [types.ts:560](https://github.com/TanStack/ai/blob/main/packages/typ optional request: Request | RequestInit; ``` -Defined in: [types.ts:561](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L561) +Defined in: [types.ts:617](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L617) *** @@ -148,7 +159,7 @@ Defined in: [types.ts:561](https://github.com/TanStack/ai/blob/main/packages/typ optional systemPrompts: string[]; ``` -Defined in: [types.ts:557](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L557) +Defined in: [types.ts:613](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L613) *** @@ -158,4 +169,4 @@ Defined in: [types.ts:557](https://github.com/TanStack/ai/blob/main/packages/typ optional tools: Tool[]; ``` -Defined in: [types.ts:556](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L556) +Defined in: [types.ts:612](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L612) diff --git a/docs/reference/interfaces/TextPart.md b/docs/reference/interfaces/TextPart.md index 105418d1..f51896d6 100644 --- a/docs/reference/interfaces/TextPart.md +++ b/docs/reference/interfaces/TextPart.md @@ -5,7 +5,7 @@ title: TextPart # Interface: TextPart\ -Defined in: [types.ts:236](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L236) +Defined in: [types.ts:299](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L299) Message parts - building blocks of UIMessage @@ -23,7 +23,7 @@ Message parts - building blocks of UIMessage content: string; ``` -Defined in: [types.ts:238](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L238) +Defined in: [types.ts:301](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L301) *** @@ -33,7 +33,7 @@ Defined in: [types.ts:238](https://github.com/TanStack/ai/blob/main/packages/typ optional metadata: TMetadata; ``` -Defined in: [types.ts:239](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L239) +Defined in: [types.ts:302](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L302) *** @@ -43,4 +43,4 @@ Defined in: [types.ts:239](https://github.com/TanStack/ai/blob/main/packages/typ type: "text"; ``` -Defined in: [types.ts:237](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L237) +Defined in: [types.ts:300](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L300) diff --git a/docs/reference/interfaces/ThinkingPart.md b/docs/reference/interfaces/ThinkingPart.md index 72f8e9da..7545e966 100644 --- a/docs/reference/interfaces/ThinkingPart.md +++ b/docs/reference/interfaces/ThinkingPart.md @@ -5,7 +5,7 @@ title: ThinkingPart # Interface: ThinkingPart -Defined in: [types.ts:266](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L266) +Defined in: [types.ts:329](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L329) ## Properties @@ -15,7 +15,7 @@ Defined in: [types.ts:266](https://github.com/TanStack/ai/blob/main/packages/typ content: string; ``` -Defined in: [types.ts:268](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L268) +Defined in: [types.ts:331](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L331) *** @@ -25,4 +25,4 @@ Defined in: [types.ts:268](https://github.com/TanStack/ai/blob/main/packages/typ type: "thinking"; ``` -Defined in: [types.ts:267](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L267) +Defined in: [types.ts:330](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L330) diff --git a/docs/reference/interfaces/ThinkingStreamChunk.md b/docs/reference/interfaces/ThinkingStreamChunk.md index d67abbe0..78659955 100644 --- a/docs/reference/interfaces/ThinkingStreamChunk.md +++ b/docs/reference/interfaces/ThinkingStreamChunk.md @@ -5,7 +5,7 @@ title: ThinkingStreamChunk # Interface: ThinkingStreamChunk -Defined in: [types.ts:663](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L663) +Defined in: [types.ts:726](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L726) ## Extends @@ -19,7 +19,7 @@ Defined in: [types.ts:663](https://github.com/TanStack/ai/blob/main/packages/typ content: string; ``` -Defined in: [types.ts:666](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L666) +Defined in: [types.ts:729](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L729) *** @@ -29,7 +29,7 @@ Defined in: [types.ts:666](https://github.com/TanStack/ai/blob/main/packages/typ optional delta: string; ``` -Defined in: [types.ts:665](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L665) +Defined in: [types.ts:728](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L728) *** @@ -39,7 +39,7 @@ Defined in: [types.ts:665](https://github.com/TanStack/ai/blob/main/packages/typ id: string; ``` -Defined in: [types.ts:596](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L596) +Defined in: [types.ts:659](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L659) #### Inherited from @@ -53,7 +53,7 @@ Defined in: [types.ts:596](https://github.com/TanStack/ai/blob/main/packages/typ model: string; ``` -Defined in: [types.ts:597](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L597) +Defined in: [types.ts:660](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L660) #### Inherited from @@ -67,7 +67,7 @@ Defined in: [types.ts:597](https://github.com/TanStack/ai/blob/main/packages/typ timestamp: number; ``` -Defined in: [types.ts:598](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L598) +Defined in: [types.ts:661](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L661) #### Inherited from @@ -81,7 +81,7 @@ Defined in: [types.ts:598](https://github.com/TanStack/ai/blob/main/packages/typ type: "thinking"; ``` -Defined in: [types.ts:664](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L664) +Defined in: [types.ts:727](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L727) #### Overrides diff --git a/docs/reference/interfaces/Tool.md b/docs/reference/interfaces/Tool.md index 245373b1..75883d49 100644 --- a/docs/reference/interfaces/Tool.md +++ b/docs/reference/interfaces/Tool.md @@ -5,7 +5,7 @@ title: Tool # Interface: Tool\ -Defined in: [types.ts:320](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L320) +Defined in: [types.ts:377](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L377) Tool/Function definition for function calling. @@ -46,7 +46,7 @@ Tools can use either Zod schemas or JSON Schema objects for runtime validation a description: string; ``` -Defined in: [types.ts:343](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L343) +Defined in: [types.ts:400](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L400) Clear description of what the tool does. @@ -67,7 +67,7 @@ Be specific about what the tool does, what parameters it needs, and what it retu optional execute: (args) => any; ``` -Defined in: [types.ts:414](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L414) +Defined in: [types.ts:471](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L471) Optional function to execute when the model calls this tool. @@ -107,7 +107,7 @@ execute: async (args) => { optional inputSchema: TInput; ``` -Defined in: [types.ts:375](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L375) +Defined in: [types.ts:432](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L432) Schema describing the tool's input parameters. @@ -152,7 +152,7 @@ z.object({ optional metadata: Record; ``` -Defined in: [types.ts:420](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L420) +Defined in: [types.ts:477](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L477) Additional metadata for adapters or custom extensions @@ -164,7 +164,7 @@ Additional metadata for adapters or custom extensions name: TName; ``` -Defined in: [types.ts:333](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L333) +Defined in: [types.ts:390](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L390) Unique name of the tool (used by the model to call it). @@ -185,7 +185,7 @@ Must be unique within the tools array. optional needsApproval: boolean; ``` -Defined in: [types.ts:417](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L417) +Defined in: [types.ts:474](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L474) If true, tool execution requires user approval before running. Works with both server and client tools. @@ -197,7 +197,7 @@ If true, tool execution requires user approval before running. Works with both s optional outputSchema: TOutput; ``` -Defined in: [types.ts:395](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L395) +Defined in: [types.ts:452](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L452) Optional schema for validating tool output. diff --git a/docs/reference/interfaces/ToolCall.md b/docs/reference/interfaces/ToolCall.md index 3c479192..e8e31be1 100644 --- a/docs/reference/interfaces/ToolCall.md +++ b/docs/reference/interfaces/ToolCall.md @@ -5,7 +5,7 @@ title: ToolCall # Interface: ToolCall -Defined in: [types.ts:62](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L62) +Defined in: [types.ts:138](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L138) ## Properties @@ -15,7 +15,7 @@ Defined in: [types.ts:62](https://github.com/TanStack/ai/blob/main/packages/type function: object; ``` -Defined in: [types.ts:65](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L65) +Defined in: [types.ts:141](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L141) #### arguments @@ -37,7 +37,7 @@ name: string; id: string; ``` -Defined in: [types.ts:63](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L63) +Defined in: [types.ts:139](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L139) *** @@ -47,4 +47,4 @@ Defined in: [types.ts:63](https://github.com/TanStack/ai/blob/main/packages/type type: "function"; ``` -Defined in: [types.ts:64](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L64) +Defined in: [types.ts:140](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L140) diff --git a/docs/reference/interfaces/ToolCallPart.md b/docs/reference/interfaces/ToolCallPart.md index f46e12f4..4dc8b2de 100644 --- a/docs/reference/interfaces/ToolCallPart.md +++ b/docs/reference/interfaces/ToolCallPart.md @@ -5,7 +5,7 @@ title: ToolCallPart # Interface: ToolCallPart -Defined in: [types.ts:242](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L242) +Defined in: [types.ts:305](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L305) ## Properties @@ -15,7 +15,7 @@ Defined in: [types.ts:242](https://github.com/TanStack/ai/blob/main/packages/typ optional approval: object; ``` -Defined in: [types.ts:249](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L249) +Defined in: [types.ts:312](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L312) Approval metadata if tool requires user approval @@ -45,7 +45,7 @@ needsApproval: boolean; arguments: string; ``` -Defined in: [types.ts:246](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L246) +Defined in: [types.ts:309](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L309) *** @@ -55,7 +55,7 @@ Defined in: [types.ts:246](https://github.com/TanStack/ai/blob/main/packages/typ id: string; ``` -Defined in: [types.ts:244](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L244) +Defined in: [types.ts:307](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L307) *** @@ -65,7 +65,7 @@ Defined in: [types.ts:244](https://github.com/TanStack/ai/blob/main/packages/typ name: string; ``` -Defined in: [types.ts:245](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L245) +Defined in: [types.ts:308](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L308) *** @@ -75,7 +75,7 @@ Defined in: [types.ts:245](https://github.com/TanStack/ai/blob/main/packages/typ optional output: any; ``` -Defined in: [types.ts:255](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L255) +Defined in: [types.ts:318](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L318) Tool execution output (for client tools or after approval) @@ -87,7 +87,7 @@ Tool execution output (for client tools or after approval) state: ToolCallState; ``` -Defined in: [types.ts:247](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L247) +Defined in: [types.ts:310](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L310) *** @@ -97,4 +97,4 @@ Defined in: [types.ts:247](https://github.com/TanStack/ai/blob/main/packages/typ type: "tool-call"; ``` -Defined in: [types.ts:243](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L243) +Defined in: [types.ts:306](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L306) diff --git a/docs/reference/interfaces/ToolCallStreamChunk.md b/docs/reference/interfaces/ToolCallStreamChunk.md index 1f5ab343..1df60390 100644 --- a/docs/reference/interfaces/ToolCallStreamChunk.md +++ b/docs/reference/interfaces/ToolCallStreamChunk.md @@ -5,7 +5,7 @@ title: ToolCallStreamChunk # Interface: ToolCallStreamChunk -Defined in: [types.ts:608](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L608) +Defined in: [types.ts:671](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L671) ## Extends @@ -19,7 +19,7 @@ Defined in: [types.ts:608](https://github.com/TanStack/ai/blob/main/packages/typ id: string; ``` -Defined in: [types.ts:596](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L596) +Defined in: [types.ts:659](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L659) #### Inherited from @@ -33,7 +33,7 @@ Defined in: [types.ts:596](https://github.com/TanStack/ai/blob/main/packages/typ index: number; ``` -Defined in: [types.ts:618](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L618) +Defined in: [types.ts:681](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L681) *** @@ -43,7 +43,7 @@ Defined in: [types.ts:618](https://github.com/TanStack/ai/blob/main/packages/typ model: string; ``` -Defined in: [types.ts:597](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L597) +Defined in: [types.ts:660](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L660) #### Inherited from @@ -57,7 +57,7 @@ Defined in: [types.ts:597](https://github.com/TanStack/ai/blob/main/packages/typ timestamp: number; ``` -Defined in: [types.ts:598](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L598) +Defined in: [types.ts:661](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L661) #### Inherited from @@ -71,7 +71,7 @@ Defined in: [types.ts:598](https://github.com/TanStack/ai/blob/main/packages/typ toolCall: object; ``` -Defined in: [types.ts:610](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L610) +Defined in: [types.ts:673](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L673) #### function @@ -111,7 +111,7 @@ type: "function"; type: "tool_call"; ``` -Defined in: [types.ts:609](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L609) +Defined in: [types.ts:672](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L672) #### Overrides diff --git a/docs/reference/interfaces/ToolConfig.md b/docs/reference/interfaces/ToolConfig.md index 6caa598f..001188eb 100644 --- a/docs/reference/interfaces/ToolConfig.md +++ b/docs/reference/interfaces/ToolConfig.md @@ -5,7 +5,7 @@ title: ToolConfig # Interface: ToolConfig -Defined in: [types.ts:423](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L423) +Defined in: [types.ts:480](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L480) ## Indexable diff --git a/docs/reference/interfaces/ToolDefinition.md b/docs/reference/interfaces/ToolDefinition.md index 776e614f..30106f9f 100644 --- a/docs/reference/interfaces/ToolDefinition.md +++ b/docs/reference/interfaces/ToolDefinition.md @@ -5,7 +5,7 @@ title: ToolDefinition # Interface: ToolDefinition\ -Defined in: [tools/tool-definition.ts:99](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/tools/tool-definition.ts#L99) +Defined in: [activities/chat/tools/tool-definition.ts:104](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/tools/tool-definition.ts#L104) Tool definition builder that allows creating server or client tools from a shared definition @@ -35,7 +35,7 @@ Tool definition builder that allows creating server or client tools from a share __toolSide: "definition"; ``` -Defined in: [tools/tool-definition.ts:43](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/tools/tool-definition.ts#L43) +Defined in: [activities/chat/tools/tool-definition.ts:48](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/tools/tool-definition.ts#L48) #### Inherited from @@ -49,7 +49,7 @@ Defined in: [tools/tool-definition.ts:43](https://github.com/TanStack/ai/blob/ma client: (execute?) => ClientTool; ``` -Defined in: [tools/tool-definition.ts:116](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/tools/tool-definition.ts#L116) +Defined in: [activities/chat/tools/tool-definition.ts:121](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/tools/tool-definition.ts#L121) Create a client-side tool with optional execute function @@ -73,7 +73,7 @@ Create a client-side tool with optional execute function description: string; ``` -Defined in: [types.ts:343](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L343) +Defined in: [types.ts:400](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L400) Clear description of what the tool does. @@ -98,7 +98,7 @@ Be specific about what the tool does, what parameters it needs, and what it retu optional execute: (args) => any; ``` -Defined in: [types.ts:414](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L414) +Defined in: [types.ts:471](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L471) Optional function to execute when the model calls this tool. @@ -142,7 +142,7 @@ execute: async (args) => { optional inputSchema: TInput; ``` -Defined in: [types.ts:375](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L375) +Defined in: [types.ts:432](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L432) Schema describing the tool's input parameters. @@ -191,7 +191,7 @@ z.object({ optional metadata: Record; ``` -Defined in: [types.ts:420](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L420) +Defined in: [types.ts:477](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L477) Additional metadata for adapters or custom extensions @@ -207,7 +207,7 @@ Additional metadata for adapters or custom extensions name: TName; ``` -Defined in: [types.ts:333](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L333) +Defined in: [types.ts:390](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L390) Unique name of the tool (used by the model to call it). @@ -232,7 +232,7 @@ Must be unique within the tools array. optional needsApproval: boolean; ``` -Defined in: [types.ts:417](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L417) +Defined in: [types.ts:474](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L474) If true, tool execution requires user approval before running. Works with both server and client tools. @@ -248,7 +248,7 @@ If true, tool execution requires user approval before running. Works with both s optional outputSchema: TOutput; ``` -Defined in: [types.ts:395](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L395) +Defined in: [types.ts:452](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L452) Optional schema for validating tool output. @@ -282,7 +282,7 @@ z.object({ server: (execute) => ServerTool; ``` -Defined in: [tools/tool-definition.ts:107](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/tools/tool-definition.ts#L107) +Defined in: [activities/chat/tools/tool-definition.ts:112](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/tools/tool-definition.ts#L112) Create a server-side tool with execute function diff --git a/docs/reference/interfaces/ToolDefinitionConfig.md b/docs/reference/interfaces/ToolDefinitionConfig.md index 7d5c26f5..f35272ef 100644 --- a/docs/reference/interfaces/ToolDefinitionConfig.md +++ b/docs/reference/interfaces/ToolDefinitionConfig.md @@ -5,7 +5,7 @@ title: ToolDefinitionConfig # Interface: ToolDefinitionConfig\ -Defined in: [tools/tool-definition.ts:83](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/tools/tool-definition.ts#L83) +Defined in: [activities/chat/tools/tool-definition.ts:88](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/tools/tool-definition.ts#L88) Tool definition configuration @@ -31,7 +31,7 @@ Tool definition configuration description: string; ``` -Defined in: [tools/tool-definition.ts:89](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/tools/tool-definition.ts#L89) +Defined in: [activities/chat/tools/tool-definition.ts:94](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/tools/tool-definition.ts#L94) *** @@ -41,7 +41,7 @@ Defined in: [tools/tool-definition.ts:89](https://github.com/TanStack/ai/blob/ma optional inputSchema: TInput; ``` -Defined in: [tools/tool-definition.ts:90](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/tools/tool-definition.ts#L90) +Defined in: [activities/chat/tools/tool-definition.ts:95](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/tools/tool-definition.ts#L95) *** @@ -51,7 +51,7 @@ Defined in: [tools/tool-definition.ts:90](https://github.com/TanStack/ai/blob/ma optional metadata: Record; ``` -Defined in: [tools/tool-definition.ts:93](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/tools/tool-definition.ts#L93) +Defined in: [activities/chat/tools/tool-definition.ts:98](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/tools/tool-definition.ts#L98) *** @@ -61,7 +61,7 @@ Defined in: [tools/tool-definition.ts:93](https://github.com/TanStack/ai/blob/ma name: TName; ``` -Defined in: [tools/tool-definition.ts:88](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/tools/tool-definition.ts#L88) +Defined in: [activities/chat/tools/tool-definition.ts:93](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/tools/tool-definition.ts#L93) *** @@ -71,7 +71,7 @@ Defined in: [tools/tool-definition.ts:88](https://github.com/TanStack/ai/blob/ma optional needsApproval: boolean; ``` -Defined in: [tools/tool-definition.ts:92](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/tools/tool-definition.ts#L92) +Defined in: [activities/chat/tools/tool-definition.ts:97](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/tools/tool-definition.ts#L97) *** @@ -81,4 +81,4 @@ Defined in: [tools/tool-definition.ts:92](https://github.com/TanStack/ai/blob/ma optional outputSchema: TOutput; ``` -Defined in: [tools/tool-definition.ts:91](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/tools/tool-definition.ts#L91) +Defined in: [activities/chat/tools/tool-definition.ts:96](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/tools/tool-definition.ts#L96) diff --git a/docs/reference/interfaces/ToolDefinitionInstance.md b/docs/reference/interfaces/ToolDefinitionInstance.md index 7de343d2..0bc4cfc1 100644 --- a/docs/reference/interfaces/ToolDefinitionInstance.md +++ b/docs/reference/interfaces/ToolDefinitionInstance.md @@ -5,7 +5,7 @@ title: ToolDefinitionInstance # Interface: ToolDefinitionInstance\ -Defined in: [tools/tool-definition.ts:38](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/tools/tool-definition.ts#L38) +Defined in: [activities/chat/tools/tool-definition.ts:43](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/tools/tool-definition.ts#L43) Tool definition that can be used directly or instantiated for server/client @@ -39,7 +39,7 @@ Tool definition that can be used directly or instantiated for server/client __toolSide: "definition"; ``` -Defined in: [tools/tool-definition.ts:43](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/tools/tool-definition.ts#L43) +Defined in: [activities/chat/tools/tool-definition.ts:48](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/tools/tool-definition.ts#L48) *** @@ -49,7 +49,7 @@ Defined in: [tools/tool-definition.ts:43](https://github.com/TanStack/ai/blob/ma description: string; ``` -Defined in: [types.ts:343](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L343) +Defined in: [types.ts:400](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L400) Clear description of what the tool does. @@ -74,7 +74,7 @@ Be specific about what the tool does, what parameters it needs, and what it retu optional execute: (args) => any; ``` -Defined in: [types.ts:414](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L414) +Defined in: [types.ts:471](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L471) Optional function to execute when the model calls this tool. @@ -118,7 +118,7 @@ execute: async (args) => { optional inputSchema: TInput; ``` -Defined in: [types.ts:375](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L375) +Defined in: [types.ts:432](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L432) Schema describing the tool's input parameters. @@ -167,7 +167,7 @@ z.object({ optional metadata: Record; ``` -Defined in: [types.ts:420](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L420) +Defined in: [types.ts:477](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L477) Additional metadata for adapters or custom extensions @@ -183,7 +183,7 @@ Additional metadata for adapters or custom extensions name: TName; ``` -Defined in: [types.ts:333](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L333) +Defined in: [types.ts:390](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L390) Unique name of the tool (used by the model to call it). @@ -208,7 +208,7 @@ Must be unique within the tools array. optional needsApproval: boolean; ``` -Defined in: [types.ts:417](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L417) +Defined in: [types.ts:474](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L474) If true, tool execution requires user approval before running. Works with both server and client tools. @@ -224,7 +224,7 @@ If true, tool execution requires user approval before running. Works with both s optional outputSchema: TOutput; ``` -Defined in: [types.ts:395](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L395) +Defined in: [types.ts:452](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L452) Optional schema for validating tool output. diff --git a/docs/reference/interfaces/ToolInputAvailableStreamChunk.md b/docs/reference/interfaces/ToolInputAvailableStreamChunk.md index a7256939..7be2ce58 100644 --- a/docs/reference/interfaces/ToolInputAvailableStreamChunk.md +++ b/docs/reference/interfaces/ToolInputAvailableStreamChunk.md @@ -5,7 +5,7 @@ title: ToolInputAvailableStreamChunk # Interface: ToolInputAvailableStreamChunk -Defined in: [types.ts:656](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L656) +Defined in: [types.ts:719](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L719) ## Extends @@ -19,7 +19,7 @@ Defined in: [types.ts:656](https://github.com/TanStack/ai/blob/main/packages/typ id: string; ``` -Defined in: [types.ts:596](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L596) +Defined in: [types.ts:659](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L659) #### Inherited from @@ -33,7 +33,7 @@ Defined in: [types.ts:596](https://github.com/TanStack/ai/blob/main/packages/typ input: any; ``` -Defined in: [types.ts:660](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L660) +Defined in: [types.ts:723](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L723) *** @@ -43,7 +43,7 @@ Defined in: [types.ts:660](https://github.com/TanStack/ai/blob/main/packages/typ model: string; ``` -Defined in: [types.ts:597](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L597) +Defined in: [types.ts:660](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L660) #### Inherited from @@ -57,7 +57,7 @@ Defined in: [types.ts:597](https://github.com/TanStack/ai/blob/main/packages/typ timestamp: number; ``` -Defined in: [types.ts:598](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L598) +Defined in: [types.ts:661](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L661) #### Inherited from @@ -71,7 +71,7 @@ Defined in: [types.ts:598](https://github.com/TanStack/ai/blob/main/packages/typ toolCallId: string; ``` -Defined in: [types.ts:658](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L658) +Defined in: [types.ts:721](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L721) *** @@ -81,7 +81,7 @@ Defined in: [types.ts:658](https://github.com/TanStack/ai/blob/main/packages/typ toolName: string; ``` -Defined in: [types.ts:659](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L659) +Defined in: [types.ts:722](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L722) *** @@ -91,7 +91,7 @@ Defined in: [types.ts:659](https://github.com/TanStack/ai/blob/main/packages/typ type: "tool-input-available"; ``` -Defined in: [types.ts:657](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L657) +Defined in: [types.ts:720](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L720) #### Overrides diff --git a/docs/reference/interfaces/ToolResultPart.md b/docs/reference/interfaces/ToolResultPart.md index 95676b00..9caa2264 100644 --- a/docs/reference/interfaces/ToolResultPart.md +++ b/docs/reference/interfaces/ToolResultPart.md @@ -5,7 +5,7 @@ title: ToolResultPart # Interface: ToolResultPart -Defined in: [types.ts:258](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L258) +Defined in: [types.ts:321](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L321) ## Properties @@ -15,7 +15,7 @@ Defined in: [types.ts:258](https://github.com/TanStack/ai/blob/main/packages/typ content: string; ``` -Defined in: [types.ts:261](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L261) +Defined in: [types.ts:324](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L324) *** @@ -25,7 +25,7 @@ Defined in: [types.ts:261](https://github.com/TanStack/ai/blob/main/packages/typ optional error: string; ``` -Defined in: [types.ts:263](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L263) +Defined in: [types.ts:326](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L326) *** @@ -35,7 +35,7 @@ Defined in: [types.ts:263](https://github.com/TanStack/ai/blob/main/packages/typ state: ToolResultState; ``` -Defined in: [types.ts:262](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L262) +Defined in: [types.ts:325](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L325) *** @@ -45,7 +45,7 @@ Defined in: [types.ts:262](https://github.com/TanStack/ai/blob/main/packages/typ toolCallId: string; ``` -Defined in: [types.ts:260](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L260) +Defined in: [types.ts:323](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L323) *** @@ -55,4 +55,4 @@ Defined in: [types.ts:260](https://github.com/TanStack/ai/blob/main/packages/typ type: "tool-result"; ``` -Defined in: [types.ts:259](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L259) +Defined in: [types.ts:322](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L322) diff --git a/docs/reference/interfaces/ToolResultStreamChunk.md b/docs/reference/interfaces/ToolResultStreamChunk.md index e5f728a7..2562ffe0 100644 --- a/docs/reference/interfaces/ToolResultStreamChunk.md +++ b/docs/reference/interfaces/ToolResultStreamChunk.md @@ -5,7 +5,7 @@ title: ToolResultStreamChunk # Interface: ToolResultStreamChunk -Defined in: [types.ts:621](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L621) +Defined in: [types.ts:684](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L684) ## Extends @@ -19,7 +19,7 @@ Defined in: [types.ts:621](https://github.com/TanStack/ai/blob/main/packages/typ content: string; ``` -Defined in: [types.ts:624](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L624) +Defined in: [types.ts:687](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L687) *** @@ -29,7 +29,7 @@ Defined in: [types.ts:624](https://github.com/TanStack/ai/blob/main/packages/typ id: string; ``` -Defined in: [types.ts:596](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L596) +Defined in: [types.ts:659](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L659) #### Inherited from @@ -43,7 +43,7 @@ Defined in: [types.ts:596](https://github.com/TanStack/ai/blob/main/packages/typ model: string; ``` -Defined in: [types.ts:597](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L597) +Defined in: [types.ts:660](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L660) #### Inherited from @@ -57,7 +57,7 @@ Defined in: [types.ts:597](https://github.com/TanStack/ai/blob/main/packages/typ timestamp: number; ``` -Defined in: [types.ts:598](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L598) +Defined in: [types.ts:661](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L661) #### Inherited from @@ -71,7 +71,7 @@ Defined in: [types.ts:598](https://github.com/TanStack/ai/blob/main/packages/typ toolCallId: string; ``` -Defined in: [types.ts:623](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L623) +Defined in: [types.ts:686](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L686) *** @@ -81,7 +81,7 @@ Defined in: [types.ts:623](https://github.com/TanStack/ai/blob/main/packages/typ type: "tool_result"; ``` -Defined in: [types.ts:622](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L622) +Defined in: [types.ts:685](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L685) #### Overrides diff --git a/docs/reference/interfaces/TranscriptionOptions.md b/docs/reference/interfaces/TranscriptionOptions.md new file mode 100644 index 00000000..d477fb61 --- /dev/null +++ b/docs/reference/interfaces/TranscriptionOptions.md @@ -0,0 +1,89 @@ +--- +id: TranscriptionOptions +title: TranscriptionOptions +--- + +# Interface: TranscriptionOptions\ + +Defined in: [types.ts:948](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L948) + +Options for audio transcription. +These are the common options supported across providers. + +## Type Parameters + +### TProviderOptions + +`TProviderOptions` *extends* `object` = `object` + +## Properties + +### audio + +```ts +audio: string | File | Blob | ArrayBuffer; +``` + +Defined in: [types.ts:954](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L954) + +The audio data to transcribe - can be base64 string, File, Blob, or Buffer + +*** + +### language? + +```ts +optional language: string; +``` + +Defined in: [types.ts:956](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L956) + +The language of the audio in ISO-639-1 format (e.g., 'en') + +*** + +### model + +```ts +model: string; +``` + +Defined in: [types.ts:952](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L952) + +The model to use for transcription + +*** + +### modelOptions? + +```ts +optional modelOptions: TProviderOptions; +``` + +Defined in: [types.ts:962](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L962) + +Model-specific options for transcription + +*** + +### prompt? + +```ts +optional prompt: string; +``` + +Defined in: [types.ts:958](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L958) + +An optional prompt to guide the transcription + +*** + +### responseFormat? + +```ts +optional responseFormat: "text" | "json" | "srt" | "verbose_json" | "vtt"; +``` + +Defined in: [types.ts:960](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L960) + +The format of the transcription output diff --git a/docs/reference/interfaces/TranscriptionResult.md b/docs/reference/interfaces/TranscriptionResult.md new file mode 100644 index 00000000..6f90d295 --- /dev/null +++ b/docs/reference/interfaces/TranscriptionResult.md @@ -0,0 +1,94 @@ +--- +id: TranscriptionResult +title: TranscriptionResult +--- + +# Interface: TranscriptionResult + +Defined in: [types.ts:998](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L998) + +Result of audio transcription. + +## Properties + +### duration? + +```ts +optional duration: number; +``` + +Defined in: [types.ts:1008](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L1008) + +Duration of the audio in seconds + +*** + +### id + +```ts +id: string; +``` + +Defined in: [types.ts:1000](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L1000) + +Unique identifier for the transcription + +*** + +### language? + +```ts +optional language: string; +``` + +Defined in: [types.ts:1006](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L1006) + +Language detected or specified + +*** + +### model + +```ts +model: string; +``` + +Defined in: [types.ts:1002](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L1002) + +Model used for transcription + +*** + +### segments? + +```ts +optional segments: TranscriptionSegment[]; +``` + +Defined in: [types.ts:1010](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L1010) + +Detailed segments with timing, if available + +*** + +### text + +```ts +text: string; +``` + +Defined in: [types.ts:1004](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L1004) + +The full transcribed text + +*** + +### words? + +```ts +optional words: TranscriptionWord[]; +``` + +Defined in: [types.ts:1012](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L1012) + +Word-level timestamps, if available diff --git a/docs/reference/interfaces/TranscriptionSegment.md b/docs/reference/interfaces/TranscriptionSegment.md new file mode 100644 index 00000000..51bb521a --- /dev/null +++ b/docs/reference/interfaces/TranscriptionSegment.md @@ -0,0 +1,82 @@ +--- +id: TranscriptionSegment +title: TranscriptionSegment +--- + +# Interface: TranscriptionSegment + +Defined in: [types.ts:968](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L968) + +A single segment of transcribed audio with timing information. + +## Properties + +### confidence? + +```ts +optional confidence: number; +``` + +Defined in: [types.ts:978](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L978) + +Confidence score (0-1), if available + +*** + +### end + +```ts +end: number; +``` + +Defined in: [types.ts:974](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L974) + +End time of the segment in seconds + +*** + +### id + +```ts +id: number; +``` + +Defined in: [types.ts:970](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L970) + +Unique identifier for the segment + +*** + +### speaker? + +```ts +optional speaker: string; +``` + +Defined in: [types.ts:980](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L980) + +Speaker identifier, if diarization is enabled + +*** + +### start + +```ts +start: number; +``` + +Defined in: [types.ts:972](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L972) + +Start time of the segment in seconds + +*** + +### text + +```ts +text: string; +``` + +Defined in: [types.ts:976](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L976) + +Transcribed text for this segment diff --git a/docs/reference/interfaces/TranscriptionWord.md b/docs/reference/interfaces/TranscriptionWord.md new file mode 100644 index 00000000..1ffc2037 --- /dev/null +++ b/docs/reference/interfaces/TranscriptionWord.md @@ -0,0 +1,46 @@ +--- +id: TranscriptionWord +title: TranscriptionWord +--- + +# Interface: TranscriptionWord + +Defined in: [types.ts:986](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L986) + +A single word with timing information. + +## Properties + +### end + +```ts +end: number; +``` + +Defined in: [types.ts:992](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L992) + +End time in seconds + +*** + +### start + +```ts +start: number; +``` + +Defined in: [types.ts:990](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L990) + +Start time in seconds + +*** + +### word + +```ts +word: string; +``` + +Defined in: [types.ts:988](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L988) + +The transcribed word diff --git a/docs/reference/interfaces/UIMessage.md b/docs/reference/interfaces/UIMessage.md index a4119372..ff70329a 100644 --- a/docs/reference/interfaces/UIMessage.md +++ b/docs/reference/interfaces/UIMessage.md @@ -5,7 +5,7 @@ title: UIMessage # Interface: UIMessage -Defined in: [types.ts:281](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L281) +Defined in: [types.ts:344](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L344) UIMessage - Domain-specific message format optimized for building chat UIs Contains parts that can be text, tool calls, or tool results @@ -18,7 +18,7 @@ Contains parts that can be text, tool calls, or tool results optional createdAt: Date; ``` -Defined in: [types.ts:285](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L285) +Defined in: [types.ts:348](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L348) *** @@ -28,7 +28,7 @@ Defined in: [types.ts:285](https://github.com/TanStack/ai/blob/main/packages/typ id: string; ``` -Defined in: [types.ts:282](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L282) +Defined in: [types.ts:345](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L345) *** @@ -38,7 +38,7 @@ Defined in: [types.ts:282](https://github.com/TanStack/ai/blob/main/packages/typ parts: MessagePart[]; ``` -Defined in: [types.ts:284](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L284) +Defined in: [types.ts:347](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L347) *** @@ -48,4 +48,4 @@ Defined in: [types.ts:284](https://github.com/TanStack/ai/blob/main/packages/typ role: "user" | "assistant" | "system"; ``` -Defined in: [types.ts:283](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L283) +Defined in: [types.ts:346](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L346) diff --git a/docs/reference/interfaces/VideoGenerationOptions.md b/docs/reference/interfaces/VideoGenerationOptions.md new file mode 100644 index 00000000..b698ceca --- /dev/null +++ b/docs/reference/interfaces/VideoGenerationOptions.md @@ -0,0 +1,91 @@ +--- +id: VideoGenerationOptions +title: VideoGenerationOptions +--- + +# Interface: VideoGenerationOptions\ + +Defined in: [types.ts:842](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L842) + +**`Experimental`** + +Options for video generation. +These are the common options supported across providers. + + Video generation is an experimental feature and may change. + +## Type Parameters + +### TProviderOptions + +`TProviderOptions` *extends* `object` = `object` + +## Properties + +### duration? + +```ts +optional duration: number; +``` + +Defined in: [types.ts:852](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L852) + +**`Experimental`** + +Video duration in seconds + +*** + +### model + +```ts +model: string; +``` + +Defined in: [types.ts:846](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L846) + +**`Experimental`** + +The model to use for video generation + +*** + +### modelOptions? + +```ts +optional modelOptions: TProviderOptions; +``` + +Defined in: [types.ts:854](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L854) + +**`Experimental`** + +Model-specific options for video generation + +*** + +### prompt + +```ts +prompt: string; +``` + +Defined in: [types.ts:848](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L848) + +**`Experimental`** + +Text description of the desired video + +*** + +### size? + +```ts +optional size: string; +``` + +Defined in: [types.ts:850](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L850) + +**`Experimental`** + +Video size in WIDTHxHEIGHT format (e.g., "1280x720") diff --git a/docs/reference/interfaces/VideoJobResult.md b/docs/reference/interfaces/VideoJobResult.md new file mode 100644 index 00000000..d6f82646 --- /dev/null +++ b/docs/reference/interfaces/VideoJobResult.md @@ -0,0 +1,42 @@ +--- +id: VideoJobResult +title: VideoJobResult +--- + +# Interface: VideoJobResult + +Defined in: [types.ts:862](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L862) + +**`Experimental`** + +Result of creating a video generation job. + + Video generation is an experimental feature and may change. + +## Properties + +### jobId + +```ts +jobId: string; +``` + +Defined in: [types.ts:864](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L864) + +**`Experimental`** + +Unique job identifier for polling status + +*** + +### model + +```ts +model: string; +``` + +Defined in: [types.ts:866](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L866) + +**`Experimental`** + +Model used for generation diff --git a/docs/reference/interfaces/VideoPart.md b/docs/reference/interfaces/VideoPart.md index 1b3e7063..e95859c0 100644 --- a/docs/reference/interfaces/VideoPart.md +++ b/docs/reference/interfaces/VideoPart.md @@ -5,7 +5,7 @@ title: VideoPart # Interface: VideoPart\ -Defined in: [types.ts:132](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L132) +Defined in: [types.ts:208](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L208) Video content part for multimodal messages. @@ -25,7 +25,7 @@ Provider-specific metadata type optional metadata: TMetadata; ``` -Defined in: [types.ts:137](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L137) +Defined in: [types.ts:213](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L213) Provider-specific metadata (e.g., duration, resolution) @@ -37,7 +37,7 @@ Provider-specific metadata (e.g., duration, resolution) source: ContentPartSource; ``` -Defined in: [types.ts:135](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L135) +Defined in: [types.ts:211](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L211) Source of the video content @@ -49,4 +49,4 @@ Source of the video content type: "video"; ``` -Defined in: [types.ts:133](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L133) +Defined in: [types.ts:209](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L209) diff --git a/docs/reference/interfaces/VideoStatusResult.md b/docs/reference/interfaces/VideoStatusResult.md new file mode 100644 index 00000000..a0526318 --- /dev/null +++ b/docs/reference/interfaces/VideoStatusResult.md @@ -0,0 +1,70 @@ +--- +id: VideoStatusResult +title: VideoStatusResult +--- + +# Interface: VideoStatusResult + +Defined in: [types.ts:874](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L874) + +**`Experimental`** + +Status of a video generation job. + + Video generation is an experimental feature and may change. + +## Properties + +### error? + +```ts +optional error: string; +``` + +Defined in: [types.ts:882](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L882) + +**`Experimental`** + +Error message if status is 'failed' + +*** + +### jobId + +```ts +jobId: string; +``` + +Defined in: [types.ts:876](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L876) + +**`Experimental`** + +Job identifier + +*** + +### progress? + +```ts +optional progress: number; +``` + +Defined in: [types.ts:880](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L880) + +**`Experimental`** + +Progress percentage (0-100), if available + +*** + +### status + +```ts +status: "pending" | "processing" | "completed" | "failed"; +``` + +Defined in: [types.ts:878](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L878) + +**`Experimental`** + +Current status of the job diff --git a/docs/reference/interfaces/VideoUrlResult.md b/docs/reference/interfaces/VideoUrlResult.md new file mode 100644 index 00000000..4a79f0c4 --- /dev/null +++ b/docs/reference/interfaces/VideoUrlResult.md @@ -0,0 +1,56 @@ +--- +id: VideoUrlResult +title: VideoUrlResult +--- + +# Interface: VideoUrlResult + +Defined in: [types.ts:890](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L890) + +**`Experimental`** + +Result containing the URL to a generated video. + + Video generation is an experimental feature and may change. + +## Properties + +### expiresAt? + +```ts +optional expiresAt: Date; +``` + +Defined in: [types.ts:896](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L896) + +**`Experimental`** + +When the URL expires, if applicable + +*** + +### jobId + +```ts +jobId: string; +``` + +Defined in: [types.ts:892](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L892) + +**`Experimental`** + +Job identifier + +*** + +### url + +```ts +url: string; +``` + +Defined in: [types.ts:894](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L894) + +**`Experimental`** + +URL to the generated video diff --git a/docs/reference/type-aliases/AIAdapter.md b/docs/reference/type-aliases/AIAdapter.md new file mode 100644 index 00000000..ef7f5f5c --- /dev/null +++ b/docs/reference/type-aliases/AIAdapter.md @@ -0,0 +1,20 @@ +--- +id: AIAdapter +title: AIAdapter +--- + +# Type Alias: AIAdapter + +```ts +type AIAdapter = + | AnyTextAdapter + | AnySummarizeAdapter + | AnyImageAdapter + | AnyVideoAdapter + | AnyTTSAdapter + | AnyTranscriptionAdapter; +``` + +Defined in: [activities/index.ts:149](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/index.ts#L149) + +Union of all adapter types that can be passed to chat() diff --git a/docs/reference/type-aliases/AgentLoopStrategy.md b/docs/reference/type-aliases/AgentLoopStrategy.md index 96bdb2cb..b128de9b 100644 --- a/docs/reference/type-aliases/AgentLoopStrategy.md +++ b/docs/reference/type-aliases/AgentLoopStrategy.md @@ -9,7 +9,7 @@ title: AgentLoopStrategy type AgentLoopStrategy = (state) => boolean; ``` -Defined in: [types.ts:543](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L543) +Defined in: [types.ts:600](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L600) Strategy function that determines whether the agent loop should continue diff --git a/docs/reference/type-aliases/AnyClientTool.md b/docs/reference/type-aliases/AnyClientTool.md index 4f395412..bbbf59ec 100644 --- a/docs/reference/type-aliases/AnyClientTool.md +++ b/docs/reference/type-aliases/AnyClientTool.md @@ -11,6 +11,6 @@ type AnyClientTool = | ToolDefinitionInstance; ``` -Defined in: [tools/tool-definition.ts:49](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/tools/tool-definition.ts#L49) +Defined in: [activities/chat/tools/tool-definition.ts:54](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/tools/tool-definition.ts#L54) Union type for any kind of client-side tool (client tool or definition) diff --git a/docs/reference/type-aliases/ConstrainedContent.md b/docs/reference/type-aliases/ConstrainedContent.md index 9d430559..1ed97e63 100644 --- a/docs/reference/type-aliases/ConstrainedContent.md +++ b/docs/reference/type-aliases/ConstrainedContent.md @@ -3,42 +3,22 @@ id: ConstrainedContent title: ConstrainedContent --- -# Type Alias: ConstrainedContent\ +# Type Alias: ConstrainedContent\ ```ts -type ConstrainedContent = +type ConstrainedContent = | string | null - | ContentPartForModalities, TImageMeta, TAudioMeta, TVideoMeta, TDocumentMeta, TTextMeta>[]; + | ContentPartForInputModalitiesTypes[]; ``` -Defined in: [types.ts:199](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L199) +Defined in: [types.ts:276](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L276) Type for message content constrained by supported modalities. When modalities is ['text', 'image'], only TextPart and ImagePart are allowed in the array. ## Type Parameters -### TModalities +### TInputModalitiesTypes -`TModalities` *extends* `ReadonlyArray`\<[`Modality`](Modality.md)\> - -### TImageMeta - -`TImageMeta` = `unknown` - -### TAudioMeta - -`TAudioMeta` = `unknown` - -### TVideoMeta - -`TVideoMeta` = `unknown` - -### TDocumentMeta - -`TDocumentMeta` = `unknown` - -### TTextMeta - -`TTextMeta` = `unknown` +`TInputModalitiesTypes` *extends* [`InputModalitiesTypes`](InputModalitiesTypes.md) diff --git a/docs/reference/type-aliases/ConstrainedModelMessage.md b/docs/reference/type-aliases/ConstrainedModelMessage.md index c3f78bd2..83928cb1 100644 --- a/docs/reference/type-aliases/ConstrainedModelMessage.md +++ b/docs/reference/type-aliases/ConstrainedModelMessage.md @@ -3,13 +3,13 @@ id: ConstrainedModelMessage title: ConstrainedModelMessage --- -# Type Alias: ConstrainedModelMessage\ +# Type Alias: ConstrainedModelMessage\ ```ts -type ConstrainedModelMessage = Omit & object; +type ConstrainedModelMessage = Omit & object; ``` -Defined in: [types.ts:291](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L291) +Defined in: [types.ts:360](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L360) A ModelMessage with content constrained to only allow content parts matching the specified input modalities. @@ -19,31 +19,11 @@ matching the specified input modalities. ### content ```ts -content: ConstrainedContent; +content: ConstrainedContent; ``` ## Type Parameters -### TModalities +### TInputModalitiesTypes -`TModalities` *extends* `ReadonlyArray`\<[`Modality`](Modality.md)\> - -### TImageMeta - -`TImageMeta` = `unknown` - -### TAudioMeta - -`TAudioMeta` = `unknown` - -### TVideoMeta - -`TVideoMeta` = `unknown` - -### TDocumentMeta - -`TDocumentMeta` = `unknown` - -### TTextMeta - -`TTextMeta` = `unknown` +`TInputModalitiesTypes` *extends* [`InputModalitiesTypes`](InputModalitiesTypes.md) diff --git a/docs/reference/type-aliases/ContentPart.md b/docs/reference/type-aliases/ContentPart.md index 783073c9..b7e148c4 100644 --- a/docs/reference/type-aliases/ContentPart.md +++ b/docs/reference/type-aliases/ContentPart.md @@ -3,10 +3,10 @@ id: ContentPart title: ContentPart --- -# Type Alias: ContentPart\ +# Type Alias: ContentPart\ ```ts -type ContentPart = +type ContentPart = | TextPart | ImagePart | AudioPart @@ -14,12 +14,16 @@ type ContentPart = | DocumentPart; ``` -Defined in: [types.ts:159](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L159) +Defined in: [types.ts:235](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L235) Union type for all multimodal content parts. ## Type Parameters +### TTextMeta + +`TTextMeta` = `unknown` + ### TImageMeta `TImageMeta` = `unknown` @@ -43,7 +47,3 @@ Provider-specific video metadata type `TDocumentMeta` = `unknown` Provider-specific document metadata type - -### TTextMeta - -`TTextMeta` = `unknown` diff --git a/docs/reference/type-aliases/ContentPartForInputModalitiesTypes.md b/docs/reference/type-aliases/ContentPartForInputModalitiesTypes.md new file mode 100644 index 00000000..ce05b0ad --- /dev/null +++ b/docs/reference/type-aliases/ContentPartForInputModalitiesTypes.md @@ -0,0 +1,23 @@ +--- +id: ContentPartForInputModalitiesTypes +title: ContentPartForInputModalitiesTypes +--- + +# Type Alias: ContentPartForInputModalitiesTypes\ + +```ts +type ContentPartForInputModalitiesTypes = Extract, { + type: TInputModalitiesTypes["inputModalities"][number]; +}>; +``` + +Defined in: [types.ts:252](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L252) + +Helper type to filter ContentPart union to only include specific modalities. +Used to constrain message content based on model capabilities. + +## Type Parameters + +### TInputModalitiesTypes + +`TInputModalitiesTypes` *extends* [`InputModalitiesTypes`](InputModalitiesTypes.md) diff --git a/docs/reference/type-aliases/ContentPartForModalities.md b/docs/reference/type-aliases/ContentPartForModalities.md deleted file mode 100644 index d653bbcd..00000000 --- a/docs/reference/type-aliases/ContentPartForModalities.md +++ /dev/null @@ -1,43 +0,0 @@ ---- -id: ContentPartForModalities -title: ContentPartForModalities ---- - -# Type Alias: ContentPartForModalities\ - -```ts -type ContentPartForModalities = Extract, { - type: TModalities; -}>; -``` - -Defined in: [types.ts:176](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L176) - -Helper type to filter ContentPart union to only include specific modalities. -Used to constrain message content based on model capabilities. - -## Type Parameters - -### TModalities - -`TModalities` *extends* [`Modality`](Modality.md) - -### TImageMeta - -`TImageMeta` = `unknown` - -### TAudioMeta - -`TAudioMeta` = `unknown` - -### TVideoMeta - -`TVideoMeta` = `unknown` - -### TDocumentMeta - -`TDocumentMeta` = `unknown` - -### TTextMeta - -`TTextMeta` = `unknown` diff --git a/docs/reference/type-aliases/ExtractModalitiesForModel.md b/docs/reference/type-aliases/ExtractModalitiesForModel.md deleted file mode 100644 index fe165380..00000000 --- a/docs/reference/type-aliases/ExtractModalitiesForModel.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -id: ExtractModalitiesForModel -title: ExtractModalitiesForModel ---- - -# Type Alias: ExtractModalitiesForModel\ - -```ts -type ExtractModalitiesForModel = TAdapter extends AIAdapter ? TModel extends keyof ModelInputModalities ? ModelInputModalities[TModel] : ReadonlyArray : ReadonlyArray; -``` - -Defined in: [types.ts:942](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L942) - -Extract the supported input modalities for a specific model from an adapter. - -## Type Parameters - -### TAdapter - -`TAdapter` *extends* [`AIAdapter`](../interfaces/AIAdapter.md)\<`any`, `any`, `any`, `any`, `any`, `any`\> - -### TModel - -`TModel` *extends* `string` diff --git a/docs/reference/type-aliases/ExtractModelsFromAdapter.md b/docs/reference/type-aliases/ExtractModelsFromAdapter.md deleted file mode 100644 index 7b1edfb0..00000000 --- a/docs/reference/type-aliases/ExtractModelsFromAdapter.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -id: ExtractModelsFromAdapter -title: ExtractModelsFromAdapter ---- - -# Type Alias: ExtractModelsFromAdapter\ - -```ts -type ExtractModelsFromAdapter = T extends AIAdapter ? M[number] : never; -``` - -Defined in: [types.ts:936](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L936) - -## Type Parameters - -### T - -`T` diff --git a/docs/reference/type-aliases/InferSchemaType.md b/docs/reference/type-aliases/InferSchemaType.md index 50d9cf8d..5fdb94bb 100644 --- a/docs/reference/type-aliases/InferSchemaType.md +++ b/docs/reference/type-aliases/InferSchemaType.md @@ -9,7 +9,7 @@ title: InferSchemaType type InferSchemaType = T extends z.ZodType ? z.infer : any; ``` -Defined in: [types.ts:60](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L60) +Defined in: [types.ts:136](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L136) Infer the TypeScript type from a schema. For Zod schemas, uses z.infer to get the proper type. diff --git a/docs/reference/type-aliases/InferToolInput.md b/docs/reference/type-aliases/InferToolInput.md index 9caf3099..0975434e 100644 --- a/docs/reference/type-aliases/InferToolInput.md +++ b/docs/reference/type-aliases/InferToolInput.md @@ -9,7 +9,7 @@ title: InferToolInput type InferToolInput = T extends object ? TInput extends z.ZodType ? z.infer : TInput extends JSONSchema ? any : any : any; ``` -Defined in: [tools/tool-definition.ts:61](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/tools/tool-definition.ts#L61) +Defined in: [activities/chat/tools/tool-definition.ts:66](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/tools/tool-definition.ts#L66) Extract the input type from a tool (inferred from Zod schema, or `any` for JSONSchema) diff --git a/docs/reference/type-aliases/InferToolName.md b/docs/reference/type-aliases/InferToolName.md index 25b0aa93..c656c060 100644 --- a/docs/reference/type-aliases/InferToolName.md +++ b/docs/reference/type-aliases/InferToolName.md @@ -9,7 +9,7 @@ title: InferToolName type InferToolName = T extends object ? N : never; ``` -Defined in: [tools/tool-definition.ts:56](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/tools/tool-definition.ts#L56) +Defined in: [activities/chat/tools/tool-definition.ts:61](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/tools/tool-definition.ts#L61) Extract the tool name as a literal type diff --git a/docs/reference/type-aliases/InferToolOutput.md b/docs/reference/type-aliases/InferToolOutput.md index 2c3d3607..e6b03cb8 100644 --- a/docs/reference/type-aliases/InferToolOutput.md +++ b/docs/reference/type-aliases/InferToolOutput.md @@ -9,7 +9,7 @@ title: InferToolOutput type InferToolOutput = T extends object ? TOutput extends z.ZodType ? z.infer : TOutput extends JSONSchema ? any : any : any; ``` -Defined in: [tools/tool-definition.ts:72](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/tools/tool-definition.ts#L72) +Defined in: [activities/chat/tools/tool-definition.ts:77](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/tools/tool-definition.ts#L77) Extract the output type from a tool (inferred from Zod schema, or `any` for JSONSchema) diff --git a/docs/reference/type-aliases/InputModalitiesTypes.md b/docs/reference/type-aliases/InputModalitiesTypes.md new file mode 100644 index 00000000..5c3b0905 --- /dev/null +++ b/docs/reference/type-aliases/InputModalitiesTypes.md @@ -0,0 +1,32 @@ +--- +id: InputModalitiesTypes +title: InputModalitiesTypes +--- + +# Type Alias: InputModalitiesTypes + +```ts +type InputModalitiesTypes = object; +``` + +Defined in: [types.ts:351](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L351) + +## Properties + +### inputModalities + +```ts +inputModalities: ReadonlyArray; +``` + +Defined in: [types.ts:352](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L352) + +*** + +### messageMetadataByModality + +```ts +messageMetadataByModality: DefaultMessageMetadataByModality; +``` + +Defined in: [types.ts:353](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L353) diff --git a/docs/reference/type-aliases/MessagePart.md b/docs/reference/type-aliases/MessagePart.md index 93e4695c..e0f62857 100644 --- a/docs/reference/type-aliases/MessagePart.md +++ b/docs/reference/type-aliases/MessagePart.md @@ -13,4 +13,4 @@ type MessagePart = | ThinkingPart; ``` -Defined in: [types.ts:271](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L271) +Defined in: [types.ts:334](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L334) diff --git a/docs/reference/type-aliases/ModalitiesArrayToUnion.md b/docs/reference/type-aliases/ModalitiesArrayToUnion.md index 6a736d2e..9956c9f2 100644 --- a/docs/reference/type-aliases/ModalitiesArrayToUnion.md +++ b/docs/reference/type-aliases/ModalitiesArrayToUnion.md @@ -9,7 +9,7 @@ title: ModalitiesArrayToUnion type ModalitiesArrayToUnion = T[number]; ``` -Defined in: [types.ts:192](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L192) +Defined in: [types.ts:269](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L269) Helper type to convert a readonly array of modalities to a union type. e.g., readonly ['text', 'image'] -> 'text' | 'image' diff --git a/docs/reference/type-aliases/Modality.md b/docs/reference/type-aliases/Modality.md index f44c2f26..883631bd 100644 --- a/docs/reference/type-aliases/Modality.md +++ b/docs/reference/type-aliases/Modality.md @@ -9,7 +9,7 @@ title: Modality type Modality = "text" | "image" | "audio" | "video" | "document"; ``` -Defined in: [types.ts:83](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L83) +Defined in: [types.ts:159](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L159) Supported input modality types for multimodal content. - 'text': Plain text content diff --git a/docs/reference/type-aliases/SchemaInput.md b/docs/reference/type-aliases/SchemaInput.md index 1a1b09cd..52150599 100644 --- a/docs/reference/type-aliases/SchemaInput.md +++ b/docs/reference/type-aliases/SchemaInput.md @@ -9,6 +9,6 @@ title: SchemaInput type SchemaInput = z.ZodType | JSONSchema; ``` -Defined in: [types.ts:53](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L53) +Defined in: [types.ts:129](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L129) Union type for schema input - can be either a Zod schema or a JSONSchema object. diff --git a/docs/reference/type-aliases/StreamChunk.md b/docs/reference/type-aliases/StreamChunk.md index 7227135c..6c721940 100644 --- a/docs/reference/type-aliases/StreamChunk.md +++ b/docs/reference/type-aliases/StreamChunk.md @@ -17,6 +17,6 @@ type StreamChunk = | ThinkingStreamChunk; ``` -Defined in: [types.ts:672](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L672) +Defined in: [types.ts:735](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L735) Chunk returned by the sdk during streaming chat completions. diff --git a/docs/reference/type-aliases/StreamChunkType.md b/docs/reference/type-aliases/StreamChunkType.md index 3d83a468..0b3d9514 100644 --- a/docs/reference/type-aliases/StreamChunkType.md +++ b/docs/reference/type-aliases/StreamChunkType.md @@ -17,4 +17,4 @@ type StreamChunkType = | "thinking"; ``` -Defined in: [types.ts:584](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L584) +Defined in: [types.ts:647](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L647) diff --git a/docs/reference/type-aliases/TextStreamOptionsForModel.md b/docs/reference/type-aliases/TextStreamOptionsForModel.md deleted file mode 100644 index f0c05360..00000000 --- a/docs/reference/type-aliases/TextStreamOptionsForModel.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -id: TextStreamOptionsForModel -title: TextStreamOptionsForModel ---- - -# Type Alias: TextStreamOptionsForModel\ - -```ts -type TextStreamOptionsForModel = TAdapter extends AIAdapter ? Omit & object : never; -``` - -Defined in: [types.ts:883](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L883) - -Chat options constrained by a specific model's capabilities. -Unlike TextStreamOptionsUnion which creates a union over all models, -this type takes a specific model and constrains messages accordingly. - -## Type Parameters - -### TAdapter - -`TAdapter` *extends* [`AIAdapter`](../interfaces/AIAdapter.md)\<`any`, `any`, `any`, `any`, `any`, `any`, `any`\> - -### TModel - -`TModel` *extends* `string` diff --git a/docs/reference/type-aliases/TextStreamOptionsUnion.md b/docs/reference/type-aliases/TextStreamOptionsUnion.md deleted file mode 100644 index 5db11467..00000000 --- a/docs/reference/type-aliases/TextStreamOptionsUnion.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -id: TextStreamOptionsUnion -title: TextStreamOptionsUnion ---- - -# Type Alias: TextStreamOptionsUnion\ - -```ts -type TextStreamOptionsUnion = TAdapter extends AIAdapter ? Models[number] extends infer TModel ? TModel extends string ? Omit & object : never : never : never; -``` - -Defined in: [types.ts:823](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L823) - -## Type Parameters - -### TAdapter - -`TAdapter` *extends* [`AIAdapter`](../interfaces/AIAdapter.md)\<`any`, `any`, `any`, `any`, `any`, `any`, `any`\> diff --git a/docs/reference/type-aliases/ToolCallState.md b/docs/reference/type-aliases/ToolCallState.md index 7ff8e334..dc71a615 100644 --- a/docs/reference/type-aliases/ToolCallState.md +++ b/docs/reference/type-aliases/ToolCallState.md @@ -14,6 +14,6 @@ type ToolCallState = | "approval-responded"; ``` -Defined in: [stream/types.ts:13](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/types.ts#L13) +Defined in: [types.ts:6](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L6) Tool call states - track the lifecycle of a tool call diff --git a/docs/reference/type-aliases/ToolResultState.md b/docs/reference/type-aliases/ToolResultState.md index d9d29e6e..c641d4c7 100644 --- a/docs/reference/type-aliases/ToolResultState.md +++ b/docs/reference/type-aliases/ToolResultState.md @@ -9,6 +9,6 @@ title: ToolResultState type ToolResultState = "streaming" | "complete" | "error"; ``` -Defined in: [stream/types.ts:23](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/types.ts#L23) +Defined in: [types.ts:16](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L16) Tool result states - track the lifecycle of a tool result diff --git a/docs/reference/variables/aiEventClient.md b/docs/reference/variables/aiEventClient.md index 8c37775a..6c15d1f2 100644 --- a/docs/reference/variables/aiEventClient.md +++ b/docs/reference/variables/aiEventClient.md @@ -9,4 +9,4 @@ title: aiEventClient const aiEventClient: AiEventClient; ``` -Defined in: [event-client.ts:307](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/event-client.ts#L307) +Defined in: [event-client.ts:291](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/event-client.ts#L291) diff --git a/docs/reference/variables/defaultJSONParser.md b/docs/reference/variables/defaultJSONParser.md index e5e32dad..0c72078d 100644 --- a/docs/reference/variables/defaultJSONParser.md +++ b/docs/reference/variables/defaultJSONParser.md @@ -9,6 +9,6 @@ title: defaultJSONParser const defaultJSONParser: PartialJSONParser; ``` -Defined in: [stream/json-parser.ts:49](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/stream/json-parser.ts#L49) +Defined in: [activities/chat/stream/json-parser.ts:49](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/activities/chat/stream/json-parser.ts#L49) Default parser instance diff --git a/examples/ts-react-chat/src/routes/api.tanchat.ts b/examples/ts-react-chat/src/routes/api.tanchat.ts index 844dda7d..c72fd60e 100644 --- a/examples/ts-react-chat/src/routes/api.tanchat.ts +++ b/examples/ts-react-chat/src/routes/api.tanchat.ts @@ -98,10 +98,13 @@ export const Route = createFileRoute('/api/tanchat')({ `[API Route] Using provider: ${provider}, adapter: ${options.adapter.name}`, ) + const adapter = openaiText('gpt-5') + const test = createChatOptions({ adapter: openaiText('gpt-5'), - thisIsntvalid: true, + // thisIsntvalid: true, }) + // Note: We cast to AsyncIterable because all chat adapters // return streams, but TypeScript sees a union of all possible return types const stream = chat({ diff --git a/packages/typescript/ai-anthropic/src/adapters/summarize.ts b/packages/typescript/ai-anthropic/src/adapters/summarize.ts index 7472e0f8..02e08506 100644 --- a/packages/typescript/ai-anthropic/src/adapters/summarize.ts +++ b/packages/typescript/ai-anthropic/src/adapters/summarize.ts @@ -1,10 +1,10 @@ import { BaseSummarizeAdapter } from '@tanstack/ai/adapters' -import { ANTHROPIC_MODELS } from '../model-meta' import { createAnthropicClient, generateId, getAnthropicApiKeyFromEnv, } from '../utils' +import type { ANTHROPIC_MODELS } from '../model-meta' import type { StreamChunk, SummarizationOptions, @@ -27,24 +27,25 @@ export interface AnthropicSummarizeProviderOptions { maxTokens?: number } +/** Model type for Anthropic summarization */ +export type AnthropicSummarizeModel = (typeof ANTHROPIC_MODELS)[number] + /** * Anthropic Summarize Adapter * * Tree-shakeable adapter for Anthropic summarization functionality. * Import only what you need for smaller bundle sizes. */ -export class AnthropicSummarizeAdapter extends BaseSummarizeAdapter< - typeof ANTHROPIC_MODELS, - AnthropicSummarizeProviderOptions -> { +export class AnthropicSummarizeAdapter< + TModel extends AnthropicSummarizeModel, +> extends BaseSummarizeAdapter { readonly kind = 'summarize' as const readonly name = 'anthropic' as const - readonly models = ANTHROPIC_MODELS private client: ReturnType - constructor(config: AnthropicSummarizeConfig) { - super({}) + constructor(config: AnthropicSummarizeConfig, model: TModel) { + super({}, model) this.client = createAnthropicClient(config) } @@ -164,21 +165,36 @@ export class AnthropicSummarizeAdapter extends BaseSummarizeAdapter< } /** - * Creates an Anthropic summarize adapter with explicit API key + * Creates an Anthropic summarize adapter with explicit API key. + * Type resolution happens here at the call site. + * + * @param model - The model name (e.g., 'claude-sonnet-4-5', 'claude-3-5-haiku-latest') + * @param apiKey - Your Anthropic API key + * @param config - Optional additional configuration + * @returns Configured Anthropic summarize adapter instance with resolved types */ -export function createAnthropicSummarize( +export function createAnthropicSummarize< + TModel extends AnthropicSummarizeModel, +>( + model: TModel, apiKey: string, config?: Omit, -): AnthropicSummarizeAdapter { - return new AnthropicSummarizeAdapter({ apiKey, ...config }) +): AnthropicSummarizeAdapter { + return new AnthropicSummarizeAdapter({ apiKey, ...config }, model) } /** - * Creates an Anthropic summarize adapter with automatic API key detection + * Creates an Anthropic summarize adapter with automatic API key detection. + * Type resolution happens here at the call site. + * + * @param model - The model name (e.g., 'claude-sonnet-4-5', 'claude-3-5-haiku-latest') + * @param config - Optional configuration (excluding apiKey which is auto-detected) + * @returns Configured Anthropic summarize adapter instance with resolved types */ -export function anthropicSummarize( +export function anthropicSummarize( + model: TModel, config?: Omit, -): AnthropicSummarizeAdapter { +): AnthropicSummarizeAdapter { const apiKey = getAnthropicApiKeyFromEnv() - return createAnthropicSummarize(apiKey, config) + return createAnthropicSummarize(model, apiKey, config) } diff --git a/packages/typescript/ai-anthropic/src/adapters/text.ts b/packages/typescript/ai-anthropic/src/adapters/text.ts index 9a7b8586..7c9280b5 100644 --- a/packages/typescript/ai-anthropic/src/adapters/text.ts +++ b/packages/typescript/ai-anthropic/src/adapters/text.ts @@ -1,5 +1,4 @@ import { BaseTextAdapter } from '@tanstack/ai/adapters' -import { ANTHROPIC_MODELS } from '../model-meta' import { convertToolsToProviderFormat } from '../tools/tool-converter' import { validateTextProviderOptions } from '../text/text-provider-options' import { @@ -7,6 +6,11 @@ import { generateId, getAnthropicApiKeyFromEnv, } from '../utils' +import type { + ANTHROPIC_MODELS, + AnthropicChatModelProviderOptionsByName, + AnthropicModelInputModalitiesByName, +} from '../model-meta' import type { StructuredOutputOptions, StructuredOutputResult, @@ -24,14 +28,11 @@ import type { import type Anthropic_SDK from '@anthropic-ai/sdk' import type { ContentPart, + Modality, ModelMessage, StreamChunk, TextOptions, } from '@tanstack/ai' -import type { - AnthropicChatModelProviderOptionsByName, - AnthropicModelInputModalitiesByName, -} from '../model-meta' import type { ExternalTextProviderOptions, InternalTextProviderOptions, @@ -61,6 +62,32 @@ type AnthropicContentBlocks = type AnthropicContentBlock = AnthropicContentBlocks extends Array ? Block : never +// =========================== +// Type Resolution Helpers +// =========================== + +/** + * Resolve provider options for a specific model. + * If the model has explicit options in the map, use those; otherwise use base options. + */ +type ResolveProviderOptions = + TModel extends keyof AnthropicChatModelProviderOptionsByName + ? AnthropicChatModelProviderOptionsByName[TModel] + : AnthropicTextProviderOptions + +/** + * Resolve input modalities for a specific model. + * If the model has explicit modalities in the map, use those; otherwise use default. + */ +type ResolveInputModalities = + TModel extends keyof AnthropicModelInputModalitiesByName + ? AnthropicModelInputModalitiesByName[TModel] + : readonly ['text', 'image', 'document'] + +// =========================== +// Adapter Implementation +// =========================== + /** * Anthropic Text (Chat) Adapter * @@ -68,34 +95,28 @@ type AnthropicContentBlock = * Import only what you need for smaller bundle sizes. */ export class AnthropicTextAdapter< - TSelectedModel extends (typeof ANTHROPIC_MODELS)[number] | undefined = - undefined, + TModel extends (typeof ANTHROPIC_MODELS)[number], + TProviderOptions extends object = ResolveProviderOptions, + TInputModalities extends ReadonlyArray = + ResolveInputModalities, > extends BaseTextAdapter< - typeof ANTHROPIC_MODELS, - AnthropicTextProviderOptions, - AnthropicChatModelProviderOptionsByName, - AnthropicModelInputModalitiesByName, - AnthropicMessageMetadataByModality, - TSelectedModel + TModel, + TProviderOptions, + TInputModalities, + AnthropicMessageMetadataByModality > { readonly kind = 'text' as const readonly name = 'anthropic' as const - readonly models = ANTHROPIC_MODELS - - declare _modelProviderOptionsByName: AnthropicChatModelProviderOptionsByName - declare _modelInputModalitiesByName: AnthropicModelInputModalitiesByName - declare _messageMetadataByModality: AnthropicMessageMetadataByModality - declare _selectedModel?: TSelectedModel private client: Anthropic_SDK - constructor(config: AnthropicTextConfig, selectedModel?: TSelectedModel) { - super({}, selectedModel) + constructor(config: AnthropicTextConfig, model: TModel) { + super({}, model) this.client = createAnthropicClient(config) } async *chatStream( - options: TextOptions, + options: TextOptions, ): AsyncIterable { try { const requestParams = this.mapCommonOptionsToAnthropic(options) @@ -211,7 +232,7 @@ export class AnthropicTextAdapter< } private mapCommonOptionsToAnthropic( - options: TextOptions, + options: TextOptions, ) { const modelOptions = options.modelOptions as | InternalTextProviderOptions @@ -601,53 +622,35 @@ export class AnthropicTextAdapter< } /** - * Creates an Anthropic chat adapter with explicit API key + * Creates an Anthropic chat adapter with explicit API key. + * Type resolution happens here at the call site. */ export function createAnthropicChat< - TSelectedModel extends (typeof ANTHROPIC_MODELS)[number], + TModel extends (typeof ANTHROPIC_MODELS)[number], >( - model: TSelectedModel, + model: TModel, apiKey: string, config?: Omit, -): AnthropicTextAdapter { +): AnthropicTextAdapter< + TModel, + ResolveProviderOptions, + ResolveInputModalities +> { return new AnthropicTextAdapter({ apiKey, ...config }, model) } /** - * Creates an Anthropic text adapter with automatic API key detection - */ -export function anthropicText< - TSelectedModel extends (typeof ANTHROPIC_MODELS)[number], ->( - model: TSelectedModel, - config?: Omit, -): AnthropicTextAdapter { - const apiKey = getAnthropicApiKeyFromEnv() - return createAnthropicChat(model, apiKey, config) -} - -/** - * @deprecated Use anthropicText() instead + * Creates an Anthropic text adapter with automatic API key detection. + * Type resolution happens here at the call site. */ -export function anthropicChat< - TSelectedModel extends (typeof ANTHROPIC_MODELS)[number], ->( - model: TSelectedModel, +export function anthropicText( + model: TModel, config?: Omit, -): AnthropicTextAdapter { +): AnthropicTextAdapter< + TModel, + ResolveProviderOptions, + ResolveInputModalities +> { const apiKey = getAnthropicApiKeyFromEnv() return createAnthropicChat(model, apiKey, config) } - -/** - * @deprecated Use createAnthropicChat() instead - */ -export function createAnthropicText< - TSelectedModel extends (typeof ANTHROPIC_MODELS)[number], ->( - model: TSelectedModel, - apiKey: string, - config?: Omit, -): AnthropicTextAdapter { - return createAnthropicChat(model, apiKey, config) -} diff --git a/packages/typescript/ai-anthropic/src/index.ts b/packages/typescript/ai-anthropic/src/index.ts index 7d7ac1cf..4bca2e4b 100644 --- a/packages/typescript/ai-anthropic/src/index.ts +++ b/packages/typescript/ai-anthropic/src/index.ts @@ -7,9 +7,6 @@ export { AnthropicTextAdapter, anthropicText, createAnthropicChat, - // Deprecated exports - anthropicChat, - createAnthropicText, type AnthropicTextConfig, type AnthropicTextProviderOptions, } from './adapters/text' @@ -23,8 +20,6 @@ export { type AnthropicSummarizeProviderOptions, } from './adapters/summarize' -// Note: Anthropic does not support embeddings natively - // ============================================================================ // Type Exports // ============================================================================ diff --git a/packages/typescript/ai-client/README.md b/packages/typescript/ai-client/README.md index 77acf865..e0de4f3a 100644 --- a/packages/typescript/ai-client/README.md +++ b/packages/typescript/ai-client/README.md @@ -38,7 +38,9 @@ A powerful, type-safe AI SDK for building AI-powered applications. - Provider-agnostic adapters (OpenAI, Anthropic, Gemini, Ollama, etc.) +- **Tree-shakeable adapters** - Import only what you need for smaller bundles - **Multimodal content support** - Send images, audio, video, and documents +- **Image generation** - Generate images with OpenAI DALL-E/GPT-Image and Gemini Imagen - Chat completion, streaming, and agent loop strategies - Headless chat state management with adapters (SSE, HTTP stream, custom) - Isomorphic type-safe tools with server/client execution @@ -46,6 +48,30 @@ A powerful, type-safe AI SDK for building AI-powered applications. ### Read the docs → +## Tree-Shakeable Adapters + +Import only the functionality you need for smaller bundle sizes: + +```typescript +// Only chat functionality - no summarization code bundled +import { openaiText } from '@tanstack/ai-openai/adapters' +import { generate } from '@tanstack/ai' + +const textAdapter = openaiText() + +const result = generate({ + adapter: textAdapter, + model: 'gpt-4o', + messages: [{ role: 'user', content: [{ type: 'text', content: 'Hello!' }] }], +}) + +for await (const chunk of result) { + console.log(chunk) +} +``` + +Available adapters: `openaiText`, `openaiEmbed`, `openaiSummarize`, `anthropicText`, `geminiText`, `ollamaText`, and more. + ## Bonus: TanStack Start Integration TanStack AI works with **any** framework (Next.js, Express, Remix, etc.). diff --git a/packages/typescript/ai-client/src/types.ts b/packages/typescript/ai-client/src/types.ts index b5e58962..4f83debb 100644 --- a/packages/typescript/ai-client/src/types.ts +++ b/packages/typescript/ai-client/src/types.ts @@ -126,7 +126,7 @@ export type MessagePart = any> = */ export interface UIMessage = any> { id: string - role: 'user' | 'assistant' + role: 'system' | 'user' | 'assistant' parts: Array> createdAt?: Date } diff --git a/packages/typescript/ai-devtools/README.md b/packages/typescript/ai-devtools/README.md index 77acf865..e0de4f3a 100644 --- a/packages/typescript/ai-devtools/README.md +++ b/packages/typescript/ai-devtools/README.md @@ -38,7 +38,9 @@ A powerful, type-safe AI SDK for building AI-powered applications. - Provider-agnostic adapters (OpenAI, Anthropic, Gemini, Ollama, etc.) +- **Tree-shakeable adapters** - Import only what you need for smaller bundles - **Multimodal content support** - Send images, audio, video, and documents +- **Image generation** - Generate images with OpenAI DALL-E/GPT-Image and Gemini Imagen - Chat completion, streaming, and agent loop strategies - Headless chat state management with adapters (SSE, HTTP stream, custom) - Isomorphic type-safe tools with server/client execution @@ -46,6 +48,30 @@ A powerful, type-safe AI SDK for building AI-powered applications. ### Read the docs → +## Tree-Shakeable Adapters + +Import only the functionality you need for smaller bundle sizes: + +```typescript +// Only chat functionality - no summarization code bundled +import { openaiText } from '@tanstack/ai-openai/adapters' +import { generate } from '@tanstack/ai' + +const textAdapter = openaiText() + +const result = generate({ + adapter: textAdapter, + model: 'gpt-4o', + messages: [{ role: 'user', content: [{ type: 'text', content: 'Hello!' }] }], +}) + +for await (const chunk of result) { + console.log(chunk) +} +``` + +Available adapters: `openaiText`, `openaiEmbed`, `openaiSummarize`, `anthropicText`, `geminiText`, `ollamaText`, and more. + ## Bonus: TanStack Start Integration TanStack AI works with **any** framework (Next.js, Express, Remix, etc.). diff --git a/packages/typescript/ai-devtools/src/components/ConversationDetails.tsx b/packages/typescript/ai-devtools/src/components/ConversationDetails.tsx index aad415d1..333bc56f 100644 --- a/packages/typescript/ai-devtools/src/components/ConversationDetails.tsx +++ b/packages/typescript/ai-devtools/src/components/ConversationDetails.tsx @@ -5,7 +5,6 @@ import { ChunksTab, ConversationHeader, ConversationTabs, - EmbeddingsTab, MessagesTab, SummariesTab, } from './conversation' @@ -31,11 +30,6 @@ export const ConversationDetails: Component = () => { if (conv.type === 'server') { if (conv.chunks.length > 0) { setActiveTab('chunks') - } else if ( - conv.hasEmbedding || - (conv.embeddings && conv.embeddings.length > 0) - ) { - setActiveTab('embeddings') } else if ( conv.hasSummarize || (conv.summaries && conv.summaries.length > 0) @@ -75,9 +69,6 @@ export const ConversationDetails: Component = () => { - - - diff --git a/packages/typescript/ai-devtools/src/components/conversation/ConversationTabs.tsx b/packages/typescript/ai-devtools/src/components/conversation/ConversationTabs.tsx index a76105b4..fe6eeec7 100644 --- a/packages/typescript/ai-devtools/src/components/conversation/ConversationTabs.tsx +++ b/packages/typescript/ai-devtools/src/components/conversation/ConversationTabs.tsx @@ -3,7 +3,7 @@ import { useStyles } from '../../styles/use-styles' import type { Component } from 'solid-js' import type { Conversation } from '../../store/ai-context' -export type TabType = 'messages' | 'chunks' | 'embeddings' | 'summaries' +export type TabType = 'messages' | 'chunks' | 'summaries' interface ConversationTabsProps { conversation: Conversation @@ -19,7 +19,6 @@ export const ConversationTabs: Component = (props) => { const totalRawChunks = () => conv().chunks.reduce((sum, c) => sum + (c.chunkCount || 1), 0) - const embeddingsCount = () => conv().embeddings?.length ?? 0 const summariesCount = () => conv().summaries?.length ?? 0 // Determine if we should show any chat-related tabs @@ -27,7 +26,6 @@ export const ConversationTabs: Component = (props) => { const hasMessages = () => conv().type === 'client' && conv().messages.length > 0 const hasChunks = () => conv().chunks.length > 0 || conv().type === 'server' - const hasEmbeddings = () => conv().hasEmbedding || embeddingsCount() > 0 const hasSummaries = () => conv().hasSummarize || summariesCount() > 0 // Count how many tabs would be visible @@ -35,7 +33,6 @@ export const ConversationTabs: Component = (props) => { let count = 0 if (hasMessages()) count++ if (hasChunks() && conv().type === 'server') count++ - if (hasEmbeddings()) count++ if (hasSummaries()) count++ return count } @@ -73,19 +70,6 @@ export const ConversationTabs: Component = (props) => { 📦 Chunks ({totalRawChunks()}) - {/* Show embeddings tab if there are embedding operations */} - - - {/* Show summaries tab if there are summarize operations */}