import { ChatModelStreamEvent } from "./event.js";

//#region src/language_models/openai_completions_stream.d.ts
type OpenAICompletionsFinishReason = "stop" | "length" | "max_tokens" | "tool_calls" | "function_call" | "content_filter" | null;
interface OpenAICompletionsUsage {
  prompt_tokens?: number;
  completion_tokens?: number;
  total_tokens?: number;
  prompt_tokens_details?: {
    audio_tokens?: number;
    cached_tokens?: number;
  };
  completion_tokens_details?: {
    audio_tokens?: number;
    reasoning_tokens?: number;
  };
}
interface OpenAICompletionsToolCallDelta {
  index?: number;
  id?: string;
  type?: "function";
  function?: {
    name?: string;
    arguments?: string;
  };
}
interface OpenAICompletionsDelta {
  role?: string;
  content?: string | null;
  reasoning_content?: string;
  reasoning?: string;
  tool_calls?: OpenAICompletionsToolCallDelta[];
  function_call?: unknown;
  audio?: {
    id?: string;
    data?: string;
    transcript?: string;
  };
}
interface OpenAICompletionsStreamChoice {
  index?: number;
  finish_reason?: OpenAICompletionsFinishReason;
  logprobs?: unknown;
  delta?: OpenAICompletionsDelta;
}
interface OpenAICompletionsStreamChunk {
  id?: string;
  model?: string;
  service_tier?: string | null;
  system_fingerprint?: string | null;
  usage?: OpenAICompletionsUsage | null;
  x_groq?: {
    usage?: {
      prompt_tokens?: number;
      completion_tokens?: number;
      total_tokens?: number;
    };
  };
  choices?: OpenAICompletionsStreamChoice[];
}
interface ConvertOpenAICompletionsStreamOptions {
  streamUsage?: boolean;
  /** Provider id for passthrough events (default `"openai"`). */
  provider?: string;
  /** Optional per-chunk transform before conversion. */
  mapChunk?: (chunk: OpenAICompletionsStreamChunk) => OpenAICompletionsStreamChunk;
}
/**
 * Convert an async iterable of OpenAI Chat Completions-shaped stream chunks into
 * LangChain `ChatModelStreamEvent`s with typed deltas.
 */
declare function convertOpenAICompletionsStream(source: AsyncIterable<OpenAICompletionsStreamChunk>, options?: ConvertOpenAICompletionsStreamOptions): AsyncGenerator<ChatModelStreamEvent>;
//#endregion
export { ConvertOpenAICompletionsStreamOptions, OpenAICompletionsDelta, OpenAICompletionsFinishReason, OpenAICompletionsStreamChoice, OpenAICompletionsStreamChunk, OpenAICompletionsToolCallDelta, OpenAICompletionsUsage, convertOpenAICompletionsStream };
//# sourceMappingURL=openai_completions_stream.d.ts.map