langchain.js
    Preparing search index...

    Interface ChatXAICallOptions

    interface ChatXAICallOptions {
        headers?: Record<string, string>;
        searchParameters?: XAISearchParameters;
        tool_choice?: any;
        tools?: any[];
    }

    Hierarchy (View Summary)

    Index

    Properties

    headers?: Record<string, string>
    searchParameters?: XAISearchParameters

    Search parameters for xAI's Live Search API. Enables the model to search the web for real-time information.

    This is an alternative to using tools: [{ type: "live_search" }]. The Live Search API parameters approach may be deprecated in favor of the tool-based approach.

    const result = await llm.invoke("What's the latest news?", {
    searchParameters: {
    mode: "auto",
    max_search_results: 5,
    }
    });
    tool_choice?: any
    tools?: any[]

    A list of tools the model may call. Can include standard function tools and xAI built-in tools like { type: "live_search" }.

    // Using built-in live_search tool
    const llm = new ChatXAI().bindTools([{ type: "live_search" }]);
    const result = await llm.invoke("What happened in tech news today?");