/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { CreateChatAcceptEnum, llmChatCreateChat, } from "../funcs/llmChatCreateChat.js"; import { llmChatStream } from "../funcs/llmChatStream.js"; import { EventStream } from "../lib/event-streams.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as operations from "../models/operations/index.js"; import { unwrapAsync } from "../types/fp.js"; export { CreateChatAcceptEnum } from "../funcs/llmChatCreateChat.js"; export class Chat extends ClientSDK { /** * [Deprecated] Chat completions for OpenAI SDK/client usage * * @remarks * **Deprecated: Use the Responses API (`/api/v1/llm/responses`) instead.** OpenAI-compatible chat completion endpoint designed for use with the official OpenAI client libraries (Python, Node.js, etc.). Supports both streaming and non-streaming requests by setting the `stream` parameter. This endpoint handles the request/response directly and returns standard OpenAI-formatted responses. Use this when integrating with existing OpenAI client code. Note: The actual handler is registered at the Bun server level for optimal performance with the OpenAI SDK streaming format. * * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible. */ async createChat( request: operations.CreateChatCompletionRequest, options?: RequestOptions & { acceptHeaderOverride?: CreateChatAcceptEnum }, ): Promise { return unwrapAsync(llmChatCreateChat( this, request, options, )); } /** * [Deprecated] Streaming chat completions for generated SDK usage * * @remarks * **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. * * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible. */ async stream( request: operations.CreateChatCompletionStreamRequest, options?: RequestOptions, ): Promise> { return unwrapAsync(llmChatStream( this, request, options, )); } }