llm/LlmResponse.java

ZhiWei · src/main/java/com/lifepilot/llm/LlmResponse.java · java · MIT
ai

Immutable record for LLM API responses with reasoning, tool calls, and token metrics.

// Source: https://github.com/ntygod/ZhiWei | License: MIT | Copyright 2026 ntygod
// Provided via justclaw.it.com; keep this notice with the code.
package com.lifepilot.llm;

import org.springframework.lang.Nullable;

import java.util.List;
import java.util.Map;
import java.util.Optional;

/**
 * LLM 调用统一响应(富字段版本)。
 *
 * <p>承载推理模型多轮契约所需的全部字段:reasoning_content / reasoning_signature /
 * tool_calls / provider_metadata / reasoning_tokens / cached_input_tokens。
 *
 * @param content             响应正文(assistant message text)
 * @param reasoningContent    推理过程文本(DeepSeek V4 / Qwen3 等推理模型返回,可空)
 * @param reasoningSignature  推理签名(仅 Anthropic thinking block 使用,可空)
 * @param toolCalls           Provider 返回的工具调用列表(不可空,缺省 List.of())
 * @param providerMetadata    厂商私有元数据(多轮回传需要,缺省 Map.of())
 * @param in

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key