/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { llmChatStream } from "../../funcs/llmChatStream.js"; import * as operations from "../../models/operations/index.js"; import { formatResult, ToolDefinition } from "../tools.js"; const args = { request: operations.CreateChatCompletionStreamRequest$inboundSchema, }; export const tool$llmChatStream: ToolDefinition = { name: "llm-chat-stream", description: `[Deprecated] Streaming chat completions for generated SDK usage **Deprecated: Use the Responses API (\`/api/v1/llm/responses\`) instead.** Streaming chat completion endpoint designed for use with the generated TypeScript/JavaScript SDK from the OpenAPI specification. This endpoint uses ORPC's native streaming via async generators and returns Server-Sent Events (SSE) formatted as structured JSON chunks. Unlike the OpenAI client endpoint, this provides better type safety and integration with the generated SDK. Use this endpoint when working with the auto-generated API client for type-safe streaming responses. The endpoint supports response caching, request resumption via \`x-last-chunk-index\` header, and automatic usage tracking.`, args, tool: async (client, args, ctx) => { const [result, apiCall] = await llmChatStream( client, args.request, { fetchOptions: { signal: ctx.signal } }, ).$inspect(); if (!result.ok) { return { content: [{ type: "text", text: result.error.message }], isError: true, }; } const value = result.value; return formatResult(value, apiCall); }, };