diff --git a/docs/adapters/anthropic.md b/docs/adapters/anthropic.md index 032c1ab8..4a37757a 100644 --- a/docs/adapters/anthropic.md +++ b/docs/adapters/anthropic.md @@ -187,6 +187,6 @@ Creates an Anthropic adapter instance. ## Next Steps -- [Getting Started](../../getting-started/quick-start) - Learn the basics -- [Tools Guide](../../guides/tools) - Learn about tools -- [Other Adapters](../openai) - Explore other providers +- [Getting Started](../getting-started/quick-start) - Learn the basics +- [Tools Guide](../guides/tools) - Learn about tools +- [Other Adapters](./openai) - Explore other providers diff --git a/docs/adapters/gemini.md b/docs/adapters/gemini.md index f6562e7c..bb8b822c 100644 --- a/docs/adapters/gemini.md +++ b/docs/adapters/gemini.md @@ -151,6 +151,6 @@ Creates a Gemini adapter instance. ## Next Steps -- [Getting Started](../../getting-started/quick-start) - Learn the basics -- [Tools Guide](../../guides/tools) - Learn about tools -- [Other Adapters](../openai) - Explore other providers \ No newline at end of file +- [Getting Started](../getting-started/quick-start) - Learn the basics +- [Tools Guide](../guides/tools) - Learn about tools +- [Other Adapters](./openai) - Explore other providers \ No newline at end of file diff --git a/docs/adapters/ollama.md b/docs/adapters/ollama.md index e94f7a20..1b6be5de 100644 --- a/docs/adapters/ollama.md +++ b/docs/adapters/ollama.md @@ -188,6 +188,6 @@ Creates an Ollama adapter instance. ## Next Steps -- [Getting Started](../../getting-started/quick-start) - Learn the basics -- [Tools Guide](../../guides/tools) - Learn about tools -- [Other Adapters](../openai) - Explore other providers +- [Getting Started](../getting-started/quick-start) - Learn the basics +- [Tools Guide](../guides/tools) - Learn about tools +- [Other Adapters](./openai) - Explore other providers diff --git a/docs/adapters/openai.md b/docs/adapters/openai.md index 8bea0dd5..33e0b2c4 100644 --- a/docs/adapters/openai.md +++ b/docs/adapters/openai.md @@ -181,6 +181,6 @@ Creates an OpenAI adapter instance. ## Next Steps -- [Getting Started](../../getting-started/quick-start) - Learn the basics -- [Tools Guide](../../guides/tools) - Learn about tools -- [Other Adapters](../anthropic) - Explore other providers +- [Getting Started](../getting-started/quick-start) - Learn the basics +- [Tools Guide](../guides/tools) - Learn about tools +- [Other Adapters](./anthropic) - Explore other providers diff --git a/docs/api/ai-client.md b/docs/api/ai-client.md index 2dab4f69..a8f3b340 100644 --- a/docs/api/ai-client.md +++ b/docs/api/ai-client.md @@ -345,6 +345,6 @@ const client = new ChatClient({ ## Next Steps -- [Getting Started](../../getting-started/quick-start) - Learn the basics -- [Connection Adapters](../../guides/connection-adapters) - Learn about adapters -- [@tanstack/ai-react API](../ai-react) - React hooks wrapper +- [Getting Started](../getting-started/quick-start) - Learn the basics +- [Connection Adapters](../guides/connection-adapters) - Learn about adapters +- [@tanstack/ai-react API](./ai-react) - React hooks wrapper diff --git a/docs/api/ai-react.md b/docs/api/ai-react.md index 2750f2af..7f44f921 100644 --- a/docs/api/ai-react.md +++ b/docs/api/ai-react.md @@ -311,6 +311,6 @@ Re-exported from `@tanstack/ai`: ## Next Steps -- [Getting Started](../../getting-started/quick-start) - Learn the basics -- [Tools Guide](../../guides/tools) - Learn about the isomorphic tool system -- [Client Tools](../../guides/client-tools) - Learn about client-side tools +- [Getting Started](../getting-started/quick-start) - Learn the basics +- [Tools Guide](../guides/tools) - Learn about the isomorphic tool system +- [Client Tools](../guides/client-tools) - Learn about client-side tools diff --git a/docs/api/ai-solid.md b/docs/api/ai-solid.md index 76f544d7..6299cd1d 100644 --- a/docs/api/ai-solid.md +++ b/docs/api/ai-solid.md @@ -326,6 +326,6 @@ Re-exported from `@tanstack/ai`: ## Next Steps -- [Getting Started](../../getting-started/quick-start) - Learn the basics -- [Tools Guide](../../guides/tools) - Learn about the isomorphic tool system -- [Client Tools](../../guides/client-tools) - Learn about client-side tools +- [Getting Started](../getting-started/quick-start) - Learn the basics +- [Tools Guide](../guides/tools) - Learn about the isomorphic tool system +- [Client Tools](../guides/client-tools) - Learn about client-side tools diff --git a/docs/api/ai.md b/docs/api/ai.md index 0d723ac9..6f9240f4 100644 --- a/docs/api/ai.md +++ b/docs/api/ai.md @@ -323,6 +323,6 @@ const embeddings = await embedding({ ## Next Steps -- [Getting Started](../../getting-started/quick-start) - Learn the basics -- [Tools Guide](../../guides/tools) - Learn about tools -- [Adapters](../../adapters/openai) - Explore adapter options +- [Getting Started](../getting-started/quick-start) - Learn the basics +- [Tools Guide](../guides/tools) - Learn about tools +- [Adapters](../adapters/openai) - Explore adapter options diff --git a/docs/getting-started/overview.md b/docs/getting-started/overview.md index 2aed183c..67395478 100644 --- a/docs/getting-started/overview.md +++ b/docs/getting-started/overview.md @@ -92,6 +92,6 @@ With the help of adapters, TanStack AI can connect to various LLM providers. Ava ## Next Steps -- [Quick Start Guide](../quick-start) - Get up and running in minutes -- [Tools Guide](../../guides/tools) - Learn about the isomorphic tool system -- [API Reference](../../api/ai) - Explore the full API \ No newline at end of file +- [Quick Start Guide](./quick-start) - Get up and running in minutes +- [Tools Guide](../guides/tools) - Learn about the isomorphic tool system +- [API Reference](../api/ai) - Explore the full API \ No newline at end of file diff --git a/docs/getting-started/quick-start.md b/docs/getting-started/quick-start.md index 6a394890..246206fa 100644 --- a/docs/getting-started/quick-start.md +++ b/docs/getting-started/quick-start.md @@ -189,6 +189,6 @@ chat({ tools: [getProducts] }) ## Next Steps -- Learn about [Tools](../../guides/tools) to add function calling -- Check out [Client Tools](../../guides/client-tools) for frontend operations -- See the [API Reference](../../api/ai) for more options +- Learn about [Tools](../guides/tools) to add function calling +- Check out [Client Tools](../guides/client-tools) for frontend operations +- See the [API Reference](../api/ai) for more options diff --git a/docs/guides/client-tools.md b/docs/guides/client-tools.md index 2ca6ec12..a7b19cb5 100644 --- a/docs/guides/client-tools.md +++ b/docs/guides/client-tools.md @@ -323,7 +323,7 @@ chat({ tools: [addToCartServer] }); // Server will execute ## Next Steps -- [How Tools Work](../tools) - Deep dive into the tool architecture -- [Server Tools](../server-tools) - Learn about server-side tool execution -- [Tool Approval Flow](../tool-approval) - Add approval workflows for sensitive operations +- [How Tools Work](./tools) - Deep dive into the tool architecture +- [Server Tools](./server-tools) - Learn about server-side tool execution +- [Tool Approval Flow](./tool-approval) - Add approval workflows for sensitive operations diff --git a/docs/guides/connection-adapters.md b/docs/guides/connection-adapters.md index f91e51e1..7d55c9ee 100644 --- a/docs/guides/connection-adapters.md +++ b/docs/guides/connection-adapters.md @@ -10,7 +10,7 @@ Connection adapters handle the communication between your client and server for ### Server-Sent Events (SSE) -SSE is the recommended adapter for most use cases. It provides reliable streaming with automatic reconnection. On the server side, use [`toServerSentEventsStream()`](../../api/ai#toserversenteventsstreamstream-abortcontroller) or [`toStreamResponse()`](../../api/ai#tostreamresponsestream-init) to convert your chat stream to SSE format. +SSE is the recommended adapter for most use cases. It provides reliable streaming with automatic reconnection. On the server side, use [`toServerSentEventsStream()`](../api/ai#toserversenteventsstreamstream-abortcontroller) or [`toStreamResponse()`](../api/ai#tostreamresponsestream-init) to convert your chat stream to SSE format. ```typescript import { useChat, fetchServerSentEvents } from "@tanstack/ai-react"; @@ -225,5 +225,5 @@ const { messages } = useChat({ ## Next Steps -- [Streaming](../streaming) - Learn about streaming responses -- [API Reference](../../api/ai-client) - Explore connection adapter APIs \ No newline at end of file +- [Streaming](./streaming) - Learn about streaming responses +- [API Reference](../api/ai-client) - Explore connection adapter APIs \ No newline at end of file diff --git a/docs/guides/server-tools.md b/docs/guides/server-tools.md index 9739a018..8e159d45 100644 --- a/docs/guides/server-tools.md +++ b/docs/guides/server-tools.md @@ -266,5 +266,5 @@ const getUserData = getUserDataDef.server(async ({ userId }) => { ## Next Steps -- [Client Tools](../client-tools) - Learn about client-side tool execution -- [Tool Approval Flow](../tool-approval) - Add approval workflows for sensitive operations +- [Client Tools](./client-tools) - Learn about client-side tool execution +- [Tool Approval Flow](./tool-approval) - Add approval workflows for sensitive operations diff --git a/docs/guides/streaming.md b/docs/guides/streaming.md index 401784f0..da2a806b 100644 --- a/docs/guides/streaming.md +++ b/docs/guides/streaming.md @@ -171,5 +171,5 @@ stop(); ## Next Steps -- [Connection Adapters](../connection-adapters) - Learn about different connection types -- [API Reference](../../api/ai) - Explore streaming APIs +- [Connection Adapters](./connection-adapters) - Learn about different connection types +- [API Reference](../api/ai) - Explore streaming APIs diff --git a/docs/guides/tool-approval.md b/docs/guides/tool-approval.md index eb65fc4b..0479a112 100644 --- a/docs/guides/tool-approval.md +++ b/docs/guides/tool-approval.md @@ -239,5 +239,5 @@ The user will see an approval prompt showing the item, quantity, and price befor ## Next Steps -- [Server Tools](../server-tools) - Learn about server-side tool execution -- [Client Tools](../client-tools) - Learn about client-side tool execution +- [Server Tools](./server-tools) - Learn about server-side tool execution +- [Client Tools](./client-tools) - Learn about client-side tool execution diff --git a/docs/guides/tool-architecture.md b/docs/guides/tool-architecture.md index 4350f6d9..f691f510 100644 --- a/docs/guides/tool-architecture.md +++ b/docs/guides/tool-architecture.md @@ -5,9 +5,9 @@ id: tool-architecture The TanStack AI tool system provides a powerful, flexible architecture for enabling AI agents to interact with external systems: -- [**Server Tools**](../server-tools) execute securely on the backend with automatic handling -- [**Client Tools**](../client-tools) execute in the browser for UI updates and local operations -- [**The Agentic Cycle**](../agentic-cycle) enables multi-step reasoning and complex workflows +- [**Server Tools**](./server-tools) execute securely on the backend with automatic handling +- [**Client Tools**](./client-tools) execute in the browser for UI updates and local operations +- [**The Agentic Cycle**](./agentic-cycle) enables multi-step reasoning and complex workflows - [**Tool States**](#call-states) provide real-time feedback and enable robust UIs - [**Approval Flow**](#approval-flow) gives users control over sensitive operations This architecture enables building sophisticated AI applications that can: @@ -377,9 +377,9 @@ All execute simultaneously, then LLM generates comparison. ## Next Steps -- [Tools Overview](../tools) - Basic tool concepts and examples -- [Server Tools](../server-tools) - Deep dive into server-side tools -- [Client Tools](../client-tools) - Deep dive into client-side tools -- [Tool Approval Flow](../tool-approval) - Implementing approval workflows -- [Stream Chunk Definitions](../../protocol/chunk-definitions) - Understanding the streaming protocol +- [Tools Overview](./tools) - Basic tool concepts and examples +- [Server Tools](./server-tools) - Deep dive into server-side tools +- [Client Tools](./client-tools) - Deep dive into client-side tools +- [Tool Approval Flow](./tool-approval) - Implementing approval workflows +- [Stream Chunk Definitions](../protocol/chunk-definitions) - Understanding the streaming protocol diff --git a/docs/guides/tools.md b/docs/guides/tools.md index db823271..3ad897bd 100644 --- a/docs/guides/tools.md +++ b/docs/guides/tools.md @@ -234,7 +234,7 @@ Tools go through different states during execution: ## Next Steps -- [Server Tools](../server-tools) - Learn about server-side tool execution -- [Client Tools](../client-tools) - Learn about client-side tool execution -- [Tool Approval Flow](../tool-approval) - Implement approval workflows -- [How Tools Work](../tool-architecture) - Deep dive into the tool architecture +- [Server Tools](./server-tools) - Learn about server-side tool execution +- [Client Tools](./client-tools) - Learn about client-side tool execution +- [Tool Approval Flow](./tool-approval) - Implement approval workflows +- [How Tools Work](./tool-architecture) - Deep dive into the tool architecture diff --git a/docs/protocol/chunk-definitions.md b/docs/protocol/chunk-definitions.md index b0d29033..0f0b804b 100644 --- a/docs/protocol/chunk-definitions.md +++ b/docs/protocol/chunk-definitions.md @@ -440,6 +440,6 @@ function handleChunk(chunk: StreamChunk) { ## See Also -- [SSE Protocol](../sse-protocol) - How chunks are transmitted via Server-Sent Events -- [HTTP Stream Protocol](../http-stream-protocol) - How chunks are transmitted via HTTP streaming -- [Connection Adapters Guide](../../guides/connection-adapters) - Client implementation +- [SSE Protocol](./sse-protocol) - How chunks are transmitted via Server-Sent Events +- [HTTP Stream Protocol](./http-stream-protocol) - How chunks are transmitted via HTTP streaming +- [Connection Adapters Guide](../guides/connection-adapters) - Client implementation diff --git a/docs/protocol/http-stream-protocol.md b/docs/protocol/http-stream-protocol.md index fead1d88..8330cd42 100644 --- a/docs/protocol/http-stream-protocol.md +++ b/docs/protocol/http-stream-protocol.md @@ -424,8 +424,8 @@ This makes streams compatible with standard NDJSON tools and libraries. ## See Also -- [Chunk Definitions](../chunk-definitions) - StreamChunk type reference -- [SSE Protocol](../sse-protocol) - Recommended protocol (with auto-reconnect) -- [Connection Adapters Guide](../../guides/connection-adapters) - Client implementation +- [Chunk Definitions](./chunk-definitions) - StreamChunk type reference +- [SSE Protocol](./sse-protocol) - Recommended protocol (with auto-reconnect) +- [Connection Adapters Guide](../guides/connection-adapters) - Client implementation - [JSON Lines Specification](http://jsonlines.org/) - [NDJSON Specification](http://ndjson.org/) diff --git a/docs/protocol/sse-protocol.md b/docs/protocol/sse-protocol.md index 4beb8a79..1f9f3d9e 100644 --- a/docs/protocol/sse-protocol.md +++ b/docs/protocol/sse-protocol.md @@ -349,7 +349,7 @@ data: [DONE] ## See Also -- [Chunk Definitions](../chunk-definitions) - StreamChunk type reference -- [HTTP Stream Protocol](../http-stream-protocol) - Alternative protocol -- [Connection Adapters Guide](../../guides/connection-adapters) - Client implementation +- [Chunk Definitions](./chunk-definitions) - StreamChunk type reference +- [HTTP Stream Protocol](./http-stream-protocol) - Alternative protocol +- [Connection Adapters Guide](../guides/connection-adapters) - Client implementation - [MDN: Server-Sent Events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events) diff --git a/docs/reference/classes/BaseAdapter.md b/docs/reference/classes/BaseAdapter.md index 2b2f7b3a..e2b980e4 100644 --- a/docs/reference/classes/BaseAdapter.md +++ b/docs/reference/classes/BaseAdapter.md @@ -42,15 +42,15 @@ Generic parameters: ### TModelInputModalitiesByName -`TModelInputModalitiesByName` *extends* `Record`\<`string`, `ReadonlyArray`\<[`Modality`](../../type-aliases/Modality.md)\>\> = `Record`\<`string`, `ReadonlyArray`\<[`Modality`](../../type-aliases/Modality.md)\>\> +`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) +`TMessageMetadataByModality` *extends* `object` = [`DefaultMessageMetadataByModality`](../interfaces/DefaultMessageMetadataByModality.md) ## Implements -- [`AIAdapter`](../../interfaces/AIAdapter.md)\<`TChatModels`, `TEmbeddingModels`, `TChatProviderOptions`, `TEmbeddingProviderOptions`, `TModelProviderOptionsByName`, `TModelInputModalitiesByName`, `TMessageMetadataByModality`\> +- [`AIAdapter`](../interfaces/AIAdapter.md)\<`TChatModels`, `TEmbeddingModels`, `TChatProviderOptions`, `TEmbeddingProviderOptions`, `TModelProviderOptionsByName`, `TModelInputModalitiesByName`, `TMessageMetadataByModality`\> ## Constructors @@ -66,7 +66,7 @@ Defined in: [base-adapter.ts:69](https://github.com/TanStack/ai/blob/main/packag ##### config -[`AIAdapterConfig`](../../interfaces/AIAdapterConfig.md) = `{}` +[`AIAdapterConfig`](../interfaces/AIAdapterConfig.md) = `{}` #### Returns @@ -84,7 +84,7 @@ Defined in: [base-adapter.ts:60](https://github.com/TanStack/ai/blob/main/packag #### Implementation of -[`AIAdapter`](../../interfaces/AIAdapter.md).[`_chatProviderOptions`](../../interfaces/AIAdapter.md#_chatprovideroptions) +[`AIAdapter`](../interfaces/AIAdapter.md).[`_chatProviderOptions`](../interfaces/AIAdapter.md#_chatprovideroptions) *** @@ -98,7 +98,7 @@ Defined in: [base-adapter.ts:61](https://github.com/TanStack/ai/blob/main/packag #### Implementation of -[`AIAdapter`](../../interfaces/AIAdapter.md).[`_embeddingProviderOptions`](../../interfaces/AIAdapter.md#_embeddingprovideroptions) +[`AIAdapter`](../interfaces/AIAdapter.md).[`_embeddingProviderOptions`](../interfaces/AIAdapter.md#_embeddingprovideroptions) *** @@ -115,7 +115,7 @@ Used to provide type-safe autocomplete for metadata on content parts. #### Implementation of -[`AIAdapter`](../../interfaces/AIAdapter.md).[`_messageMetadataByModality`](../../interfaces/AIAdapter.md#_messagemetadatabymodality) +[`AIAdapter`](../interfaces/AIAdapter.md).[`_messageMetadataByModality`](../interfaces/AIAdapter.md#_messagemetadatabymodality) *** @@ -133,7 +133,7 @@ Must be provided by all adapters. #### Implementation of -[`AIAdapter`](../../interfaces/AIAdapter.md).[`_modelInputModalitiesByName`](../../interfaces/AIAdapter.md#_modelinputmodalitiesbyname) +[`AIAdapter`](../interfaces/AIAdapter.md).[`_modelInputModalitiesByName`](../interfaces/AIAdapter.md#_modelinputmodalitiesbyname) *** @@ -151,7 +151,7 @@ Must be provided by all adapters. #### Implementation of -[`AIAdapter`](../../interfaces/AIAdapter.md).[`_modelProviderOptionsByName`](../../interfaces/AIAdapter.md#_modelprovideroptionsbyname) +[`AIAdapter`](../interfaces/AIAdapter.md).[`_modelProviderOptionsByName`](../interfaces/AIAdapter.md#_modelprovideroptionsbyname) *** @@ -165,7 +165,7 @@ Defined in: [base-adapter.ts:59](https://github.com/TanStack/ai/blob/main/packag #### Implementation of -[`AIAdapter`](../../interfaces/AIAdapter.md).[`_providerOptions`](../../interfaces/AIAdapter.md#_provideroptions) +[`AIAdapter`](../interfaces/AIAdapter.md).[`_providerOptions`](../interfaces/AIAdapter.md#_provideroptions) *** @@ -191,7 +191,7 @@ Models that support embeddings #### Implementation of -[`AIAdapter`](../../interfaces/AIAdapter.md).[`embeddingModels`](../../interfaces/AIAdapter.md#embeddingmodels) +[`AIAdapter`](../interfaces/AIAdapter.md).[`embeddingModels`](../interfaces/AIAdapter.md#embeddingmodels) *** @@ -207,7 +207,7 @@ Models that support chat/text completion #### Implementation of -[`AIAdapter`](../../interfaces/AIAdapter.md).[`models`](../../interfaces/AIAdapter.md#models) +[`AIAdapter`](../interfaces/AIAdapter.md).[`models`](../interfaces/AIAdapter.md#models) *** @@ -221,7 +221,7 @@ Defined in: [base-adapter.ts:53](https://github.com/TanStack/ai/blob/main/packag #### Implementation of -[`AIAdapter`](../../interfaces/AIAdapter.md).[`name`](../../interfaces/AIAdapter.md#name) +[`AIAdapter`](../interfaces/AIAdapter.md).[`name`](../interfaces/AIAdapter.md#name) ## Methods @@ -237,15 +237,15 @@ Defined in: [base-adapter.ts:73](https://github.com/TanStack/ai/blob/main/packag ##### options -[`ChatOptions`](../../interfaces/ChatOptions.md) +[`ChatOptions`](../interfaces/ChatOptions.md) #### Returns -`AsyncIterable`\<[`StreamChunk`](../../type-aliases/StreamChunk.md)\> +`AsyncIterable`\<[`StreamChunk`](../type-aliases/StreamChunk.md)\> #### Implementation of -[`AIAdapter`](../../interfaces/AIAdapter.md).[`chatStream`](../../interfaces/AIAdapter.md#chatstream) +[`AIAdapter`](../interfaces/AIAdapter.md).[`chatStream`](../interfaces/AIAdapter.md#chatstream) *** @@ -261,15 +261,15 @@ Defined in: [base-adapter.ts:78](https://github.com/TanStack/ai/blob/main/packag ##### options -[`EmbeddingOptions`](../../interfaces/EmbeddingOptions.md) +[`EmbeddingOptions`](../interfaces/EmbeddingOptions.md) #### Returns -`Promise`\<[`EmbeddingResult`](../../interfaces/EmbeddingResult.md)\> +`Promise`\<[`EmbeddingResult`](../interfaces/EmbeddingResult.md)\> #### Implementation of -[`AIAdapter`](../../interfaces/AIAdapter.md).[`createEmbeddings`](../../interfaces/AIAdapter.md#createembeddings) +[`AIAdapter`](../interfaces/AIAdapter.md).[`createEmbeddings`](../interfaces/AIAdapter.md#createembeddings) *** @@ -299,12 +299,12 @@ Defined in: [base-adapter.ts:75](https://github.com/TanStack/ai/blob/main/packag ##### options -[`SummarizationOptions`](../../interfaces/SummarizationOptions.md) +[`SummarizationOptions`](../interfaces/SummarizationOptions.md) #### Returns -`Promise`\<[`SummarizationResult`](../../interfaces/SummarizationResult.md)\> +`Promise`\<[`SummarizationResult`](../interfaces/SummarizationResult.md)\> #### Implementation of -[`AIAdapter`](../../interfaces/AIAdapter.md).[`summarize`](../../interfaces/AIAdapter.md#summarize) +[`AIAdapter`](../interfaces/AIAdapter.md).[`summarize`](../interfaces/AIAdapter.md#summarize) diff --git a/docs/reference/classes/BatchStrategy.md b/docs/reference/classes/BatchStrategy.md index d554dae3..a437b0aa 100644 --- a/docs/reference/classes/BatchStrategy.md +++ b/docs/reference/classes/BatchStrategy.md @@ -12,7 +12,7 @@ Useful for reducing UI update frequency ## Implements -- [`ChunkStrategy`](../../interfaces/ChunkStrategy.md) +- [`ChunkStrategy`](../interfaces/ChunkStrategy.md) ## Constructors @@ -52,7 +52,7 @@ Optional: Reset strategy state (called when streaming starts) #### Implementation of -[`ChunkStrategy`](../../interfaces/ChunkStrategy.md).[`reset`](../../interfaces/ChunkStrategy.md#reset) +[`ChunkStrategy`](../interfaces/ChunkStrategy.md).[`reset`](../interfaces/ChunkStrategy.md#reset) *** @@ -84,4 +84,4 @@ true if an update should be emitted now #### Implementation of -[`ChunkStrategy`](../../interfaces/ChunkStrategy.md).[`shouldEmit`](../../interfaces/ChunkStrategy.md#shouldemit) +[`ChunkStrategy`](../interfaces/ChunkStrategy.md).[`shouldEmit`](../interfaces/ChunkStrategy.md#shouldemit) diff --git a/docs/reference/classes/CompositeStrategy.md b/docs/reference/classes/CompositeStrategy.md index d1b1ff5d..5c6f71e3 100644 --- a/docs/reference/classes/CompositeStrategy.md +++ b/docs/reference/classes/CompositeStrategy.md @@ -12,7 +12,7 @@ Emits if ANY strategy says to emit ## Implements -- [`ChunkStrategy`](../../interfaces/ChunkStrategy.md) +- [`ChunkStrategy`](../interfaces/ChunkStrategy.md) ## Constructors @@ -28,7 +28,7 @@ Defined in: [stream/strategies.ts:69](https://github.com/TanStack/ai/blob/main/p ##### strategies -[`ChunkStrategy`](../../interfaces/ChunkStrategy.md)[] +[`ChunkStrategy`](../interfaces/ChunkStrategy.md)[] #### Returns @@ -52,7 +52,7 @@ Optional: Reset strategy state (called when streaming starts) #### Implementation of -[`ChunkStrategy`](../../interfaces/ChunkStrategy.md).[`reset`](../../interfaces/ChunkStrategy.md#reset) +[`ChunkStrategy`](../interfaces/ChunkStrategy.md).[`reset`](../interfaces/ChunkStrategy.md#reset) *** @@ -88,4 +88,4 @@ true if an update should be emitted now #### Implementation of -[`ChunkStrategy`](../../interfaces/ChunkStrategy.md).[`shouldEmit`](../../interfaces/ChunkStrategy.md#shouldemit) +[`ChunkStrategy`](../interfaces/ChunkStrategy.md).[`shouldEmit`](../interfaces/ChunkStrategy.md#shouldemit) diff --git a/docs/reference/classes/ImmediateStrategy.md b/docs/reference/classes/ImmediateStrategy.md index 193024ab..fcf89ea0 100644 --- a/docs/reference/classes/ImmediateStrategy.md +++ b/docs/reference/classes/ImmediateStrategy.md @@ -11,7 +11,7 @@ Immediate Strategy - emit on every chunk (default behavior) ## Implements -- [`ChunkStrategy`](../../interfaces/ChunkStrategy.md) +- [`ChunkStrategy`](../interfaces/ChunkStrategy.md) ## Constructors @@ -55,4 +55,4 @@ true if an update should be emitted now #### Implementation of -[`ChunkStrategy`](../../interfaces/ChunkStrategy.md).[`shouldEmit`](../../interfaces/ChunkStrategy.md#shouldemit) +[`ChunkStrategy`](../interfaces/ChunkStrategy.md).[`shouldEmit`](../interfaces/ChunkStrategy.md#shouldemit) diff --git a/docs/reference/classes/PartialJSONParser.md b/docs/reference/classes/PartialJSONParser.md index 8d1ff979..59fdcfb0 100644 --- a/docs/reference/classes/PartialJSONParser.md +++ b/docs/reference/classes/PartialJSONParser.md @@ -12,7 +12,7 @@ This parser can handle incomplete JSON strings during streaming ## Implements -- [`JSONParser`](../../interfaces/JSONParser.md) +- [`JSONParser`](../interfaces/JSONParser.md) ## Constructors @@ -54,4 +54,4 @@ The parsed object, or undefined if parsing fails #### Implementation of -[`JSONParser`](../../interfaces/JSONParser.md).[`parse`](../../interfaces/JSONParser.md#parse) +[`JSONParser`](../interfaces/JSONParser.md).[`parse`](../interfaces/JSONParser.md#parse) diff --git a/docs/reference/classes/PunctuationStrategy.md b/docs/reference/classes/PunctuationStrategy.md index 19ff1ec2..f5e1ebe4 100644 --- a/docs/reference/classes/PunctuationStrategy.md +++ b/docs/reference/classes/PunctuationStrategy.md @@ -12,7 +12,7 @@ Useful for natural text flow in UI ## Implements -- [`ChunkStrategy`](../../interfaces/ChunkStrategy.md) +- [`ChunkStrategy`](../interfaces/ChunkStrategy.md) ## Constructors @@ -58,4 +58,4 @@ true if an update should be emitted now #### Implementation of -[`ChunkStrategy`](../../interfaces/ChunkStrategy.md).[`shouldEmit`](../../interfaces/ChunkStrategy.md#shouldemit) +[`ChunkStrategy`](../interfaces/ChunkStrategy.md).[`shouldEmit`](../interfaces/ChunkStrategy.md#shouldemit) diff --git a/docs/reference/classes/StreamProcessor.md b/docs/reference/classes/StreamProcessor.md index 4e788cf8..61441e4f 100644 --- a/docs/reference/classes/StreamProcessor.md +++ b/docs/reference/classes/StreamProcessor.md @@ -37,7 +37,7 @@ Defined in: [stream/processor.ts:200](https://github.com/TanStack/ai/blob/main/p ##### options -[`StreamProcessorOptions`](../../interfaces/StreamProcessorOptions.md) = `{}` +[`StreamProcessorOptions`](../interfaces/StreamProcessorOptions.md) = `{}` #### Returns @@ -122,7 +122,7 @@ Add a user message to the conversation #### Returns -[`UIMessage`](../../interfaces/UIMessage.md) +[`UIMessage`](../interfaces/UIMessage.md) *** @@ -187,7 +187,7 @@ Get current messages #### Returns -[`UIMessage`](../../interfaces/UIMessage.md)[] +[`UIMessage`](../interfaces/UIMessage.md)[] *** @@ -203,7 +203,7 @@ Get the current recording #### Returns -[`ChunkRecording`](../../interfaces/ChunkRecording.md) \| `null` +[`ChunkRecording`](../interfaces/ChunkRecording.md) \| `null` *** @@ -219,7 +219,7 @@ Get current processor state (legacy) #### Returns -[`ProcessorState`](../../interfaces/ProcessorState.md) +[`ProcessorState`](../interfaces/ProcessorState.md) *** @@ -241,7 +241,7 @@ Process a stream and emit events through handlers #### Returns -`Promise`\<[`ProcessorResult`](../../interfaces/ProcessorResult.md)\> +`Promise`\<[`ProcessorResult`](../interfaces/ProcessorResult.md)\> *** @@ -259,7 +259,7 @@ Process a single chunk from the stream ##### chunk -[`StreamChunk`](../../type-aliases/StreamChunk.md) +[`StreamChunk`](../type-aliases/StreamChunk.md) #### Returns @@ -319,7 +319,7 @@ Set the messages array (e.g., from persisted state) ##### messages -[`UIMessage`](../../interfaces/UIMessage.md)[] +[`UIMessage`](../interfaces/UIMessage.md)[] #### Returns @@ -375,9 +375,9 @@ Get the conversation as ModelMessages (for sending to LLM) #### Returns -[`ModelMessage`](../../interfaces/ModelMessage.md)\< +[`ModelMessage`](../interfaces/ModelMessage.md)\< \| `string` - \| [`ContentPart`](../../type-aliases/ContentPart.md)\<`unknown`, `unknown`, `unknown`, `unknown`\>[] + \| [`ContentPart`](../type-aliases/ContentPart.md)\<`unknown`, `unknown`, `unknown`, `unknown`\>[] \| `null`\>[] *** @@ -396,12 +396,12 @@ Replay a recording through the processor ##### recording -[`ChunkRecording`](../../interfaces/ChunkRecording.md) +[`ChunkRecording`](../interfaces/ChunkRecording.md) ##### options? -[`StreamProcessorOptions`](../../interfaces/StreamProcessorOptions.md) +[`StreamProcessorOptions`](../interfaces/StreamProcessorOptions.md) #### Returns -`Promise`\<[`ProcessorResult`](../../interfaces/ProcessorResult.md)\> +`Promise`\<[`ProcessorResult`](../interfaces/ProcessorResult.md)\> diff --git a/docs/reference/classes/ToolCallManager.md b/docs/reference/classes/ToolCallManager.md index 12c940b7..331d7623 100644 --- a/docs/reference/classes/ToolCallManager.md +++ b/docs/reference/classes/ToolCallManager.md @@ -53,7 +53,7 @@ Defined in: [tools/tool-calls.ts:45](https://github.com/TanStack/ai/blob/main/pa ##### tools -readonly [`Tool`](../../interfaces/Tool.md)\<`ZodType`\<`unknown`, `unknown`, `$ZodTypeInternals`\<`unknown`, `unknown`\>\>, `ZodType`\<`unknown`, `unknown`, `$ZodTypeInternals`\<`unknown`, `unknown`\>\>, `string`\>[] +readonly [`Tool`](../interfaces/Tool.md)\<`ZodType`\<`unknown`, `unknown`, `$ZodTypeInternals`\<`unknown`, `unknown`\>\>, `ZodType`\<`unknown`, `unknown`, `$ZodTypeInternals`\<`unknown`, `unknown`\>\>, `string`\>[] #### Returns @@ -154,13 +154,13 @@ Also yields tool_result chunks for streaming ##### doneChunk -[`DoneStreamChunk`](../../interfaces/DoneStreamChunk.md) +[`DoneStreamChunk`](../interfaces/DoneStreamChunk.md) #### Returns -`AsyncGenerator`\<[`ToolResultStreamChunk`](../../interfaces/ToolResultStreamChunk.md), [`ModelMessage`](../../interfaces/ModelMessage.md)\< +`AsyncGenerator`\<[`ToolResultStreamChunk`](../interfaces/ToolResultStreamChunk.md), [`ModelMessage`](../interfaces/ModelMessage.md)\< \| `string` - \| [`ContentPart`](../../type-aliases/ContentPart.md)\<`unknown`, `unknown`, `unknown`, `unknown`\>[] + \| [`ContentPart`](../type-aliases/ContentPart.md)\<`unknown`, `unknown`, `unknown`, `unknown`\>[] \| `null`\>[], `void`\> *** @@ -177,7 +177,7 @@ Get all complete tool calls (filtered for valid ID and name) #### Returns -[`ToolCall`](../../interfaces/ToolCall.md)[] +[`ToolCall`](../interfaces/ToolCall.md)[] *** diff --git a/docs/reference/classes/WordBoundaryStrategy.md b/docs/reference/classes/WordBoundaryStrategy.md index 16c593c7..985ce4f6 100644 --- a/docs/reference/classes/WordBoundaryStrategy.md +++ b/docs/reference/classes/WordBoundaryStrategy.md @@ -12,7 +12,7 @@ Prevents cutting words in half ## Implements -- [`ChunkStrategy`](../../interfaces/ChunkStrategy.md) +- [`ChunkStrategy`](../interfaces/ChunkStrategy.md) ## Constructors @@ -58,4 +58,4 @@ true if an update should be emitted now #### Implementation of -[`ChunkStrategy`](../../interfaces/ChunkStrategy.md).[`shouldEmit`](../../interfaces/ChunkStrategy.md#shouldemit) +[`ChunkStrategy`](../interfaces/ChunkStrategy.md).[`shouldEmit`](../interfaces/ChunkStrategy.md#shouldemit) diff --git a/docs/reference/functions/chat.md b/docs/reference/functions/chat.md index 341ecd90..16934d76 100644 --- a/docs/reference/functions/chat.md +++ b/docs/reference/functions/chat.md @@ -19,7 +19,7 @@ Includes automatic tool execution loop ### TAdapter -`TAdapter` *extends* [`AIAdapter`](../../interfaces/AIAdapter.md)\<`any`, `any`, `any`, `any`, `any`, `any`, [`DefaultMessageMetadataByModality`](../../interfaces/DefaultMessageMetadataByModality.md)\> +`TAdapter` *extends* [`AIAdapter`](../interfaces/AIAdapter.md)\<`any`, `any`, `any`, `any`, `any`, `any`, [`DefaultMessageMetadataByModality`](../interfaces/DefaultMessageMetadataByModality.md)\> ### TModel @@ -29,13 +29,13 @@ Includes automatic tool execution loop ### options -[`ChatStreamOptionsForModel`](../../type-aliases/ChatStreamOptionsForModel.md)\<`TAdapter`, `TModel`\> +[`ChatStreamOptionsForModel`](../type-aliases/ChatStreamOptionsForModel.md)\<`TAdapter`, `TModel`\> Chat options ## Returns -`AsyncIterable`\<[`StreamChunk`](../../type-aliases/StreamChunk.md)\> +`AsyncIterable`\<[`StreamChunk`](../type-aliases/StreamChunk.md)\> ## Example diff --git a/docs/reference/functions/chatOptions.md b/docs/reference/functions/chatOptions.md index b8392e4a..d776680b 100644 --- a/docs/reference/functions/chatOptions.md +++ b/docs/reference/functions/chatOptions.md @@ -15,7 +15,7 @@ Defined in: [utilities/chat-options.ts:3](https://github.com/TanStack/ai/blob/ma ### 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* [`AIAdapter`](../interfaces/AIAdapter.md)\<`any`, `any`, `any`, `any`, `any`, `Record`\<`string`, readonly [`Modality`](../type-aliases/Modality.md)[]\>, [`DefaultMessageMetadataByModality`](../interfaces/DefaultMessageMetadataByModality.md)\> ### TModel @@ -25,8 +25,8 @@ Defined in: [utilities/chat-options.ts:3](https://github.com/TanStack/ai/blob/ma ### options -`Omit`\<[`ChatStreamOptionsUnion`](../../type-aliases/ChatStreamOptionsUnion.md)\<`TAdapter`\>, `"model"` \| `"providerOptions"` \| `"messages"` \| `"abortController"`\> & `object` +`Omit`\<[`ChatStreamOptionsUnion`](../type-aliases/ChatStreamOptionsUnion.md)\<`TAdapter`\>, `"model"` \| `"providerOptions"` \| `"messages"` \| `"abortController"`\> & `object` ## Returns -`Omit`\<[`ChatStreamOptionsUnion`](../../type-aliases/ChatStreamOptionsUnion.md)\<`TAdapter`\>, `"model"` \| `"providerOptions"` \| `"messages"` \| `"abortController"`\> & `object` +`Omit`\<[`ChatStreamOptionsUnion`](../type-aliases/ChatStreamOptionsUnion.md)\<`TAdapter`\>, `"model"` \| `"providerOptions"` \| `"messages"` \| `"abortController"`\> & `object` diff --git a/docs/reference/functions/combineStrategies.md b/docs/reference/functions/combineStrategies.md index 4821bbef..454a0f33 100644 --- a/docs/reference/functions/combineStrategies.md +++ b/docs/reference/functions/combineStrategies.md @@ -18,13 +18,13 @@ All strategies must return true to continue ### strategies -[`AgentLoopStrategy`](../../type-aliases/AgentLoopStrategy.md)[] +[`AgentLoopStrategy`](../type-aliases/AgentLoopStrategy.md)[] Array of strategies to combine ## Returns -[`AgentLoopStrategy`](../../type-aliases/AgentLoopStrategy.md) +[`AgentLoopStrategy`](../type-aliases/AgentLoopStrategy.md) AgentLoopStrategy that continues only if all strategies return true diff --git a/docs/reference/functions/convertMessagesToModelMessages.md b/docs/reference/functions/convertMessagesToModelMessages.md index 4f221409..93e01799 100644 --- a/docs/reference/functions/convertMessagesToModelMessages.md +++ b/docs/reference/functions/convertMessagesToModelMessages.md @@ -21,15 +21,15 @@ Convert UIMessages or ModelMessages to ModelMessages ### messages ( - \| [`UIMessage`](../../interfaces/UIMessage.md) - \| [`ModelMessage`](../../interfaces/ModelMessage.md)\< + \| [`UIMessage`](../interfaces/UIMessage.md) + \| [`ModelMessage`](../interfaces/ModelMessage.md)\< \| `string` - \| [`ContentPart`](../../type-aliases/ContentPart.md)\<`unknown`, `unknown`, `unknown`, `unknown`\>[] + \| [`ContentPart`](../type-aliases/ContentPart.md)\<`unknown`, `unknown`, `unknown`, `unknown`\>[] \| `null`\>)[] ## Returns -[`ModelMessage`](../../interfaces/ModelMessage.md)\< +[`ModelMessage`](../interfaces/ModelMessage.md)\< \| `string` - \| [`ContentPart`](../../type-aliases/ContentPart.md)\<`unknown`, `unknown`, `unknown`, `unknown`\>[] + \| [`ContentPart`](../type-aliases/ContentPart.md)\<`unknown`, `unknown`, `unknown`, `unknown`\>[] \| `null`\>[] diff --git a/docs/reference/functions/createReplayStream.md b/docs/reference/functions/createReplayStream.md index 1f22e37e..39ec2a49 100644 --- a/docs/reference/functions/createReplayStream.md +++ b/docs/reference/functions/createReplayStream.md @@ -17,8 +17,8 @@ Create an async iterable from a recording ### recording -[`ChunkRecording`](../../interfaces/ChunkRecording.md) +[`ChunkRecording`](../interfaces/ChunkRecording.md) ## Returns -`AsyncIterable`\<[`StreamChunk`](../../type-aliases/StreamChunk.md)\> +`AsyncIterable`\<[`StreamChunk`](../type-aliases/StreamChunk.md)\> diff --git a/docs/reference/functions/embedding.md b/docs/reference/functions/embedding.md index e2a9666d..058e3ff4 100644 --- a/docs/reference/functions/embedding.md +++ b/docs/reference/functions/embedding.md @@ -17,14 +17,14 @@ Standalone embedding function with type inference from adapter ### 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* [`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` +`Omit`\<[`EmbeddingOptions`](../interfaces/EmbeddingOptions.md), `"model"`\> & `object` ## Returns -`Promise`\<[`EmbeddingResult`](../../interfaces/EmbeddingResult.md)\> +`Promise`\<[`EmbeddingResult`](../interfaces/EmbeddingResult.md)\> diff --git a/docs/reference/functions/maxIterations.md b/docs/reference/functions/maxIterations.md index 696ccfad..1ab98cda 100644 --- a/docs/reference/functions/maxIterations.md +++ b/docs/reference/functions/maxIterations.md @@ -23,7 +23,7 @@ Maximum number of iterations to allow ## Returns -[`AgentLoopStrategy`](../../type-aliases/AgentLoopStrategy.md) +[`AgentLoopStrategy`](../type-aliases/AgentLoopStrategy.md) AgentLoopStrategy that stops after max iterations diff --git a/docs/reference/functions/messages.md b/docs/reference/functions/messages.md index c66bb998..b9f3829e 100644 --- a/docs/reference/functions/messages.md +++ b/docs/reference/functions/messages.md @@ -30,7 +30,7 @@ combining typed messages with untyped data (like from request.json()). ### TAdapter -`TAdapter` *extends* [`AIAdapter`](../../interfaces/AIAdapter.md)\<`any`, `any`, `any`, `any`, `any`, `any`, [`DefaultMessageMetadataByModality`](../../interfaces/DefaultMessageMetadataByModality.md)\> +`TAdapter` *extends* [`AIAdapter`](../interfaces/AIAdapter.md)\<`any`, `any`, `any`, `any`, `any`, `any`, [`DefaultMessageMetadataByModality`](../interfaces/DefaultMessageMetadataByModality.md)\> ### TModel @@ -50,28 +50,28 @@ combining typed messages with untyped data (like from request.json()). ### 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)\< +`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`\>[] - \| `null`\>[] : [`ModelMessage`](../../interfaces/ModelMessage.md)\< + \| [`ContentPart`](../type-aliases/ContentPart.md)\<`unknown`, `unknown`, `unknown`, `unknown`\>[] + \| `null`\>[] : [`ModelMessage`](../interfaces/ModelMessage.md)\< \| `string` - \| [`ContentPart`](../../type-aliases/ContentPart.md)\<`unknown`, `unknown`, `unknown`, `unknown`\>[] - \| `null`\>[] : [`ModelMessage`](../../interfaces/ModelMessage.md)\< + \| [`ContentPart`](../type-aliases/ContentPart.md)\<`unknown`, `unknown`, `unknown`, `unknown`\>[] + \| `null`\>[] : [`ModelMessage`](../interfaces/ModelMessage.md)\< \| `string` - \| [`ContentPart`](../../type-aliases/ContentPart.md)\<`unknown`, `unknown`, `unknown`, `unknown`\>[] + \| [`ContentPart`](../type-aliases/ContentPart.md)\<`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)\< +`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`\>[] - \| `null`\>[] : [`ModelMessage`](../../interfaces/ModelMessage.md)\< + \| [`ContentPart`](../type-aliases/ContentPart.md)\<`unknown`, `unknown`, `unknown`, `unknown`\>[] + \| `null`\>[] : [`ModelMessage`](../interfaces/ModelMessage.md)\< \| `string` - \| [`ContentPart`](../../type-aliases/ContentPart.md)\<`unknown`, `unknown`, `unknown`, `unknown`\>[] - \| `null`\>[] : [`ModelMessage`](../../interfaces/ModelMessage.md)\< + \| [`ContentPart`](../type-aliases/ContentPart.md)\<`unknown`, `unknown`, `unknown`, `unknown`\>[] + \| `null`\>[] : [`ModelMessage`](../interfaces/ModelMessage.md)\< \| `string` - \| [`ContentPart`](../../type-aliases/ContentPart.md)\<`unknown`, `unknown`, `unknown`, `unknown`\>[] + \| [`ContentPart`](../type-aliases/ContentPart.md)\<`unknown`, `unknown`, `unknown`, `unknown`\>[] \| `null`\>[] ## Example diff --git a/docs/reference/functions/modelMessageToUIMessage.md b/docs/reference/functions/modelMessageToUIMessage.md index 79e1240c..02e80f8d 100644 --- a/docs/reference/functions/modelMessageToUIMessage.md +++ b/docs/reference/functions/modelMessageToUIMessage.md @@ -22,7 +22,7 @@ This conversion creates a parts-based structure: ### modelMessage -[`ModelMessage`](../../interfaces/ModelMessage.md) +[`ModelMessage`](../interfaces/ModelMessage.md) The ModelMessage to convert @@ -34,6 +34,6 @@ Optional ID for the UIMessage (generated if not provided) ## Returns -[`UIMessage`](../../interfaces/UIMessage.md) +[`UIMessage`](../interfaces/UIMessage.md) A UIMessage with parts diff --git a/docs/reference/functions/modelMessagesToUIMessages.md b/docs/reference/functions/modelMessagesToUIMessages.md index 3acd73e6..cc934bcc 100644 --- a/docs/reference/functions/modelMessagesToUIMessages.md +++ b/docs/reference/functions/modelMessagesToUIMessages.md @@ -19,15 +19,15 @@ This handles merging tool result messages with their corresponding assistant mes ### modelMessages -[`ModelMessage`](../../interfaces/ModelMessage.md)\< +[`ModelMessage`](../interfaces/ModelMessage.md)\< \| `string` - \| [`ContentPart`](../../type-aliases/ContentPart.md)\<`unknown`, `unknown`, `unknown`, `unknown`\>[] + \| [`ContentPart`](../type-aliases/ContentPart.md)\<`unknown`, `unknown`, `unknown`, `unknown`\>[] \| `null`\>[] Array of ModelMessages to convert ## Returns -[`UIMessage`](../../interfaces/UIMessage.md)[] +[`UIMessage`](../interfaces/UIMessage.md)[] Array of UIMessages diff --git a/docs/reference/functions/normalizeToUIMessage.md b/docs/reference/functions/normalizeToUIMessage.md index 47af62c8..f21cf9bc 100644 --- a/docs/reference/functions/normalizeToUIMessage.md +++ b/docs/reference/functions/normalizeToUIMessage.md @@ -20,9 +20,9 @@ Ensures the message has an ID and createdAt timestamp Either a UIMessage or ModelMessage -[`UIMessage`](../../interfaces/UIMessage.md) | [`ModelMessage`](../../interfaces/ModelMessage.md)\< +[`UIMessage`](../interfaces/UIMessage.md) | [`ModelMessage`](../interfaces/ModelMessage.md)\< \| `string` -\| [`ContentPart`](../../type-aliases/ContentPart.md)\<`unknown`, `unknown`, `unknown`, `unknown`\>[] +\| [`ContentPart`](../type-aliases/ContentPart.md)\<`unknown`, `unknown`, `unknown`, `unknown`\>[] \| `null`\> ### generateId @@ -33,6 +33,6 @@ Function to generate a message ID if needed ## Returns -[`UIMessage`](../../interfaces/UIMessage.md) +[`UIMessage`](../interfaces/UIMessage.md) A UIMessage with guaranteed id and createdAt diff --git a/docs/reference/functions/summarize.md b/docs/reference/functions/summarize.md index 46a610d0..2ae9aead 100644 --- a/docs/reference/functions/summarize.md +++ b/docs/reference/functions/summarize.md @@ -17,14 +17,14 @@ Standalone summarize function with type inference from adapter ### 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* [`AIAdapter`](../interfaces/AIAdapter.md)\<`any`, `any`, `any`, `any`, `any`, `Record`\<`string`, readonly [`Modality`](../type-aliases/Modality.md)[]\>, [`DefaultMessageMetadataByModality`](../interfaces/DefaultMessageMetadataByModality.md)\> ## Parameters ### options -`Omit`\<[`SummarizationOptions`](../../interfaces/SummarizationOptions.md), `"model"`\> & `object` +`Omit`\<[`SummarizationOptions`](../interfaces/SummarizationOptions.md), `"model"`\> & `object` ## Returns -`Promise`\<[`SummarizationResult`](../../interfaces/SummarizationResult.md)\> +`Promise`\<[`SummarizationResult`](../interfaces/SummarizationResult.md)\> diff --git a/docs/reference/functions/toServerSentEventsStream.md b/docs/reference/functions/toServerSentEventsStream.md index 7cbeffe5..65582450 100644 --- a/docs/reference/functions/toServerSentEventsStream.md +++ b/docs/reference/functions/toServerSentEventsStream.md @@ -22,7 +22,7 @@ This creates a ReadableStream that emits chunks in SSE format: ### stream -`AsyncIterable`\<[`StreamChunk`](../../type-aliases/StreamChunk.md)\> +`AsyncIterable`\<[`StreamChunk`](../type-aliases/StreamChunk.md)\> AsyncIterable of StreamChunks from chat() diff --git a/docs/reference/functions/toStreamResponse.md b/docs/reference/functions/toStreamResponse.md index 883a9e22..0753057c 100644 --- a/docs/reference/functions/toStreamResponse.md +++ b/docs/reference/functions/toStreamResponse.md @@ -18,7 +18,7 @@ Includes proper headers for Server-Sent Events ### stream -`AsyncIterable`\<[`StreamChunk`](../../type-aliases/StreamChunk.md)\> +`AsyncIterable`\<[`StreamChunk`](../type-aliases/StreamChunk.md)\> AsyncIterable of StreamChunks from chat() diff --git a/docs/reference/functions/toolDefinition.md b/docs/reference/functions/toolDefinition.md index 03dec22b..46017b07 100644 --- a/docs/reference/functions/toolDefinition.md +++ b/docs/reference/functions/toolDefinition.md @@ -36,11 +36,11 @@ The definition contains all tool metadata (name, description, schemas) and can b ### config -[`ToolDefinitionConfig`](../../interfaces/ToolDefinitionConfig.md)\<`TInput`, `TOutput`, `TName`\> +[`ToolDefinitionConfig`](../interfaces/ToolDefinitionConfig.md)\<`TInput`, `TOutput`, `TName`\> ## Returns -[`ToolDefinition`](../../interfaces/ToolDefinition.md)\<`TInput`, `TOutput`, `TName`\> +[`ToolDefinition`](../interfaces/ToolDefinition.md)\<`TInput`, `TOutput`, `TName`\> ## Example diff --git a/docs/reference/functions/uiMessageToModelMessages.md b/docs/reference/functions/uiMessageToModelMessages.md index f43c6e60..60cd43bf 100644 --- a/docs/reference/functions/uiMessageToModelMessages.md +++ b/docs/reference/functions/uiMessageToModelMessages.md @@ -25,15 +25,15 @@ This conversion handles the parts-based structure: ### uiMessage -[`UIMessage`](../../interfaces/UIMessage.md) +[`UIMessage`](../interfaces/UIMessage.md) The UIMessage to convert ## Returns -[`ModelMessage`](../../interfaces/ModelMessage.md)\< +[`ModelMessage`](../interfaces/ModelMessage.md)\< \| `string` - \| [`ContentPart`](../../type-aliases/ContentPart.md)\<`unknown`, `unknown`, `unknown`, `unknown`\>[] + \| [`ContentPart`](../type-aliases/ContentPart.md)\<`unknown`, `unknown`, `unknown`, `unknown`\>[] \| `null`\>[] An array of ModelMessages (may be multiple if tool results are present) diff --git a/docs/reference/functions/untilFinishReason.md b/docs/reference/functions/untilFinishReason.md index 02f697ba..2522b3f0 100644 --- a/docs/reference/functions/untilFinishReason.md +++ b/docs/reference/functions/untilFinishReason.md @@ -23,7 +23,7 @@ Finish reasons that should stop the loop ## Returns -[`AgentLoopStrategy`](../../type-aliases/AgentLoopStrategy.md) +[`AgentLoopStrategy`](../type-aliases/AgentLoopStrategy.md) AgentLoopStrategy that stops on specific finish reasons diff --git a/docs/reference/index.md b/docs/reference/index.md index fe15ddfb..118e4642 100644 --- a/docs/reference/index.md +++ b/docs/reference/index.md @@ -7,114 +7,114 @@ title: "@tanstack/ai" ## Classes -- [BaseAdapter](../classes/BaseAdapter.md) -- [BatchStrategy](../classes/BatchStrategy.md) -- [CompositeStrategy](../classes/CompositeStrategy.md) -- [ImmediateStrategy](../classes/ImmediateStrategy.md) -- [PartialJSONParser](../classes/PartialJSONParser.md) -- [PunctuationStrategy](../classes/PunctuationStrategy.md) -- [StreamProcessor](../classes/StreamProcessor.md) -- [ToolCallManager](../classes/ToolCallManager.md) -- [WordBoundaryStrategy](../classes/WordBoundaryStrategy.md) +- [BaseAdapter](classes/BaseAdapter.md) +- [BatchStrategy](classes/BatchStrategy.md) +- [CompositeStrategy](classes/CompositeStrategy.md) +- [ImmediateStrategy](classes/ImmediateStrategy.md) +- [PartialJSONParser](classes/PartialJSONParser.md) +- [PunctuationStrategy](classes/PunctuationStrategy.md) +- [StreamProcessor](classes/StreamProcessor.md) +- [ToolCallManager](classes/ToolCallManager.md) +- [WordBoundaryStrategy](classes/WordBoundaryStrategy.md) ## 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) -- [ChatCompletionChunk](../interfaces/ChatCompletionChunk.md) -- [ChatOptions](../interfaces/ChatOptions.md) -- [ChunkRecording](../interfaces/ChunkRecording.md) -- [ChunkStrategy](../interfaces/ChunkStrategy.md) -- [ClientTool](../interfaces/ClientTool.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) -- [ImagePart](../interfaces/ImagePart.md) -- [InternalToolCallState](../interfaces/InternalToolCallState.md) -- [JSONParser](../interfaces/JSONParser.md) -- [ModelMessage](../interfaces/ModelMessage.md) -- [ProcessorResult](../interfaces/ProcessorResult.md) -- [ProcessorState](../interfaces/ProcessorState.md) -- [ResponseFormat](../interfaces/ResponseFormat.md) -- [ServerTool](../interfaces/ServerTool.md) -- [StreamProcessorEvents](../interfaces/StreamProcessorEvents.md) -- [StreamProcessorHandlers](../interfaces/StreamProcessorHandlers.md) -- [StreamProcessorOptions](../interfaces/StreamProcessorOptions.md) -- [SummarizationOptions](../interfaces/SummarizationOptions.md) -- [SummarizationResult](../interfaces/SummarizationResult.md) -- [TextPart](../interfaces/TextPart.md) -- [ThinkingPart](../interfaces/ThinkingPart.md) -- [ThinkingStreamChunk](../interfaces/ThinkingStreamChunk.md) -- [Tool](../interfaces/Tool.md) -- [ToolCall](../interfaces/ToolCall.md) -- [ToolCallPart](../interfaces/ToolCallPart.md) -- [ToolCallStreamChunk](../interfaces/ToolCallStreamChunk.md) -- [ToolConfig](../interfaces/ToolConfig.md) -- [ToolDefinition](../interfaces/ToolDefinition.md) -- [ToolDefinitionConfig](../interfaces/ToolDefinitionConfig.md) -- [ToolDefinitionInstance](../interfaces/ToolDefinitionInstance.md) -- [ToolInputAvailableStreamChunk](../interfaces/ToolInputAvailableStreamChunk.md) -- [ToolResultPart](../interfaces/ToolResultPart.md) -- [ToolResultStreamChunk](../interfaces/ToolResultStreamChunk.md) -- [UIMessage](../interfaces/UIMessage.md) -- [VideoPart](../interfaces/VideoPart.md) +- [AgentLoopState](interfaces/AgentLoopState.md) +- [AIAdapter](interfaces/AIAdapter.md) +- [AIAdapterConfig](interfaces/AIAdapterConfig.md) +- [ApprovalRequestedStreamChunk](interfaces/ApprovalRequestedStreamChunk.md) +- [AudioPart](interfaces/AudioPart.md) +- [BaseStreamChunk](interfaces/BaseStreamChunk.md) +- [ChatCompletionChunk](interfaces/ChatCompletionChunk.md) +- [ChatOptions](interfaces/ChatOptions.md) +- [ChunkRecording](interfaces/ChunkRecording.md) +- [ChunkStrategy](interfaces/ChunkStrategy.md) +- [ClientTool](interfaces/ClientTool.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) +- [ImagePart](interfaces/ImagePart.md) +- [InternalToolCallState](interfaces/InternalToolCallState.md) +- [JSONParser](interfaces/JSONParser.md) +- [ModelMessage](interfaces/ModelMessage.md) +- [ProcessorResult](interfaces/ProcessorResult.md) +- [ProcessorState](interfaces/ProcessorState.md) +- [ResponseFormat](interfaces/ResponseFormat.md) +- [ServerTool](interfaces/ServerTool.md) +- [StreamProcessorEvents](interfaces/StreamProcessorEvents.md) +- [StreamProcessorHandlers](interfaces/StreamProcessorHandlers.md) +- [StreamProcessorOptions](interfaces/StreamProcessorOptions.md) +- [SummarizationOptions](interfaces/SummarizationOptions.md) +- [SummarizationResult](interfaces/SummarizationResult.md) +- [TextPart](interfaces/TextPart.md) +- [ThinkingPart](interfaces/ThinkingPart.md) +- [ThinkingStreamChunk](interfaces/ThinkingStreamChunk.md) +- [Tool](interfaces/Tool.md) +- [ToolCall](interfaces/ToolCall.md) +- [ToolCallPart](interfaces/ToolCallPart.md) +- [ToolCallStreamChunk](interfaces/ToolCallStreamChunk.md) +- [ToolConfig](interfaces/ToolConfig.md) +- [ToolDefinition](interfaces/ToolDefinition.md) +- [ToolDefinitionConfig](interfaces/ToolDefinitionConfig.md) +- [ToolDefinitionInstance](interfaces/ToolDefinitionInstance.md) +- [ToolInputAvailableStreamChunk](interfaces/ToolInputAvailableStreamChunk.md) +- [ToolResultPart](interfaces/ToolResultPart.md) +- [ToolResultStreamChunk](interfaces/ToolResultStreamChunk.md) +- [UIMessage](interfaces/UIMessage.md) +- [VideoPart](interfaces/VideoPart.md) ## Type Aliases -- [AgentLoopStrategy](../type-aliases/AgentLoopStrategy.md) -- [AnyClientTool](../type-aliases/AnyClientTool.md) -- [ChatStreamOptionsForModel](../type-aliases/ChatStreamOptionsForModel.md) -- [ChatStreamOptionsUnion](../type-aliases/ChatStreamOptionsUnion.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) -- [InferToolInput](../type-aliases/InferToolInput.md) -- [InferToolName](../type-aliases/InferToolName.md) -- [InferToolOutput](../type-aliases/InferToolOutput.md) -- [MessagePart](../type-aliases/MessagePart.md) -- [ModalitiesArrayToUnion](../type-aliases/ModalitiesArrayToUnion.md) -- [Modality](../type-aliases/Modality.md) -- [StreamChunk](../type-aliases/StreamChunk.md) -- [StreamChunkType](../type-aliases/StreamChunkType.md) -- [ToolCallState](../type-aliases/ToolCallState.md) -- [ToolResultState](../type-aliases/ToolResultState.md) +- [AgentLoopStrategy](type-aliases/AgentLoopStrategy.md) +- [AnyClientTool](type-aliases/AnyClientTool.md) +- [ChatStreamOptionsForModel](type-aliases/ChatStreamOptionsForModel.md) +- [ChatStreamOptionsUnion](type-aliases/ChatStreamOptionsUnion.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) +- [InferToolInput](type-aliases/InferToolInput.md) +- [InferToolName](type-aliases/InferToolName.md) +- [InferToolOutput](type-aliases/InferToolOutput.md) +- [MessagePart](type-aliases/MessagePart.md) +- [ModalitiesArrayToUnion](type-aliases/ModalitiesArrayToUnion.md) +- [Modality](type-aliases/Modality.md) +- [StreamChunk](type-aliases/StreamChunk.md) +- [StreamChunkType](type-aliases/StreamChunkType.md) +- [ToolCallState](type-aliases/ToolCallState.md) +- [ToolResultState](type-aliases/ToolResultState.md) ## Variables -- [aiEventClient](../variables/aiEventClient.md) -- [defaultJSONParser](../variables/defaultJSONParser.md) +- [aiEventClient](variables/aiEventClient.md) +- [defaultJSONParser](variables/defaultJSONParser.md) ## Functions -- [chat](../functions/chat.md) -- [chatOptions](../functions/chatOptions.md) -- [combineStrategies](../functions/combineStrategies.md) -- [convertMessagesToModelMessages](../functions/convertMessagesToModelMessages.md) -- [convertZodToJsonSchema](../functions/convertZodToJsonSchema.md) -- [createReplayStream](../functions/createReplayStream.md) -- [embedding](../functions/embedding.md) -- [generateMessageId](../functions/generateMessageId.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) -- [summarize](../functions/summarize.md) -- [toolDefinition](../functions/toolDefinition.md) -- [toServerSentEventsStream](../functions/toServerSentEventsStream.md) -- [toStreamResponse](../functions/toStreamResponse.md) -- [uiMessageToModelMessages](../functions/uiMessageToModelMessages.md) -- [untilFinishReason](../functions/untilFinishReason.md) +- [chat](functions/chat.md) +- [chatOptions](functions/chatOptions.md) +- [combineStrategies](functions/combineStrategies.md) +- [convertMessagesToModelMessages](functions/convertMessagesToModelMessages.md) +- [convertZodToJsonSchema](functions/convertZodToJsonSchema.md) +- [createReplayStream](functions/createReplayStream.md) +- [embedding](functions/embedding.md) +- [generateMessageId](functions/generateMessageId.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) +- [summarize](functions/summarize.md) +- [toolDefinition](functions/toolDefinition.md) +- [toServerSentEventsStream](functions/toServerSentEventsStream.md) +- [toStreamResponse](functions/toStreamResponse.md) +- [uiMessageToModelMessages](functions/uiMessageToModelMessages.md) +- [untilFinishReason](functions/untilFinishReason.md) diff --git a/docs/reference/interfaces/AIAdapter.md b/docs/reference/interfaces/AIAdapter.md index d2831fe0..293de6f8 100644 --- a/docs/reference/interfaces/AIAdapter.md +++ b/docs/reference/interfaces/AIAdapter.md @@ -42,11 +42,11 @@ Generic parameters: ### TModelInputModalitiesByName -`TModelInputModalitiesByName` *extends* `Record`\<`string`, `ReadonlyArray`\<[`Modality`](../../type-aliases/Modality.md)\>\> = `Record`\<`string`, `ReadonlyArray`\<[`Modality`](../../type-aliases/Modality.md)\>\> +`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) +`TMessageMetadataByModality` *extends* `object` = [`DefaultMessageMetadataByModality`](DefaultMessageMetadataByModality.md) ## Properties @@ -133,11 +133,11 @@ Defined in: [types.ts:723](https://github.com/TanStack/ai/blob/main/packages/typ ##### options -[`ChatOptions`](../ChatOptions.md)\<`string`, `TChatProviderOptions`\> +[`ChatOptions`](ChatOptions.md)\<`string`, `TChatProviderOptions`\> #### Returns -`AsyncIterable`\<[`StreamChunk`](../../type-aliases/StreamChunk.md)\> +`AsyncIterable`\<[`StreamChunk`](../type-aliases/StreamChunk.md)\> *** @@ -153,11 +153,11 @@ Defined in: [types.ts:731](https://github.com/TanStack/ai/blob/main/packages/typ ##### options -[`EmbeddingOptions`](../EmbeddingOptions.md) +[`EmbeddingOptions`](EmbeddingOptions.md) #### Returns -`Promise`\<[`EmbeddingResult`](../EmbeddingResult.md)\> +`Promise`\<[`EmbeddingResult`](EmbeddingResult.md)\> *** @@ -207,8 +207,8 @@ Defined in: [types.ts:728](https://github.com/TanStack/ai/blob/main/packages/typ ##### options -[`SummarizationOptions`](../SummarizationOptions.md) +[`SummarizationOptions`](SummarizationOptions.md) #### Returns -`Promise`\<[`SummarizationResult`](../SummarizationResult.md)\> +`Promise`\<[`SummarizationResult`](SummarizationResult.md)\> diff --git a/docs/reference/interfaces/ApprovalRequestedStreamChunk.md b/docs/reference/interfaces/ApprovalRequestedStreamChunk.md index 8e8a7533..1a9ea9e8 100644 --- a/docs/reference/interfaces/ApprovalRequestedStreamChunk.md +++ b/docs/reference/interfaces/ApprovalRequestedStreamChunk.md @@ -9,7 +9,7 @@ Defined in: [types.ts:566](https://github.com/TanStack/ai/blob/main/packages/typ ## Extends -- [`BaseStreamChunk`](../BaseStreamChunk.md) +- [`BaseStreamChunk`](BaseStreamChunk.md) ## Properties @@ -45,7 +45,7 @@ Defined in: [types.ts:517](https://github.com/TanStack/ai/blob/main/packages/typ #### Inherited from -[`BaseStreamChunk`](../BaseStreamChunk.md).[`id`](../BaseStreamChunk.md#id) +[`BaseStreamChunk`](BaseStreamChunk.md).[`id`](BaseStreamChunk.md#id) *** @@ -69,7 +69,7 @@ Defined in: [types.ts:518](https://github.com/TanStack/ai/blob/main/packages/typ #### Inherited from -[`BaseStreamChunk`](../BaseStreamChunk.md).[`model`](../BaseStreamChunk.md#model) +[`BaseStreamChunk`](BaseStreamChunk.md).[`model`](BaseStreamChunk.md#model) *** @@ -83,7 +83,7 @@ Defined in: [types.ts:519](https://github.com/TanStack/ai/blob/main/packages/typ #### Inherited from -[`BaseStreamChunk`](../BaseStreamChunk.md).[`timestamp`](../BaseStreamChunk.md#timestamp) +[`BaseStreamChunk`](BaseStreamChunk.md).[`timestamp`](BaseStreamChunk.md#timestamp) *** @@ -117,4 +117,4 @@ Defined in: [types.ts:567](https://github.com/TanStack/ai/blob/main/packages/typ #### Overrides -[`BaseStreamChunk`](../BaseStreamChunk.md).[`type`](../BaseStreamChunk.md#type) +[`BaseStreamChunk`](BaseStreamChunk.md).[`type`](BaseStreamChunk.md#type) diff --git a/docs/reference/interfaces/BaseStreamChunk.md b/docs/reference/interfaces/BaseStreamChunk.md index c653e7d9..c988313d 100644 --- a/docs/reference/interfaces/BaseStreamChunk.md +++ b/docs/reference/interfaces/BaseStreamChunk.md @@ -9,14 +9,14 @@ Defined in: [types.ts:515](https://github.com/TanStack/ai/blob/main/packages/typ ## Extended by -- [`ContentStreamChunk`](../ContentStreamChunk.md) -- [`ToolCallStreamChunk`](../ToolCallStreamChunk.md) -- [`ToolResultStreamChunk`](../ToolResultStreamChunk.md) -- [`DoneStreamChunk`](../DoneStreamChunk.md) -- [`ErrorStreamChunk`](../ErrorStreamChunk.md) -- [`ApprovalRequestedStreamChunk`](../ApprovalRequestedStreamChunk.md) -- [`ToolInputAvailableStreamChunk`](../ToolInputAvailableStreamChunk.md) -- [`ThinkingStreamChunk`](../ThinkingStreamChunk.md) +- [`ContentStreamChunk`](ContentStreamChunk.md) +- [`ToolCallStreamChunk`](ToolCallStreamChunk.md) +- [`ToolResultStreamChunk`](ToolResultStreamChunk.md) +- [`DoneStreamChunk`](DoneStreamChunk.md) +- [`ErrorStreamChunk`](ErrorStreamChunk.md) +- [`ApprovalRequestedStreamChunk`](ApprovalRequestedStreamChunk.md) +- [`ToolInputAvailableStreamChunk`](ToolInputAvailableStreamChunk.md) +- [`ThinkingStreamChunk`](ThinkingStreamChunk.md) ## Properties diff --git a/docs/reference/interfaces/ChatOptions.md b/docs/reference/interfaces/ChatOptions.md index f320cdfd..6c93338d 100644 --- a/docs/reference/interfaces/ChatOptions.md +++ b/docs/reference/interfaces/ChatOptions.md @@ -21,7 +21,7 @@ Options passed into the SDK and further piped to the AI provider. ### TOutput -`TOutput` *extends* [`ResponseFormat`](../ResponseFormat.md)\<`any`\> \| `undefined` = `undefined` +`TOutput` *extends* [`ResponseFormat`](ResponseFormat.md)\<`any`\> \| `undefined` = `undefined` ### TProviderOptionsForModel diff --git a/docs/reference/interfaces/ContentStreamChunk.md b/docs/reference/interfaces/ContentStreamChunk.md index c3f58f3a..ac6628af 100644 --- a/docs/reference/interfaces/ContentStreamChunk.md +++ b/docs/reference/interfaces/ContentStreamChunk.md @@ -9,7 +9,7 @@ Defined in: [types.ts:522](https://github.com/TanStack/ai/blob/main/packages/typ ## Extends -- [`BaseStreamChunk`](../BaseStreamChunk.md) +- [`BaseStreamChunk`](BaseStreamChunk.md) ## Properties @@ -43,7 +43,7 @@ Defined in: [types.ts:517](https://github.com/TanStack/ai/blob/main/packages/typ #### Inherited from -[`BaseStreamChunk`](../BaseStreamChunk.md).[`id`](../BaseStreamChunk.md#id) +[`BaseStreamChunk`](BaseStreamChunk.md).[`id`](BaseStreamChunk.md#id) *** @@ -57,7 +57,7 @@ Defined in: [types.ts:518](https://github.com/TanStack/ai/blob/main/packages/typ #### Inherited from -[`BaseStreamChunk`](../BaseStreamChunk.md).[`model`](../BaseStreamChunk.md#model) +[`BaseStreamChunk`](BaseStreamChunk.md).[`model`](BaseStreamChunk.md#model) *** @@ -81,7 +81,7 @@ Defined in: [types.ts:519](https://github.com/TanStack/ai/blob/main/packages/typ #### Inherited from -[`BaseStreamChunk`](../BaseStreamChunk.md).[`timestamp`](../BaseStreamChunk.md#timestamp) +[`BaseStreamChunk`](BaseStreamChunk.md).[`timestamp`](BaseStreamChunk.md#timestamp) *** @@ -95,4 +95,4 @@ Defined in: [types.ts:523](https://github.com/TanStack/ai/blob/main/packages/typ #### Overrides -[`BaseStreamChunk`](../BaseStreamChunk.md).[`type`](../BaseStreamChunk.md#type) +[`BaseStreamChunk`](BaseStreamChunk.md).[`type`](BaseStreamChunk.md#type) diff --git a/docs/reference/interfaces/DoneStreamChunk.md b/docs/reference/interfaces/DoneStreamChunk.md index d2540a7f..2324ceb2 100644 --- a/docs/reference/interfaces/DoneStreamChunk.md +++ b/docs/reference/interfaces/DoneStreamChunk.md @@ -9,7 +9,7 @@ Defined in: [types.ts:548](https://github.com/TanStack/ai/blob/main/packages/typ ## Extends -- [`BaseStreamChunk`](../BaseStreamChunk.md) +- [`BaseStreamChunk`](BaseStreamChunk.md) ## Properties @@ -33,7 +33,7 @@ Defined in: [types.ts:517](https://github.com/TanStack/ai/blob/main/packages/typ #### Inherited from -[`BaseStreamChunk`](../BaseStreamChunk.md).[`id`](../BaseStreamChunk.md#id) +[`BaseStreamChunk`](BaseStreamChunk.md).[`id`](BaseStreamChunk.md#id) *** @@ -47,7 +47,7 @@ Defined in: [types.ts:518](https://github.com/TanStack/ai/blob/main/packages/typ #### Inherited from -[`BaseStreamChunk`](../BaseStreamChunk.md).[`model`](../BaseStreamChunk.md#model) +[`BaseStreamChunk`](BaseStreamChunk.md).[`model`](BaseStreamChunk.md#model) *** @@ -61,7 +61,7 @@ Defined in: [types.ts:519](https://github.com/TanStack/ai/blob/main/packages/typ #### Inherited from -[`BaseStreamChunk`](../BaseStreamChunk.md).[`timestamp`](../BaseStreamChunk.md#timestamp) +[`BaseStreamChunk`](BaseStreamChunk.md).[`timestamp`](BaseStreamChunk.md#timestamp) *** @@ -75,7 +75,7 @@ Defined in: [types.ts:549](https://github.com/TanStack/ai/blob/main/packages/typ #### Overrides -[`BaseStreamChunk`](../BaseStreamChunk.md).[`type`](../BaseStreamChunk.md#type) +[`BaseStreamChunk`](BaseStreamChunk.md).[`type`](BaseStreamChunk.md#type) *** diff --git a/docs/reference/interfaces/ErrorStreamChunk.md b/docs/reference/interfaces/ErrorStreamChunk.md index 398320ee..2f21df54 100644 --- a/docs/reference/interfaces/ErrorStreamChunk.md +++ b/docs/reference/interfaces/ErrorStreamChunk.md @@ -9,7 +9,7 @@ Defined in: [types.ts:558](https://github.com/TanStack/ai/blob/main/packages/typ ## Extends -- [`BaseStreamChunk`](../BaseStreamChunk.md) +- [`BaseStreamChunk`](BaseStreamChunk.md) ## Properties @@ -45,7 +45,7 @@ Defined in: [types.ts:517](https://github.com/TanStack/ai/blob/main/packages/typ #### Inherited from -[`BaseStreamChunk`](../BaseStreamChunk.md).[`id`](../BaseStreamChunk.md#id) +[`BaseStreamChunk`](BaseStreamChunk.md).[`id`](BaseStreamChunk.md#id) *** @@ -59,7 +59,7 @@ Defined in: [types.ts:518](https://github.com/TanStack/ai/blob/main/packages/typ #### Inherited from -[`BaseStreamChunk`](../BaseStreamChunk.md).[`model`](../BaseStreamChunk.md#model) +[`BaseStreamChunk`](BaseStreamChunk.md).[`model`](BaseStreamChunk.md#model) *** @@ -73,7 +73,7 @@ Defined in: [types.ts:519](https://github.com/TanStack/ai/blob/main/packages/typ #### Inherited from -[`BaseStreamChunk`](../BaseStreamChunk.md).[`timestamp`](../BaseStreamChunk.md#timestamp) +[`BaseStreamChunk`](BaseStreamChunk.md).[`timestamp`](BaseStreamChunk.md#timestamp) *** @@ -87,4 +87,4 @@ Defined in: [types.ts:559](https://github.com/TanStack/ai/blob/main/packages/typ #### Overrides -[`BaseStreamChunk`](../BaseStreamChunk.md).[`type`](../BaseStreamChunk.md#type) +[`BaseStreamChunk`](BaseStreamChunk.md).[`type`](BaseStreamChunk.md#type) diff --git a/docs/reference/interfaces/ModelMessage.md b/docs/reference/interfaces/ModelMessage.md index e80a7a7a..7cf165bb 100644 --- a/docs/reference/interfaces/ModelMessage.md +++ b/docs/reference/interfaces/ModelMessage.md @@ -11,7 +11,7 @@ Defined in: [types.ts:159](https://github.com/TanStack/ai/blob/main/packages/typ ### TContent -`TContent` *extends* `string` \| `null` \| [`ContentPart`](../../type-aliases/ContentPart.md)[] = `string` \| `null` \| [`ContentPart`](../../type-aliases/ContentPart.md)[] +`TContent` *extends* `string` \| `null` \| [`ContentPart`](../type-aliases/ContentPart.md)[] = `string` \| `null` \| [`ContentPart`](../type-aliases/ContentPart.md)[] ## Properties diff --git a/docs/reference/interfaces/ServerTool.md b/docs/reference/interfaces/ServerTool.md index 606bd57e..49d3b4ee 100644 --- a/docs/reference/interfaces/ServerTool.md +++ b/docs/reference/interfaces/ServerTool.md @@ -11,7 +11,7 @@ Marker type for server-side tools ## Extends -- [`Tool`](../Tool.md)\<`TInput`, `TOutput`, `TName`\> +- [`Tool`](Tool.md)\<`TInput`, `TOutput`, `TName`\> ## Type Parameters @@ -60,7 +60,7 @@ Be specific about what the tool does, what parameters it needs, and what it retu #### Inherited from -[`Tool`](../Tool.md).[`description`](../Tool.md#description) +[`Tool`](Tool.md).[`description`](Tool.md#description) *** @@ -104,7 +104,7 @@ execute: async (args) => { #### Inherited from -[`Tool`](../Tool.md).[`execute`](../Tool.md#execute) +[`Tool`](Tool.md).[`execute`](Tool.md#execute) *** @@ -139,7 +139,7 @@ z.object({ #### Inherited from -[`Tool`](../Tool.md).[`inputSchema`](../Tool.md#inputschema) +[`Tool`](Tool.md).[`inputSchema`](Tool.md#inputschema) *** @@ -155,7 +155,7 @@ Additional metadata for adapters or custom extensions #### Inherited from -[`Tool`](../Tool.md).[`metadata`](../Tool.md#metadata) +[`Tool`](Tool.md).[`metadata`](Tool.md#metadata) *** @@ -180,7 +180,7 @@ Must be unique within the tools array. #### Inherited from -[`Tool`](../Tool.md).[`name`](../Tool.md#name) +[`Tool`](Tool.md).[`name`](Tool.md#name) *** @@ -196,7 +196,7 @@ If true, tool execution requires user approval before running. Works with both s #### Inherited from -[`Tool`](../Tool.md).[`needsApproval`](../Tool.md#needsapproval) +[`Tool`](Tool.md).[`needsApproval`](Tool.md#needsapproval) *** @@ -228,4 +228,4 @@ z.object({ #### Inherited from -[`Tool`](../Tool.md).[`outputSchema`](../Tool.md#outputschema) +[`Tool`](Tool.md).[`outputSchema`](Tool.md#outputschema) diff --git a/docs/reference/interfaces/StreamProcessorEvents.md b/docs/reference/interfaces/StreamProcessorEvents.md index f586b9fb..313e1987 100644 --- a/docs/reference/interfaces/StreamProcessorEvents.md +++ b/docs/reference/interfaces/StreamProcessorEvents.md @@ -77,7 +77,7 @@ Defined in: [stream/processor.ts:53](https://github.com/TanStack/ai/blob/main/pa ##### messages -[`UIMessage`](../UIMessage.md)[] +[`UIMessage`](UIMessage.md)[] #### Returns @@ -97,7 +97,7 @@ Defined in: [stream/processor.ts:57](https://github.com/TanStack/ai/blob/main/pa ##### message -[`UIMessage`](../UIMessage.md) +[`UIMessage`](UIMessage.md) #### Returns @@ -217,7 +217,7 @@ Defined in: [stream/processor.ts:75](https://github.com/TanStack/ai/blob/main/pa ##### state -[`ToolCallState`](../../type-aliases/ToolCallState.md) +[`ToolCallState`](../type-aliases/ToolCallState.md) ##### args diff --git a/docs/reference/interfaces/StreamProcessorHandlers.md b/docs/reference/interfaces/StreamProcessorHandlers.md index e2edbea2..c4e50f56 100644 --- a/docs/reference/interfaces/StreamProcessorHandlers.md +++ b/docs/reference/interfaces/StreamProcessorHandlers.md @@ -86,7 +86,7 @@ Defined in: [stream/processor.ts:132](https://github.com/TanStack/ai/blob/main/p ##### toolCalls? -[`ToolCall`](../ToolCall.md)[] +[`ToolCall`](ToolCall.md)[] #### Returns @@ -242,7 +242,7 @@ Defined in: [stream/processor.ts:101](https://github.com/TanStack/ai/blob/main/p ##### state -[`ToolCallState`](../../type-aliases/ToolCallState.md) +[`ToolCallState`](../type-aliases/ToolCallState.md) ##### args @@ -306,7 +306,7 @@ Defined in: [stream/processor.ts:111](https://github.com/TanStack/ai/blob/main/p ##### state -[`ToolResultState`](../../type-aliases/ToolResultState.md) +[`ToolResultState`](../type-aliases/ToolResultState.md) ##### error? diff --git a/docs/reference/interfaces/ThinkingStreamChunk.md b/docs/reference/interfaces/ThinkingStreamChunk.md index 11d2afb4..3c5f4d47 100644 --- a/docs/reference/interfaces/ThinkingStreamChunk.md +++ b/docs/reference/interfaces/ThinkingStreamChunk.md @@ -9,7 +9,7 @@ Defined in: [types.ts:584](https://github.com/TanStack/ai/blob/main/packages/typ ## Extends -- [`BaseStreamChunk`](../BaseStreamChunk.md) +- [`BaseStreamChunk`](BaseStreamChunk.md) ## Properties @@ -43,7 +43,7 @@ Defined in: [types.ts:517](https://github.com/TanStack/ai/blob/main/packages/typ #### Inherited from -[`BaseStreamChunk`](../BaseStreamChunk.md).[`id`](../BaseStreamChunk.md#id) +[`BaseStreamChunk`](BaseStreamChunk.md).[`id`](BaseStreamChunk.md#id) *** @@ -57,7 +57,7 @@ Defined in: [types.ts:518](https://github.com/TanStack/ai/blob/main/packages/typ #### Inherited from -[`BaseStreamChunk`](../BaseStreamChunk.md).[`model`](../BaseStreamChunk.md#model) +[`BaseStreamChunk`](BaseStreamChunk.md).[`model`](BaseStreamChunk.md#model) *** @@ -71,7 +71,7 @@ Defined in: [types.ts:519](https://github.com/TanStack/ai/blob/main/packages/typ #### Inherited from -[`BaseStreamChunk`](../BaseStreamChunk.md).[`timestamp`](../BaseStreamChunk.md#timestamp) +[`BaseStreamChunk`](BaseStreamChunk.md).[`timestamp`](BaseStreamChunk.md#timestamp) *** @@ -85,4 +85,4 @@ Defined in: [types.ts:585](https://github.com/TanStack/ai/blob/main/packages/typ #### Overrides -[`BaseStreamChunk`](../BaseStreamChunk.md).[`type`](../BaseStreamChunk.md#type) +[`BaseStreamChunk`](BaseStreamChunk.md).[`type`](BaseStreamChunk.md#type) diff --git a/docs/reference/interfaces/Tool.md b/docs/reference/interfaces/Tool.md index f8d6861a..a6cd6450 100644 --- a/docs/reference/interfaces/Tool.md +++ b/docs/reference/interfaces/Tool.md @@ -21,8 +21,8 @@ Tools use Zod schemas for runtime validation and type safety. ## Extended by -- [`ToolDefinitionInstance`](../ToolDefinitionInstance.md) -- [`ServerTool`](../ServerTool.md) +- [`ToolDefinitionInstance`](ToolDefinitionInstance.md) +- [`ServerTool`](ServerTool.md) ## Type Parameters diff --git a/docs/reference/interfaces/ToolCallStreamChunk.md b/docs/reference/interfaces/ToolCallStreamChunk.md index 62e7ffad..7c3be0ab 100644 --- a/docs/reference/interfaces/ToolCallStreamChunk.md +++ b/docs/reference/interfaces/ToolCallStreamChunk.md @@ -9,7 +9,7 @@ Defined in: [types.ts:529](https://github.com/TanStack/ai/blob/main/packages/typ ## Extends -- [`BaseStreamChunk`](../BaseStreamChunk.md) +- [`BaseStreamChunk`](BaseStreamChunk.md) ## Properties @@ -23,7 +23,7 @@ Defined in: [types.ts:517](https://github.com/TanStack/ai/blob/main/packages/typ #### Inherited from -[`BaseStreamChunk`](../BaseStreamChunk.md).[`id`](../BaseStreamChunk.md#id) +[`BaseStreamChunk`](BaseStreamChunk.md).[`id`](BaseStreamChunk.md#id) *** @@ -47,7 +47,7 @@ Defined in: [types.ts:518](https://github.com/TanStack/ai/blob/main/packages/typ #### Inherited from -[`BaseStreamChunk`](../BaseStreamChunk.md).[`model`](../BaseStreamChunk.md#model) +[`BaseStreamChunk`](BaseStreamChunk.md).[`model`](BaseStreamChunk.md#model) *** @@ -61,7 +61,7 @@ Defined in: [types.ts:519](https://github.com/TanStack/ai/blob/main/packages/typ #### Inherited from -[`BaseStreamChunk`](../BaseStreamChunk.md).[`timestamp`](../BaseStreamChunk.md#timestamp) +[`BaseStreamChunk`](BaseStreamChunk.md).[`timestamp`](BaseStreamChunk.md#timestamp) *** @@ -115,4 +115,4 @@ Defined in: [types.ts:530](https://github.com/TanStack/ai/blob/main/packages/typ #### Overrides -[`BaseStreamChunk`](../BaseStreamChunk.md).[`type`](../BaseStreamChunk.md#type) +[`BaseStreamChunk`](BaseStreamChunk.md).[`type`](BaseStreamChunk.md#type) diff --git a/docs/reference/interfaces/ToolDefinition.md b/docs/reference/interfaces/ToolDefinition.md index 91729da4..2eed9698 100644 --- a/docs/reference/interfaces/ToolDefinition.md +++ b/docs/reference/interfaces/ToolDefinition.md @@ -11,7 +11,7 @@ Tool definition builder that allows creating server or client tools from a share ## Extends -- [`ToolDefinitionInstance`](../ToolDefinitionInstance.md)\<`TInput`, `TOutput`, `TName`\> +- [`ToolDefinitionInstance`](ToolDefinitionInstance.md)\<`TInput`, `TOutput`, `TName`\> ## Type Parameters @@ -39,7 +39,7 @@ Defined in: [tools/tool-definition.ts:43](https://github.com/TanStack/ai/blob/ma #### Inherited from -[`ToolDefinitionInstance`](../ToolDefinitionInstance.md).[`__toolSide`](../ToolDefinitionInstance.md#__toolside) +[`ToolDefinitionInstance`](ToolDefinitionInstance.md).[`__toolSide`](ToolDefinitionInstance.md#__toolside) *** @@ -61,7 +61,7 @@ Create a client-side tool with optional execute function #### Returns -[`ClientTool`](../ClientTool.md)\<`TInput`, `TOutput`, `TName`\> +[`ClientTool`](ClientTool.md)\<`TInput`, `TOutput`, `TName`\> *** @@ -86,7 +86,7 @@ Be specific about what the tool does, what parameters it needs, and what it retu #### Inherited from -[`ToolDefinitionInstance`](../ToolDefinitionInstance.md).[`description`](../ToolDefinitionInstance.md#description) +[`ToolDefinitionInstance`](ToolDefinitionInstance.md).[`description`](ToolDefinitionInstance.md#description) *** @@ -130,7 +130,7 @@ execute: async (args) => { #### Inherited from -[`ToolDefinitionInstance`](../ToolDefinitionInstance.md).[`execute`](../ToolDefinitionInstance.md#execute) +[`ToolDefinitionInstance`](ToolDefinitionInstance.md).[`execute`](ToolDefinitionInstance.md#execute) *** @@ -165,7 +165,7 @@ z.object({ #### Inherited from -[`ToolDefinitionInstance`](../ToolDefinitionInstance.md).[`inputSchema`](../ToolDefinitionInstance.md#inputschema) +[`ToolDefinitionInstance`](ToolDefinitionInstance.md).[`inputSchema`](ToolDefinitionInstance.md#inputschema) *** @@ -181,7 +181,7 @@ Additional metadata for adapters or custom extensions #### Inherited from -[`ToolDefinitionInstance`](../ToolDefinitionInstance.md).[`metadata`](../ToolDefinitionInstance.md#metadata) +[`ToolDefinitionInstance`](ToolDefinitionInstance.md).[`metadata`](ToolDefinitionInstance.md#metadata) *** @@ -206,7 +206,7 @@ Must be unique within the tools array. #### Inherited from -[`ToolDefinitionInstance`](../ToolDefinitionInstance.md).[`name`](../ToolDefinitionInstance.md#name) +[`ToolDefinitionInstance`](ToolDefinitionInstance.md).[`name`](ToolDefinitionInstance.md#name) *** @@ -222,7 +222,7 @@ If true, tool execution requires user approval before running. Works with both s #### Inherited from -[`ToolDefinitionInstance`](../ToolDefinitionInstance.md).[`needsApproval`](../ToolDefinitionInstance.md#needsapproval) +[`ToolDefinitionInstance`](ToolDefinitionInstance.md).[`needsApproval`](ToolDefinitionInstance.md#needsapproval) *** @@ -254,7 +254,7 @@ z.object({ #### Inherited from -[`ToolDefinitionInstance`](../ToolDefinitionInstance.md).[`outputSchema`](../ToolDefinitionInstance.md#outputschema) +[`ToolDefinitionInstance`](ToolDefinitionInstance.md).[`outputSchema`](ToolDefinitionInstance.md#outputschema) *** @@ -276,4 +276,4 @@ Create a server-side tool with execute function #### Returns -[`ServerTool`](../ServerTool.md)\<`TInput`, `TOutput`, `TName`\> +[`ServerTool`](ServerTool.md)\<`TInput`, `TOutput`, `TName`\> diff --git a/docs/reference/interfaces/ToolDefinitionInstance.md b/docs/reference/interfaces/ToolDefinitionInstance.md index f2eba4c2..719a28f7 100644 --- a/docs/reference/interfaces/ToolDefinitionInstance.md +++ b/docs/reference/interfaces/ToolDefinitionInstance.md @@ -11,11 +11,11 @@ Tool definition that can be used directly or instantiated for server/client ## Extends -- [`Tool`](../Tool.md)\<`TInput`, `TOutput`, `TName`\> +- [`Tool`](Tool.md)\<`TInput`, `TOutput`, `TName`\> ## Extended by -- [`ToolDefinition`](../ToolDefinition.md) +- [`ToolDefinition`](ToolDefinition.md) ## Type Parameters @@ -64,7 +64,7 @@ Be specific about what the tool does, what parameters it needs, and what it retu #### Inherited from -[`Tool`](../Tool.md).[`description`](../Tool.md#description) +[`Tool`](Tool.md).[`description`](Tool.md#description) *** @@ -108,7 +108,7 @@ execute: async (args) => { #### Inherited from -[`Tool`](../Tool.md).[`execute`](../Tool.md#execute) +[`Tool`](Tool.md).[`execute`](Tool.md#execute) *** @@ -143,7 +143,7 @@ z.object({ #### Inherited from -[`Tool`](../Tool.md).[`inputSchema`](../Tool.md#inputschema) +[`Tool`](Tool.md).[`inputSchema`](Tool.md#inputschema) *** @@ -159,7 +159,7 @@ Additional metadata for adapters or custom extensions #### Inherited from -[`Tool`](../Tool.md).[`metadata`](../Tool.md#metadata) +[`Tool`](Tool.md).[`metadata`](Tool.md#metadata) *** @@ -184,7 +184,7 @@ Must be unique within the tools array. #### Inherited from -[`Tool`](../Tool.md).[`name`](../Tool.md#name) +[`Tool`](Tool.md).[`name`](Tool.md#name) *** @@ -200,7 +200,7 @@ If true, tool execution requires user approval before running. Works with both s #### Inherited from -[`Tool`](../Tool.md).[`needsApproval`](../Tool.md#needsapproval) +[`Tool`](Tool.md).[`needsApproval`](Tool.md#needsapproval) *** @@ -232,4 +232,4 @@ z.object({ #### Inherited from -[`Tool`](../Tool.md).[`outputSchema`](../Tool.md#outputschema) +[`Tool`](Tool.md).[`outputSchema`](Tool.md#outputschema) diff --git a/docs/reference/interfaces/ToolInputAvailableStreamChunk.md b/docs/reference/interfaces/ToolInputAvailableStreamChunk.md index 23098f27..a3bf1c66 100644 --- a/docs/reference/interfaces/ToolInputAvailableStreamChunk.md +++ b/docs/reference/interfaces/ToolInputAvailableStreamChunk.md @@ -9,7 +9,7 @@ Defined in: [types.ts:577](https://github.com/TanStack/ai/blob/main/packages/typ ## Extends -- [`BaseStreamChunk`](../BaseStreamChunk.md) +- [`BaseStreamChunk`](BaseStreamChunk.md) ## Properties @@ -23,7 +23,7 @@ Defined in: [types.ts:517](https://github.com/TanStack/ai/blob/main/packages/typ #### Inherited from -[`BaseStreamChunk`](../BaseStreamChunk.md).[`id`](../BaseStreamChunk.md#id) +[`BaseStreamChunk`](BaseStreamChunk.md).[`id`](BaseStreamChunk.md#id) *** @@ -47,7 +47,7 @@ Defined in: [types.ts:518](https://github.com/TanStack/ai/blob/main/packages/typ #### Inherited from -[`BaseStreamChunk`](../BaseStreamChunk.md).[`model`](../BaseStreamChunk.md#model) +[`BaseStreamChunk`](BaseStreamChunk.md).[`model`](BaseStreamChunk.md#model) *** @@ -61,7 +61,7 @@ Defined in: [types.ts:519](https://github.com/TanStack/ai/blob/main/packages/typ #### Inherited from -[`BaseStreamChunk`](../BaseStreamChunk.md).[`timestamp`](../BaseStreamChunk.md#timestamp) +[`BaseStreamChunk`](BaseStreamChunk.md).[`timestamp`](BaseStreamChunk.md#timestamp) *** @@ -95,4 +95,4 @@ Defined in: [types.ts:578](https://github.com/TanStack/ai/blob/main/packages/typ #### Overrides -[`BaseStreamChunk`](../BaseStreamChunk.md).[`type`](../BaseStreamChunk.md#type) +[`BaseStreamChunk`](BaseStreamChunk.md).[`type`](BaseStreamChunk.md#type) diff --git a/docs/reference/interfaces/ToolResultStreamChunk.md b/docs/reference/interfaces/ToolResultStreamChunk.md index 30846e20..9adb0a97 100644 --- a/docs/reference/interfaces/ToolResultStreamChunk.md +++ b/docs/reference/interfaces/ToolResultStreamChunk.md @@ -9,7 +9,7 @@ Defined in: [types.ts:542](https://github.com/TanStack/ai/blob/main/packages/typ ## Extends -- [`BaseStreamChunk`](../BaseStreamChunk.md) +- [`BaseStreamChunk`](BaseStreamChunk.md) ## Properties @@ -33,7 +33,7 @@ Defined in: [types.ts:517](https://github.com/TanStack/ai/blob/main/packages/typ #### Inherited from -[`BaseStreamChunk`](../BaseStreamChunk.md).[`id`](../BaseStreamChunk.md#id) +[`BaseStreamChunk`](BaseStreamChunk.md).[`id`](BaseStreamChunk.md#id) *** @@ -47,7 +47,7 @@ Defined in: [types.ts:518](https://github.com/TanStack/ai/blob/main/packages/typ #### Inherited from -[`BaseStreamChunk`](../BaseStreamChunk.md).[`model`](../BaseStreamChunk.md#model) +[`BaseStreamChunk`](BaseStreamChunk.md).[`model`](BaseStreamChunk.md#model) *** @@ -61,7 +61,7 @@ Defined in: [types.ts:519](https://github.com/TanStack/ai/blob/main/packages/typ #### Inherited from -[`BaseStreamChunk`](../BaseStreamChunk.md).[`timestamp`](../BaseStreamChunk.md#timestamp) +[`BaseStreamChunk`](BaseStreamChunk.md).[`timestamp`](BaseStreamChunk.md#timestamp) *** @@ -85,4 +85,4 @@ Defined in: [types.ts:543](https://github.com/TanStack/ai/blob/main/packages/typ #### Overrides -[`BaseStreamChunk`](../BaseStreamChunk.md).[`type`](../BaseStreamChunk.md#type) +[`BaseStreamChunk`](BaseStreamChunk.md).[`type`](BaseStreamChunk.md#type) diff --git a/docs/reference/type-aliases/AgentLoopStrategy.md b/docs/reference/type-aliases/AgentLoopStrategy.md index 625b1613..ab8df17f 100644 --- a/docs/reference/type-aliases/AgentLoopStrategy.md +++ b/docs/reference/type-aliases/AgentLoopStrategy.md @@ -17,7 +17,7 @@ Strategy function that determines whether the agent loop should continue ### state -[`AgentLoopState`](../../interfaces/AgentLoopState.md) +[`AgentLoopState`](../interfaces/AgentLoopState.md) Current state of the agent loop diff --git a/docs/reference/type-aliases/ChatStreamOptionsForModel.md b/docs/reference/type-aliases/ChatStreamOptionsForModel.md index 5c6f4d9f..04a2439b 100644 --- a/docs/reference/type-aliases/ChatStreamOptionsForModel.md +++ b/docs/reference/type-aliases/ChatStreamOptionsForModel.md @@ -19,7 +19,7 @@ this type takes a specific model and constrains messages accordingly. ### TAdapter -`TAdapter` *extends* [`AIAdapter`](../../interfaces/AIAdapter.md)\<`any`, `any`, `any`, `any`, `any`, `any`, `any`\> +`TAdapter` *extends* [`AIAdapter`](../interfaces/AIAdapter.md)\<`any`, `any`, `any`, `any`, `any`, `any`, `any`\> ### TModel diff --git a/docs/reference/type-aliases/ChatStreamOptionsUnion.md b/docs/reference/type-aliases/ChatStreamOptionsUnion.md index 53e0ad6c..1a01cee9 100644 --- a/docs/reference/type-aliases/ChatStreamOptionsUnion.md +++ b/docs/reference/type-aliases/ChatStreamOptionsUnion.md @@ -15,4 +15,4 @@ Defined in: [types.ts:742](https://github.com/TanStack/ai/blob/main/packages/typ ### TAdapter -`TAdapter` *extends* [`AIAdapter`](../../interfaces/AIAdapter.md)\<`any`, `any`, `any`, `any`, `any`, `any`, `any`\> +`TAdapter` *extends* [`AIAdapter`](../interfaces/AIAdapter.md)\<`any`, `any`, `any`, `any`, `any`, `any`, `any`\> diff --git a/docs/reference/type-aliases/ConstrainedContent.md b/docs/reference/type-aliases/ConstrainedContent.md index 67db1769..e34a4dff 100644 --- a/docs/reference/type-aliases/ConstrainedContent.md +++ b/docs/reference/type-aliases/ConstrainedContent.md @@ -21,7 +21,7 @@ When modalities is ['text', 'image'], only TextPart and ImagePart are allowed in ### TModalities -`TModalities` *extends* `ReadonlyArray`\<[`Modality`](../Modality.md)\> +`TModalities` *extends* `ReadonlyArray`\<[`Modality`](Modality.md)\> ### TImageMeta diff --git a/docs/reference/type-aliases/ConstrainedModelMessage.md b/docs/reference/type-aliases/ConstrainedModelMessage.md index 1558bdf6..11516b37 100644 --- a/docs/reference/type-aliases/ConstrainedModelMessage.md +++ b/docs/reference/type-aliases/ConstrainedModelMessage.md @@ -26,7 +26,7 @@ content: ConstrainedContent +`TModalities` *extends* `ReadonlyArray`\<[`Modality`](Modality.md)\> ### TImageMeta diff --git a/docs/reference/type-aliases/ContentPartForModalities.md b/docs/reference/type-aliases/ContentPartForModalities.md index 22f5992a..48714c27 100644 --- a/docs/reference/type-aliases/ContentPartForModalities.md +++ b/docs/reference/type-aliases/ContentPartForModalities.md @@ -20,7 +20,7 @@ Used to constrain message content based on model capabilities. ### TModalities -`TModalities` *extends* [`Modality`](../Modality.md) +`TModalities` *extends* [`Modality`](Modality.md) ### TImageMeta diff --git a/docs/reference/type-aliases/ExtractModalitiesForModel.md b/docs/reference/type-aliases/ExtractModalitiesForModel.md index 05c721fd..7ad9e76c 100644 --- a/docs/reference/type-aliases/ExtractModalitiesForModel.md +++ b/docs/reference/type-aliases/ExtractModalitiesForModel.md @@ -17,7 +17,7 @@ Extract the supported input modalities for a specific model from an adapter. ### TAdapter -`TAdapter` *extends* [`AIAdapter`](../../interfaces/AIAdapter.md)\<`any`, `any`, `any`, `any`, `any`, `any`\> +`TAdapter` *extends* [`AIAdapter`](../interfaces/AIAdapter.md)\<`any`, `any`, `any`, `any`, `any`, `any`\> ### TModel diff --git a/docs/reference/type-aliases/ModalitiesArrayToUnion.md b/docs/reference/type-aliases/ModalitiesArrayToUnion.md index 12131317..0e9008ca 100644 --- a/docs/reference/type-aliases/ModalitiesArrayToUnion.md +++ b/docs/reference/type-aliases/ModalitiesArrayToUnion.md @@ -18,4 +18,4 @@ e.g., readonly ['text', 'image'] -> 'text' | 'image' ### T -`T` *extends* `ReadonlyArray`\<[`Modality`](../Modality.md)\> +`T` *extends* `ReadonlyArray`\<[`Modality`](Modality.md)\> diff --git a/scripts/generate-docs.ts b/scripts/generate-docs.ts index d73d78cc..26fd0441 100644 --- a/scripts/generate-docs.ts +++ b/scripts/generate-docs.ts @@ -1,8 +1,6 @@ import { resolve } from 'node:path' import { fileURLToPath } from 'node:url' -import { readFileSync, writeFileSync } from 'node:fs' import { generateReferenceDocs } from '@tanstack/typedoc-config' -import { glob } from 'tinyglobby' const __dirname = fileURLToPath(new URL('.', import.meta.url)) @@ -33,32 +31,6 @@ const packages = [ await generateReferenceDocs({ packages }) -// Find all markdown files matching the pattern -const markdownFiles = [ - ...(await glob('docs/reference/**/*.md')), - ...(await glob('docs/framework/*/reference/**/*.md')), -] - -console.log(`Found ${markdownFiles.length} markdown files to process\n`) - -// Process each markdown file -markdownFiles.forEach((file) => { - const content = readFileSync(file, 'utf-8') - let updatedContent = content - updatedContent = updatedContent.replaceAll(/\]\(\.\.\//gm, '](../../') - // updatedContent = content.replaceAll(/\]\(\.\//gm, '](../') - updatedContent = updatedContent.replaceAll( - /\]\((?!https?:\/\/|\/\/|\/|\.\/|\.\.\/|#)([^)]+)\)/gm, - (match, p1) => `](../${p1})`, - ) - - // Write the updated content back to the file - if (updatedContent !== content) { - writeFileSync(file, updatedContent, 'utf-8') - console.log(`Processed file: ${file}`) - } -}) - console.log('\n✅ All markdown files have been processed!') process.exit(0) diff --git a/scripts/verify-links.ts b/scripts/verify-links.ts index 268a0ac9..8a1c40dd 100644 --- a/scripts/verify-links.ts +++ b/scripts/verify-links.ts @@ -1,12 +1,19 @@ import { existsSync, readFileSync, statSync } from 'node:fs' -import path, { resolve } from 'node:path' +import { extname, resolve } from 'node:path' import { glob } from 'tinyglobby' // @ts-ignore Could not find a declaration file for module 'markdown-link-extractor'. import markdownLinkExtractor from 'markdown-link-extractor' +const errors: Array<{ + file: string + link: string + resolvedPath: string + reason: string +}> = [] + function isRelativeLink(link: string) { return ( - link && + !link.startsWith('/') && !link.startsWith('http://') && !link.startsWith('https://') && !link.startsWith('//') && @@ -15,39 +22,33 @@ function isRelativeLink(link: string) { ) } -function normalizePath(p: string): string { - // Remove any trailing .md - p = p.replace(`${path.extname(p)}`, '') - return p +/** Remove any trailing .md */ +function stripExtension(p: string): string { + return p.replace(`${extname(p)}`, '') } -function fileExistsForLink( - link: string, - markdownFile: string, - errors: Array, -): boolean { +function relativeLinkExists(link: string, file: string): boolean { // Remove hash if present - const filePart = link.split('#')[0] + const linkWithoutHash = link.split('#')[0] // If the link is empty after removing hash, it's not a file - if (!filePart) return false - - // Normalize the markdown file path - markdownFile = normalizePath(markdownFile) + if (!linkWithoutHash) return false - // Normalize the path - const normalizedPath = normalizePath(filePart) + // Strip the file/link extensions + const filePath = stripExtension(file) + const linkPath = stripExtension(linkWithoutHash) // Resolve the path relative to the markdown file's directory - let absPath = resolve(markdownFile, normalizedPath) + // Nav up a level to simulate how links are resolved on the web + let absPath = resolve(filePath, '..', linkPath) // Ensure the resolved path is within /docs const docsRoot = resolve('docs') if (!absPath.startsWith(docsRoot)) { errors.push({ link, - markdownFile, + file, resolvedPath: absPath, - reason: 'navigates above /docs, invalid', + reason: 'Path outside /docs', }) return false } @@ -76,15 +77,15 @@ function fileExistsForLink( if (!exists) { errors.push({ link, - markdownFile, + file, resolvedPath: absPath, - reason: 'not found', + reason: 'Not found', }) } return exists } -async function findMarkdownLinks() { +async function verifyMarkdownLinks() { // Find all markdown files in docs directory const markdownFiles = await glob('docs/**/*.md', { ignore: ['**/node_modules/**'], @@ -92,26 +93,18 @@ async function findMarkdownLinks() { console.log(`Found ${markdownFiles.length} markdown files\n`) - const errors: Array = [] - // Process each file for (const file of markdownFiles) { const content = readFileSync(file, 'utf-8') - const links: Array = markdownLinkExtractor(content) - - const filteredLinks = links.filter((link: any) => { - if (typeof link === 'string') { - return isRelativeLink(link) - } else if (link && typeof link.href === 'string') { - return isRelativeLink(link.href) - } - return false + const links: Array = markdownLinkExtractor(content) + + const relativeLinks = links.filter((link: string) => { + return isRelativeLink(link) }) - if (filteredLinks.length > 0) { - filteredLinks.forEach((link) => { - const href = typeof link === 'string' ? link : link.href - fileExistsForLink(href, file, errors) + if (relativeLinks.length > 0) { + relativeLinks.forEach((link) => { + relativeLinkExists(link, file) }) } } @@ -120,7 +113,7 @@ async function findMarkdownLinks() { console.log(`\n❌ Found ${errors.length} broken links:`) errors.forEach((err) => { console.log( - `${err.link}\n in: ${err.markdownFile}\n path: ${err.resolvedPath}\n why: ${err.reason}\n`, + `${err.file}\n link: ${err.link}\n resolved: ${err.resolvedPath}\n why: ${err.reason}\n`, ) }) process.exit(1) @@ -129,4 +122,4 @@ async function findMarkdownLinks() { } } -findMarkdownLinks().catch(console.error) +verifyMarkdownLinks().catch(console.error)