• Initiates an ask process within a chat context. Sends a message to the specified advisor and returns the chat response. Supports custom message types including objects, Blob, or string.

    Type Parameters

    • T = string

      The type of message content (defaults to string). Can be a custom object, Blob, or string.

    Parameters

    • message: T

      The message content to process or send. Type should match the advisor's expected message type.

    • advisorName: string

      The name of the advisor to handle the message.

    Returns Promise<string>

    The response from the advisor's chat handler.

    ask

    // Using default string message type
    const response = await ask("Hello", "TextAdvisor");
    // Using custom message type with structured data
    interface CustomMessage { text: string; priority: number; attachments?: Uint8Array[] }
    const response = await ask<CustomMessage>(
    { text: "Important", priority: 1, attachments: [data] },
    "StructuredAdvisor"
    );
    // Using Blob message type
    const blob = new Blob(["data"], { type: "text/plain" });
    const response = await ask<Blob>(blob, "BlobAdvisor");