import { BaseChatModelCallOptions, BaseChatModelParams } from "@langchain/core/language_models/chat_models"; //#region src/chat_models/responses-types.d.ts /** * Text input content item. */ interface XAIResponsesInputTextItem { type: "input_text"; /** The text content. */ text: string; } /** * Image input content item. * Note: Storing/fetching images is not fully supported. */ interface XAIResponsesInputImageItem { type: "input_image"; /** Public URL of the image. */ image_url: string; /** Image detail level. */ detail?: "high" | "low" | "auto"; } /** * File input content item. */ interface XAIResponsesInputFileItem { type: "input_file"; /** File ID from the Files API. */ file_id: string; } /** * Union type for all input content items. */ type XAIResponsesInputContentItem = XAIResponsesInputTextItem | XAIResponsesInputImageItem | XAIResponsesInputFileItem; /** * Function tool call from a previous response. */ interface XAIResponsesFunctionToolCall { type: "function_call"; /** The ID of the tool call. */ id: string; /** The ID of the tool call (alias). */ call_id?: string; /** The name of the function. */ name: string; /** The arguments to the function as a JSON string. */ arguments: string; } /** * Web search tool call from a previous response. */ interface XAIResponsesWebSearchToolCall { type: "web_search_call"; /** The ID of the tool call. */ id: string; /** The search status. */ status?: "in_progress" | "searching" | "completed" | "failed"; } /** * Code interpreter tool call from a previous response. */ interface XAIResponsesCodeInterpreterToolCall { type: "code_interpreter_call"; /** The ID of the tool call. */ id: string; /** The code to execute. */ code?: string; /** The status of the code interpreter. */ status?: "in_progress" | "interpreting" | "completed" | "failed"; } /** * MCP tool call from a previous response. */ interface XAIResponsesMcpToolCall { type: "mcp_call"; /** The ID of the tool call. */ id: string; /** The MCP server URL. */ server_url?: string; /** The MCP server label. */ server_label?: string; } /** * Union type for all tool calls from previous responses. */ type XAIResponsesToolCall = XAIResponsesFunctionToolCall | XAIResponsesWebSearchToolCall | XAIResponsesCodeInterpreterToolCall | XAIResponsesMcpToolCall; /** * Log probability information for a token. */ interface XAIResponsesLogprobToken { /** The token string. */ token: string; /** The log probability of the token. */ logprob: number; /** The bytes representation of the token. */ bytes?: number[]; } /** * Log probability content item. */ interface XAIResponsesLogprobContent { /** The token. */ token: string; /** The log probability. */ logprob: number; /** The bytes representation. */ bytes?: number[]; /** Top log probabilities at this position. */ top_logprobs?: XAIResponsesLogprobToken[]; } /** * Log probabilities from a previous response. */ interface XAIResponsesLogprobs { /** Log probability content. */ content?: XAIResponsesLogprobContent[]; } /** * Previous response structure that can be included in the input array. * Used for multi-turn conversations with assistant outputs. */ interface XAIResponsesPreviousResponse { /** The type identifier for previous response. */ type: "message"; /** The role for previous assistant responses. */ role: "assistant"; /** The text output from the previous response. */ text?: string; /** Refusal message if the model refused to respond. */ refusal?: string; /** Tool calls made in the previous response. */ tool_calls?: XAIResponsesToolCall[]; /** Log probabilities from the previous response. */ logprobs?: XAIResponsesLogprobs; } /** * Function tool call output to provide results back to the model. */ interface XAIResponsesFunctionToolOutput { type: "function_call_output"; /** The ID of the tool call this output is for. */ call_id: string; /** The output/result of the function call. */ output: string; } /** * Union type for tool outputs that can be included in input. */ type XAIResponsesToolOutput = XAIResponsesFunctionToolOutput; /** * Message role types. */ type XAIResponsesMessageRole = "user" | "assistant" | "system" | "developer"; /** * Message input to the model. */ interface XAIResponsesMessage { /** The role of the message author. */ role: XAIResponsesMessageRole; /** Text, image, or audio input. Can be a string or array of content items. */ content: string | XAIResponsesInputContentItem[]; /** Unique identifier for the end-user. Only for `user` messages. */ name?: string; } /** * Union type for all items that can appear in the input array. * Includes messages, previous responses, and tool outputs. */ type XAIResponsesInputItem = XAIResponsesMessage | XAIResponsesPreviousResponse | XAIResponsesToolOutput; /** * Input type - can be a string or array of input items. * The array can contain messages, previous responses, and tool outputs. */ type XAIResponsesInput = string | XAIResponsesInputItem[]; /** * Reasoning effort level. */ type XAIResponsesReasoningEffort = "low" | "medium" | "high"; /** * Reasoning summary style. */ type XAIResponsesReasoningSummary = "auto" | "concise" | "detailed"; /** * Reasoning configuration for reasoning models. */ interface XAIResponsesReasoning { /** The effort level for reasoning. Defaults to `medium`. */ effort?: XAIResponsesReasoningEffort; /** The summary style for reasoning output. */ summary?: XAIResponsesReasoningSummary; } /** * X (Twitter) search source configuration. */ interface XAIResponsesSearchSourceX { type: "x"; /** X handles to include in search. */ included_x_handles?: string[]; /** X handles to exclude from search. */ excluded_x_handles?: string[]; /** Minimum favorite count for posts. */ post_favorite_count?: number; /** Minimum view count for posts. */ post_view_count?: number; } /** * Web search source configuration. */ interface XAIResponsesSearchSourceWeb { type: "web"; /** Whitelist of allowed websites (max 5). */ allowed_websites?: string[]; /** Blacklist of excluded websites (max 5). */ excluded_websites?: string[]; /** ISO alpha-2 country code. */ country?: string; /** Whether to enable safe search. Defaults to `true`. */ safe_search?: boolean; } /** * RSS/News search source configuration. */ interface XAIResponsesSearchSourceRss { type: "rss"; /** Links of RSS feeds. */ links?: string[]; } /** * Union type for all search sources. */ type XAIResponsesSearchSource = XAIResponsesSearchSourceX | XAIResponsesSearchSourceWeb | XAIResponsesSearchSourceRss; /** * Search mode options. */ type XAIResponsesSearchMode = "off" | "on" | "auto"; /** * Search parameters configuration. * Takes precedence over `web_search_preview` tool. */ interface XAIResponsesSearchParameters { /** Start date for search results (ISO-8601 YYYY-MM-DD). */ from_date?: string; /** End date for search results (ISO-8601 YYYY-MM-DD). */ to_date?: string; /** Maximum number of search results. Defaults to 15 (range: 1-30). */ max_search_results?: number; /** Search mode. Defaults to `on`. */ mode?: XAIResponsesSearchMode; /** Whether to return citations. Defaults to `true`. */ return_citations?: boolean; /** List of search sources. If empty, searches web and X. */ sources?: XAIResponsesSearchSource[]; } /** * Plain text format. */ interface XAIResponsesTextFormatText { type: "text"; } /** * JSON object format. */ interface XAIResponsesTextFormatJsonObject { type: "json_object"; } /** * JSON schema format. */ interface XAIResponsesTextFormatJsonSchema { type: "json_schema"; /** JSON schema definition. */ schema: Record; /** Compatibility field for strict mode. */ strict?: boolean; } /** * Union type for all text response formats. */ type XAIResponsesTextFormat = XAIResponsesTextFormatText | XAIResponsesTextFormatJsonObject | XAIResponsesTextFormatJsonSchema; /** * Text response configuration. */ interface XAIResponsesText { /** The format for text response. */ format?: XAIResponsesTextFormat; } /** * Function tool parameters using JSON Schema. */ interface XAIResponsesFunctionToolFunction { /** The name of the function. */ name: string; /** A description of what the function does. */ description?: string; /** The parameters the function accepts, described as a JSON Schema object. */ parameters: Record; } /** * Function tool definition. */ interface XAIResponsesFunctionTool { type: "function"; /** The function definition. */ function: XAIResponsesFunctionToolFunction; } /** * Web search tool definition. * Enables the model to search the web and browse pages for real-time information. */ interface XAIResponsesWebSearchTool { type: "web_search"; /** Domains to exclusively include in the search (max 5). */ allowed_domains?: string[]; /** Domains to exclude from the search (max 5). */ excluded_domains?: string[]; /** Whether to enable image understanding during search. */ enable_image_understanding?: boolean; } /** * X search tool definition. */ interface XAIResponsesXSearchTool { type: "x_search"; /** X handles to allow in search. */ allowed_x_handles?: string[]; /** X handles to exclude from search. */ excluded_x_handles?: string[]; /** Whether to enable image understanding. */ enable_image_understanding?: boolean; /** Whether to enable video understanding. */ enable_video_understanding?: boolean; /** Start date for search (ISO-8601). */ from_date?: string; /** End date for search (ISO-8601). */ to_date?: string; } /** * File search tool definition. */ interface XAIResponsesFileSearchTool { type: "file_search"; /** List of vector store IDs to search. */ vector_store_ids?: string[]; } /** * Code interpreter tool definition. */ interface XAIResponsesCodeInterpreterTool { type: "code_interpreter"; } /** * MCP (Model Context Protocol) tool definition. */ interface XAIResponsesMcpTool { type: "mcp"; /** The URL of the MCP server. */ server_url: string; /** The label for the MCP server. */ server_label: string; } /** * Union type for all tool definitions. */ type XAIResponsesTool = XAIResponsesFunctionTool | XAIResponsesWebSearchTool | XAIResponsesXSearchTool | XAIResponsesFileSearchTool | XAIResponsesCodeInterpreterTool | XAIResponsesMcpTool; /** * String tool choice options. */ type XAIResponsesToolChoiceString = "none" | "auto" | "required"; /** * Function tool choice object. */ interface XAIResponsesToolChoiceFunction { type: "function"; function: { /** The name of the function to call. */name: string; }; } /** * Tool choice configuration. */ type XAIResponsesToolChoice = XAIResponsesToolChoiceString | XAIResponsesToolChoiceFunction; /** * Additional output data to include in the response. */ type XAIResponsesInclude = "reasoning.encrypted_content"; /** * xAI Responses API request body parameters. */ interface XAIResponsesCreateParams { /** * The input passed to the model. * Can be text (string) or an array of message objects. */ input: XAIResponsesInput; /** * Model name for the model to use (e.g., from xAI console). */ model?: string; /** * Whether to process the response asynchronously in the background. * Note: Unsupported. * @default false */ background?: boolean; /** * What additional output data to include in the response. * Currently supported: `reasoning.encrypted_content`. */ include?: XAIResponsesInclude[]; /** * An alternate way to specify the system prompt. * Cannot be used with `previous_response_id`. */ instructions?: string; /** * Whether to return log probabilities of the output tokens. * @default false */ logprobs?: boolean; /** * Max number of tokens that can be generated. * Includes both output and reasoning tokens. */ max_output_tokens?: number; /** * Metadata for the request. * Note: Not supported. Maintained for compatibility. */ metadata?: Record; /** * Whether to allow the model to run parallel tool calls. * @default true */ parallel_tool_calls?: boolean; /** * The ID of the previous response from the model. * Use this to create multi-turn conversations. */ previous_response_id?: string; /** * Reasoning configuration. * Only for reasoning models. */ reasoning?: XAIResponsesReasoning; /** * Set parameters for searched data. * Takes precedence over `web_search_preview` tool. */ search_parameters?: XAIResponsesSearchParameters; /** * Service tier for the request. * Note: Not supported. Maintained for compatibility. */ service_tier?: string; /** * Whether to store the input message(s) and response. * @default true */ store?: boolean; /** * If set, partial message deltas will be sent as server-sent events. * @default false */ stream?: boolean; /** * Sampling temperature between 0 and 2. * Higher values make output more random, lower values more deterministic. * @default 1 */ temperature?: number; /** * Settings for customizing a text response. */ text?: XAIResponsesText; /** * Controls which tool is called by the model. */ tool_choice?: XAIResponsesToolChoice; /** * A list of tools the model may call. * Maximum of 128 tools. */ tools?: XAIResponsesTool[]; /** * Number of most likely tokens to return at each token position. * Range: 0-8. Requires `logprobs` to be `true`. */ top_logprobs?: number; /** * Nucleus sampling probability mass. * The model considers results of tokens with top_p probability mass. * @default 1 */ top_p?: number; /** * Truncation strategy. * Note: Not supported. Maintained for compatibility. */ truncation?: string; /** * Unique identifier representing your end-user. * Used for monitoring and abuse detection. */ user?: string; } /** * Streaming variant of the request params. */ interface XAIResponsesCreateParamsStreaming extends XAIResponsesCreateParams { stream: true; } /** * Non-streaming variant of the request params. */ interface XAIResponsesCreateParamsNonStreaming extends XAIResponsesCreateParams { stream?: false; } /** * Response status values. */ type XAIResponsesStatus = "completed" | "in_progress" | "incomplete"; /** * Response object type literal. */ type XAIResponsesObjectType = "response"; /** * Text output item in the response. */ interface XAIResponsesOutputTextItem { type: "message"; /** The role of the message (always assistant for outputs). */ role: "assistant"; /** The text content of the message. */ content: XAIResponsesOutputContent[]; /** The ID of this output item. */ id?: string; /** The status of this output item. */ status?: XAIResponsesStatus; } /** * Text content in an output message. */ interface XAIResponsesOutputTextContent { type: "output_text"; /** The text content. */ text: string; /** Annotations on the text (e.g., citations). */ annotations?: XAIResponsesAnnotation[]; } /** * Refusal content in an output message. */ interface XAIResponsesOutputRefusalContent { type: "refusal"; /** The refusal message. */ refusal: string; } /** * Union type for output content items. */ type XAIResponsesOutputContent = XAIResponsesOutputTextContent | XAIResponsesOutputRefusalContent; /** * Citation annotation for web search results. */ interface XAIResponsesUrlCitationAnnotation { type: "url_citation"; /** Start index in the text. */ start_index: number; /** End index in the text. */ end_index: number; /** The URL being cited. */ url: string; /** The title of the cited page. */ title?: string; } /** * File citation annotation. */ interface XAIResponsesFileCitationAnnotation { type: "file_citation"; /** Start index in the text. */ start_index: number; /** End index in the text. */ end_index: number; /** The file ID being cited. */ file_id: string; /** The filename. */ filename?: string; } /** * Union type for all annotation types. */ type XAIResponsesAnnotation = XAIResponsesUrlCitationAnnotation | XAIResponsesFileCitationAnnotation; /** * Function call output item. */ interface XAIResponsesOutputFunctionCall { type: "function_call"; /** The ID of the function call. */ id: string; /** The ID of the function call (alias). */ call_id?: string; /** The name of the function being called. */ name: string; /** The arguments to the function as a JSON string. */ arguments: string; /** The status of the function call. */ status?: XAIResponsesStatus; } /** * Web search call output item. */ interface XAIResponsesOutputWebSearchCall { type: "web_search_call"; /** The ID of the web search call. */ id: string; /** The status of the web search. */ status?: "in_progress" | "searching" | "completed" | "failed"; } /** * File search call output item. */ interface XAIResponsesOutputFileSearchCall { type: "file_search_call"; /** The ID of the file search call. */ id: string; /** The status of the file search. */ status?: "in_progress" | "searching" | "completed" | "failed"; /** The search queries used. */ queries?: string[]; /** The search results. */ results?: XAIResponsesFileSearchResult[]; } /** * File search result item. */ interface XAIResponsesFileSearchResult { /** The file ID. */ file_id: string; /** The filename. */ filename?: string; /** The score/relevance of the result. */ score?: number; /** The matched text content. */ text?: string; } /** * Code interpreter call output item. */ interface XAIResponsesOutputCodeInterpreterCall { type: "code_interpreter_call"; /** The ID of the code interpreter call. */ id: string; /** The code being executed. */ code?: string; /** The status of the code interpreter. */ status?: "in_progress" | "interpreting" | "completed" | "failed"; /** The results of the code execution. */ results?: XAIResponsesCodeInterpreterResult[]; } /** * Code interpreter result item. */ interface XAIResponsesCodeInterpreterResult { type: "logs" | "image"; /** The log output (for type "logs"). */ logs?: string; /** The image data (for type "image"). */ image?: { /** The base64-encoded image data. */data?: string; /** The MIME type of the image. */ media_type?: string; }; } /** * MCP call output item. */ interface XAIResponsesOutputMcpCall { type: "mcp_call"; /** The ID of the MCP call. */ id: string; /** The MCP server URL. */ server_url?: string; /** The MCP server label. */ server_label?: string; /** The status of the MCP call. */ status?: "in_progress" | "completed" | "failed"; } /** * Reasoning output item. */ interface XAIResponsesOutputReasoning { type: "reasoning"; /** The ID of the reasoning item. */ id?: string; /** Summary of the reasoning. */ summary?: XAIResponsesReasoningSummaryItem[]; /** Encrypted reasoning content (if included). */ encrypted_content?: string; } /** * Reasoning summary item. */ interface XAIResponsesReasoningSummaryItem { type: "summary_text"; /** The summary text. */ text: string; } /** * Union type for all response output items. */ type XAIResponsesOutputItem = XAIResponsesOutputTextItem | XAIResponsesOutputFunctionCall | XAIResponsesOutputWebSearchCall | XAIResponsesOutputFileSearchCall | XAIResponsesOutputCodeInterpreterCall | XAIResponsesOutputMcpCall | XAIResponsesOutputReasoning; /** * Token usage information for the response. */ interface XAIResponsesUsage { /** Number of tokens in the input/prompt. */ input_tokens: number; /** Number of tokens in the output/completion. */ output_tokens: number; /** Total number of tokens used. */ total_tokens: number; /** Detailed breakdown of input tokens. */ input_tokens_details?: { /** Cached tokens from previous requests. */cached_tokens?: number; }; /** Detailed breakdown of output tokens. */ output_tokens_details?: { /** Tokens used for reasoning. */reasoning_tokens?: number; }; } /** * Reason for incomplete response. */ type XAIResponsesIncompleteReason = "max_output_tokens" | "content_filter" | "turn_limit" | "tool_use_limit"; /** * Details about why a response is incomplete. */ interface XAIResponsesIncompleteDetails { /** The reason the response is incomplete. */ reason?: XAIResponsesIncompleteReason; } /** * Debug output information (when available). */ interface XAIResponsesDebugOutput { /** Debug model information. */ model_info?: Record; /** Additional debug data. */ [key: string]: unknown; } /** * Reasoning configuration echoed in the response. */ interface XAIResponsesReasoningResponse { /** The effort level used for reasoning. */ effort?: XAIResponsesReasoningEffort; /** The summary style used. */ summary?: XAIResponsesReasoningSummary; } /** * xAI Responses API response body. */ interface XAIResponse { /** * Unique ID of the response. */ id: string; /** * The object type of this resource. Always set to `response`. */ object: XAIResponsesObjectType; /** * The Unix timestamp (in seconds) for the response creation time. */ created_at: number; /** * Model name used to generate the response. */ model: string; /** * Status of the response. */ status: XAIResponsesStatus; /** * The response generated by the model. */ output: XAIResponsesOutputItem[]; /** * Whether to allow the model to run parallel tool calls. */ parallel_tool_calls?: boolean; /** * Whether to store the input message(s) and response. * @default true */ store?: boolean; /** * Settings for customizing a text response. */ text?: XAIResponsesText; /** * Controls which tool is called by the model. */ tool_choice?: XAIResponsesToolChoice; /** * A list of tools the model may call. * Maximum of 128 tools. */ tools?: XAIResponsesTool[]; /** * Whether to process the response asynchronously in the background. * Note: Unsupported. * @default false */ background?: boolean | null; /** * Debug output information (when available). */ debug_output?: XAIResponsesDebugOutput | null; /** * Details about why the response is incomplete (if status is "incomplete"). */ incomplete_details?: XAIResponsesIncompleteDetails | null; /** * Max number of tokens that can be generated. * Includes both output and reasoning tokens. */ max_output_tokens?: number | null; /** * Only included for compatibility. */ metadata?: Record | null; /** * The ID of the previous response from the model. */ previous_response_id?: string | null; /** * Reasoning configuration used for the response. */ reasoning?: XAIResponsesReasoningResponse | null; /** * Sampling temperature used (between 0 and 2). * @default 1 */ temperature?: number | null; /** * Nucleus sampling probability mass used. * @default 1 */ top_p?: number | null; /** * Token usage information. */ usage?: XAIResponsesUsage | null; /** * Unique identifier representing your end-user. * Used for monitoring and abuse detection. */ user?: string | null; } /** * Base streaming event structure. */ interface XAIResponsesStreamEventBase { /** The type of the streaming event. */ type: string; } /** * Response created event. */ interface XAIResponsesStreamEventCreated extends XAIResponsesStreamEventBase { type: "response.created"; /** The response object. */ response: XAIResponse; } /** * Response in progress event. */ interface XAIResponsesStreamEventInProgress extends XAIResponsesStreamEventBase { type: "response.in_progress"; /** The response object. */ response: XAIResponse; } /** * Response completed event. */ interface XAIResponsesStreamEventCompleted extends XAIResponsesStreamEventBase { type: "response.completed"; /** The completed response object. */ response: XAIResponse; } /** * Response failed event. */ interface XAIResponsesStreamEventFailed extends XAIResponsesStreamEventBase { type: "response.failed"; /** The failed response object. */ response: XAIResponse; /** Error information. */ error?: { /** Error code. */code?: string; /** Error message. */ message?: string; }; } /** * Response incomplete event. */ interface XAIResponsesStreamEventIncomplete extends XAIResponsesStreamEventBase { type: "response.incomplete"; /** The incomplete response object. */ response: XAIResponse; } /** * Output item added event. */ interface XAIResponsesStreamEventOutputItemAdded extends XAIResponsesStreamEventBase { type: "response.output_item.added"; /** The index of the output item. */ output_index: number; /** The output item that was added. */ item: XAIResponsesOutputItem; } /** * Output item done event. */ interface XAIResponsesStreamEventOutputItemDone extends XAIResponsesStreamEventBase { type: "response.output_item.done"; /** The index of the output item. */ output_index: number; /** The completed output item. */ item: XAIResponsesOutputItem; } /** * Content part added event. */ interface XAIResponsesStreamEventContentPartAdded extends XAIResponsesStreamEventBase { type: "response.content_part.added"; /** The index of the output item. */ output_index: number; /** The index of the content part. */ content_index: number; /** The content part that was added. */ part: XAIResponsesOutputContent; } /** * Content part done event. */ interface XAIResponsesStreamEventContentPartDone extends XAIResponsesStreamEventBase { type: "response.content_part.done"; /** The index of the output item. */ output_index: number; /** The index of the content part. */ content_index: number; /** The completed content part. */ part: XAIResponsesOutputContent; } /** * Text delta event (streaming text). */ interface XAIResponsesStreamEventTextDelta extends XAIResponsesStreamEventBase { type: "response.output_text.delta"; /** The index of the output item. */ output_index: number; /** The index of the content part. */ content_index: number; /** The text delta. */ delta: string; } /** * Text done event. */ interface XAIResponsesStreamEventTextDone extends XAIResponsesStreamEventBase { type: "response.output_text.done"; /** The index of the output item. */ output_index: number; /** The index of the content part. */ content_index: number; /** The complete text. */ text: string; } /** * Function call arguments delta event. */ interface XAIResponsesStreamEventFunctionCallArgumentsDelta extends XAIResponsesStreamEventBase { type: "response.function_call_arguments.delta"; /** The index of the output item. */ output_index: number; /** The ID of the function call. */ call_id: string; /** The arguments delta. */ delta: string; } /** * Function call arguments done event. */ interface XAIResponsesStreamEventFunctionCallArgumentsDone extends XAIResponsesStreamEventBase { type: "response.function_call_arguments.done"; /** The index of the output item. */ output_index: number; /** The ID of the function call. */ call_id: string; /** The complete arguments. */ arguments: string; } /** * Reasoning summary text delta event. */ interface XAIResponsesStreamEventReasoningSummaryTextDelta extends XAIResponsesStreamEventBase { type: "response.reasoning_summary_text.delta"; /** The index of the output item. */ output_index: number; /** The index of the summary part. */ summary_index: number; /** The text delta. */ delta: string; } /** * Reasoning summary text done event. */ interface XAIResponsesStreamEventReasoningSummaryTextDone extends XAIResponsesStreamEventBase { type: "response.reasoning_summary_text.done"; /** The index of the output item. */ output_index: number; /** The index of the summary part. */ summary_index: number; /** The complete text. */ text: string; } /** * Error event. */ interface XAIResponsesStreamEventError extends XAIResponsesStreamEventBase { type: "error"; /** Error code. */ code?: string; /** Error message. */ message?: string; /** Error parameter. */ param?: string; } /** * Union type for all streaming events. */ type XAIResponsesStreamEvent = XAIResponsesStreamEventCreated | XAIResponsesStreamEventInProgress | XAIResponsesStreamEventCompleted | XAIResponsesStreamEventFailed | XAIResponsesStreamEventIncomplete | XAIResponsesStreamEventOutputItemAdded | XAIResponsesStreamEventOutputItemDone | XAIResponsesStreamEventContentPartAdded | XAIResponsesStreamEventContentPartDone | XAIResponsesStreamEventTextDelta | XAIResponsesStreamEventTextDone | XAIResponsesStreamEventFunctionCallArgumentsDelta | XAIResponsesStreamEventFunctionCallArgumentsDone | XAIResponsesStreamEventReasoningSummaryTextDelta | XAIResponsesStreamEventReasoningSummaryTextDone | XAIResponsesStreamEventError; /** * Call options for ChatXAIResponses. */ interface ChatXAIResponsesCallOptions extends BaseChatModelCallOptions { /** * Configuration options for a text response from the model. */ text?: XAIResponsesText; /** * Specify additional output data to include in the model response. */ include?: XAIResponsesInclude[]; /** * The unique ID of the previous response to the model. * Use this to create multi-turn conversations. */ previous_response_id?: string; /** * Search parameters for xAI's search capabilities. */ search_parameters?: XAIResponsesSearchParameters; /** * Reasoning configuration for reasoning models. */ reasoning?: XAIResponsesReasoning; /** * A list of tools the model may call. * Includes built-in tools (web_search, x_search, code_interpreter, file_search) * and custom function tools. * * @example * ```typescript * import { tools } from "@langchain/xai"; * * const result = await llm.invoke("What's happening on X?", { * tools: [tools.xaiWebSearch(), tools.xaiXSearch()], * }); * ``` */ tools?: XAIResponsesTool[]; /** * Controls which tool is called by the model. */ tool_choice?: XAIResponsesToolChoice; /** * Whether to allow the model to run parallel tool calls. */ parallel_tool_calls?: boolean; } /** * Input configuration for ChatXAIResponses constructor. */ interface ChatXAIResponsesInput extends BaseChatModelParams { /** * The xAI API key to use for requests. * @default process.env.XAI_API_KEY */ apiKey?: string; /** * The name of the model to use. * @default "grok-3" */ model?: string; /** * Whether to stream responses. * @default false */ streaming?: boolean; /** * Sampling temperature between 0 and 2. * @default 1 */ temperature?: number; /** * Nucleus sampling probability mass. * @default 1 */ topP?: number; /** * Maximum number of tokens to generate. */ maxOutputTokens?: number; /** * Whether to store the input messages and response. * @default true */ store?: boolean; /** * A unique identifier representing your end-user. */ user?: string; /** * The base URL for the xAI API. * @default "https://api.x.ai/v1" */ baseURL?: string; /** * Default search parameters for xAI's search capabilities. */ searchParameters?: XAIResponsesSearchParameters; /** * Default reasoning configuration. */ reasoning?: XAIResponsesReasoning; /** * Default tools to make available to the model. * Can be overridden per-request in call options. * * @example * ```typescript * import { ChatXAIResponses, tools } from "@langchain/xai"; * * const llm = new ChatXAIResponses({ * model: "grok-4-1-fast", * tools: [tools.xaiWebSearch(), tools.xaiCodeExecution()], * }); * ``` */ tools?: XAIResponsesTool[]; } /** * Invocation parameters for ChatXAIResponses (request params without input). */ type ChatXAIResponsesInvocationParams = Omit; //#endregion export { ChatXAIResponsesCallOptions, ChatXAIResponsesInput, ChatXAIResponsesInvocationParams, XAIResponse, XAIResponsesAnnotation, XAIResponsesCodeInterpreterResult, XAIResponsesCodeInterpreterTool, XAIResponsesCodeInterpreterToolCall, XAIResponsesCreateParams, XAIResponsesCreateParamsNonStreaming, XAIResponsesCreateParamsStreaming, XAIResponsesDebugOutput, XAIResponsesFileCitationAnnotation, XAIResponsesFileSearchResult, XAIResponsesFileSearchTool, XAIResponsesFunctionTool, XAIResponsesFunctionToolCall, XAIResponsesFunctionToolFunction, XAIResponsesFunctionToolOutput, XAIResponsesInclude, XAIResponsesIncompleteDetails, XAIResponsesIncompleteReason, XAIResponsesInput, XAIResponsesInputContentItem, XAIResponsesInputFileItem, XAIResponsesInputImageItem, XAIResponsesInputItem, XAIResponsesInputTextItem, XAIResponsesLogprobContent, XAIResponsesLogprobToken, XAIResponsesLogprobs, XAIResponsesMcpTool, XAIResponsesMcpToolCall, XAIResponsesMessage, XAIResponsesMessageRole, XAIResponsesObjectType, XAIResponsesOutputCodeInterpreterCall, XAIResponsesOutputContent, XAIResponsesOutputFileSearchCall, XAIResponsesOutputFunctionCall, XAIResponsesOutputItem, XAIResponsesOutputMcpCall, XAIResponsesOutputReasoning, XAIResponsesOutputRefusalContent, XAIResponsesOutputTextContent, XAIResponsesOutputTextItem, XAIResponsesOutputWebSearchCall, XAIResponsesPreviousResponse, XAIResponsesReasoning, XAIResponsesReasoningEffort, XAIResponsesReasoningResponse, XAIResponsesReasoningSummary, XAIResponsesReasoningSummaryItem, XAIResponsesSearchMode, XAIResponsesSearchParameters, XAIResponsesSearchSource, XAIResponsesSearchSourceRss, XAIResponsesSearchSourceWeb, XAIResponsesSearchSourceX, XAIResponsesStatus, XAIResponsesStreamEvent, XAIResponsesStreamEventBase, XAIResponsesStreamEventCompleted, XAIResponsesStreamEventContentPartAdded, XAIResponsesStreamEventContentPartDone, XAIResponsesStreamEventCreated, XAIResponsesStreamEventError, XAIResponsesStreamEventFailed, XAIResponsesStreamEventFunctionCallArgumentsDelta, XAIResponsesStreamEventFunctionCallArgumentsDone, XAIResponsesStreamEventInProgress, XAIResponsesStreamEventIncomplete, XAIResponsesStreamEventOutputItemAdded, XAIResponsesStreamEventOutputItemDone, XAIResponsesStreamEventReasoningSummaryTextDelta, XAIResponsesStreamEventReasoningSummaryTextDone, XAIResponsesStreamEventTextDelta, XAIResponsesStreamEventTextDone, XAIResponsesText, XAIResponsesTextFormat, XAIResponsesTextFormatJsonObject, XAIResponsesTextFormatJsonSchema, XAIResponsesTextFormatText, XAIResponsesTool, XAIResponsesToolCall, XAIResponsesToolChoice, XAIResponsesToolChoiceFunction, XAIResponsesToolChoiceString, XAIResponsesToolOutput, XAIResponsesUrlCitationAnnotation, XAIResponsesUsage, XAIResponsesWebSearchTool, XAIResponsesWebSearchToolCall, XAIResponsesXSearchTool }; //# sourceMappingURL=responses-types.d.ts.map