ADK for TypeScript: API Reference
    Preparing search index...

    Interface LlmResponse

    这是一个 LLM(大型语言模型)响应类,用于从模型中获取第一个候选响应(如果该响应存在的话)。如果候选响应不存在,则会返回错误代码及相应的错误信息。

    interface LlmResponse {
        citationMetadata?: CitationMetadata;
        content?: Content;
        customMetadata?: { [key: string]: unknown };
        errorCode?: string;
        errorMessage?: string;
        finishReason?: FinishReason;
        goAway?: LiveServerGoAway;
        groundingMetadata?: GroundingMetadata;
        inputTranscription?: Transcription;
        interactionId?: string;
        interrupted?: boolean;
        liveSessionId?: string;
        liveSessionResumptionUpdate?: LiveServerSessionResumptionUpdate;
        modelVersion?: string;
        outputTranscription?: Transcription;
        partial?: boolean;
        turnComplete?: boolean;
        usageMetadata?: GenerateContentResponseUsageMetadata;
    }

    层次结构(Hierarchy)查看摘要)

    citationMetadata?: CitationMetadata

    响应中的引用元数据(citation metadata)。

    content?: Content

    响应的内容。

    customMetadata?: { [key: string]: unknown }

    `LlmResponse` 的自定义元数据(custom metadata)。 这是一个可选的键值对(key-value pair),用于为 `LlmResponse` 添加标签。 **注意:** 整个对象必须能够被序列化为 JSON 格式。

    errorCode?: string

    如果响应是一个错误,则会返回错误代码。该错误代码因型号不同而有所差异。

    errorMessage?: string

    如果响应出现错误,则会显示错误信息。

    finishReason?: FinishReason

    响应的完成原因(即响应状态或完成方式)。

    goAway?: LiveServerGoAway

    这是一个服务器端发出的信号,表示实时连接即将被关闭。调用方应使用最新的会话恢复机制重新建立连接。

    groundingMetadata?: GroundingMetadata

    响应中的基础元数据(即用于描述响应内容的元数据)。

    inputTranscription?: Transcription

    用户输入内容的音频转录结果。

    interactionId?: string

    模型返回的交互 ID(如果有的话)。

    interrupted?: boolean

    该标志表示在生成内容时,大型语言模型(LLM)的运行被中断了。通常这种情况是由于用户在双方向(bidi)文本流传输过程中进行了干预(例如中途停止了操作)。

    liveSessionId?: string

    该直播会话的会话 ID(Session ID)。

    liveSessionResumptionUpdate?: LiveServerSessionResumptionUpdate

    关于 LlmResponse 的会话恢复更新信息

    modelVersion?: string

    用于生成响应的模型版本。

    outputTranscription?: Transcription

    模型输出的音频转录文本。

    partial?: boolean

    该字段用于指示文本内容是否属于一个未完成的文本流。 仅适用于流式传输模式(streaming mode),且仅当文本内容为纯文本(plain text)时才会被使用。

    turnComplete?: boolean

    该字段用于指示模型返回的响应是否完整。 仅适用于流式处理(streaming mode)模式。

    usageMetadata?: GenerateContentResponseUsageMetadata

    LlmResponse 的使用元数据(usage metadata)。