import { ProviderError } from '../types/errors.js'; import type { ToolDefinition } from '../types/tools.js'; export { normalizeProviderError } from './provider-error.js'; import type { ChatRequest, ContentPart, ProviderMessage } from './interface.js'; export type ResponsesInputItem = { role: 'user'; content: Array<{ type: 'input_text'; text: string; } | { type: 'input_image'; image_url: string; detail: 'auto'; }>; } | { type: 'message'; role: 'assistant'; content: Array<{ type: 'output_text'; text: string; annotations: []; }>; status: 'completed'; id: string; } | { type: 'function_call'; id: string; call_id: string; name: string; arguments: string; } | { type: 'function_call_output'; call_id: string; output: string; }; export type NativeChatOutputItem = { type: 'message'; content?: string; } | { type: 'reasoning'; content?: string; } | { type: 'tool_call'; tool?: string; arguments?: Record; } | { type: 'invalid_tool_call'; reason?: string; }; export type NativeChatResult = { output?: NativeChatOutputItem[] | undefined; stats?: { input_tokens?: number | undefined; output_tokens?: number | undefined; total_output_tokens?: number | undefined; }; response_id?: string | undefined; }; export type NativeChatContext = { input: string | Array>; previousResponseId?: string | undefined; }; export type LMStudioResponsesStream = AsyncIterable & { finalResponse?: (() => Promise>) | undefined; }; export type LMStudioResponsesClient = { create(params: Record, options?: { signal?: AbortSignal; }): Promise; }; export type NativeFetch = (input: RequestInfo | URL, init?: RequestInit) => Promise; /** * Build the LM Studio responses client. * * `openai` is an optionalDependency, so the client is built on the first * `create()` call rather than here, a static import plus a construction at * call time put the specifier on the module graph of everything that reaches * the LM Studio provider, and an absent optional package then took the whole * process down at module init (see utils/optional-dependency.ts). This * function's signature is unchanged; `create()` was already async, so the one * memoised construction now happens inside it, and when the package is absent * the returned promise rejects with an error naming it. */ export declare function createResponsesClient(baseURL: string, apiKey: string, defaultHeaders: Record | undefined): LMStudioResponsesClient; export declare function deriveNativeChatUrl(baseURL: string): string; export declare function toNativeChatInput(content: string | ContentPart[]): string | Array>; export declare function buildResponsesTools(tools?: ToolDefinition[]): Array> | undefined; export declare function buildResponsesInput(messages: ProviderMessage[]): ResponsesInputItem[]; export declare function buildResponsesReasoning(reasoningEffort: ChatRequest['reasoningEffort']): Record | undefined; export declare function mapNativeReasoningEffort(reasoningEffort: ChatRequest['reasoningEffort']): 'off' | 'low' | 'medium' | 'high' | undefined; export declare function extractNativeMessageText(output: NativeChatOutputItem[] | undefined): string; export declare function consumeSSE(body: ReadableStream, onEvent: (eventType: string, payload: Record) => void): Promise; export declare function buildHttpError(prefix: string, response: Response, provider: string, operation: string, phase: string): Promise; export declare function makeTranscriptKey(model: string, systemPrompt: string | undefined, messages: ProviderMessage[]): string; export declare function toRecord(value: unknown): Record; export declare function shouldFallbackFromNative(err: unknown): boolean; export declare function shouldFallbackFromResponses(err: unknown): boolean; //# sourceMappingURL=lm-studio-helpers.d.ts.map