fixtures

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 26, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

fixtures 中的 Agent 测试数据工厂。

提供预置 Agent 配置、状态与消息样例。

fixtures 中的 LLM 响应测试数据工厂。

提供常见响应、流式片段与错误场景样例。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssistantMessage

func AssistantMessage(content string) types.Message

AssistantMessage 创建助手消息

func AssistantMessageWithToolCalls

func AssistantMessageWithToolCalls(content string, toolCalls []types.ToolCall) types.Message

AssistantMessageWithToolCalls 创建带工具调用的助手消息

func CalculationResponse

func CalculationResponse(result string) *llm.ChatResponse

CalculationResponse 返回计算响应

func CalculatorToolCall

func CalculatorToolCall(id string, a, b float64, op string) types.ToolCall

CalculatorToolCall 创建计算器工具调用

func CalculatorToolSchema

func CalculatorToolSchema() types.ToolSchema

CalculatorToolSchema 返回计算器工具定义

func ClarificationResponse

func ClarificationResponse(question string) *llm.ChatResponse

ClarificationResponse 返回澄清请求响应

func ContentFilteredResponse

func ContentFilteredResponse() *llm.ChatResponse

ContentFilteredResponse 返回被内容过滤的响应

func ConversationWithToolCalls

func ConversationWithToolCalls() []types.Message

ConversationWithToolCalls 返回包含工具调用的对话历史

func CustomUsage

func CustomUsage(prompt, completion int) llm.ChatUsage

CustomUsage 返回自定义 Token 使用

func DefaultAgentConfig

func DefaultAgentConfig() types.AgentConfig

DefaultAgentConfig 返回默认的 Agent 配置

func DefaultToolSet

func DefaultToolSet() []types.ToolSchema

DefaultToolSet 返回默认的工具集

func ErrorChunk

func ErrorChunk(err *types.Error) llm.StreamChunk

ErrorChunk 创建错误流式块

func ErrorExplanationResponse

func ErrorExplanationResponse(errorMsg string) *llm.ChatResponse

ErrorExplanationResponse 返回错误解释响应

func FullFeaturedConfig

func FullFeaturedConfig() types.AgentConfig

FullFeaturedConfig 返回启用所有功能的配置

func GreetingResponse

func GreetingResponse() *llm.ChatResponse

GreetingResponse 返回问候响应

func HighIterationAgentConfig

func HighIterationAgentConfig() types.AgentConfig

HighIterationAgentConfig 返回高迭代次数的 Agent 配置

func HighTemperatureAgentConfig

func HighTemperatureAgentConfig() types.AgentConfig

HighTemperatureAgentConfig 返回高温度(更创造性)的 Agent 配置

func LargeUsage

func LargeUsage() llm.ChatUsage

LargeUsage 返回大量 Token 使用

func LongConversation

func LongConversation(turns int) []types.Message

LongConversation 返回较长的对话历史

func LowTemperatureAgentConfig

func LowTemperatureAgentConfig() types.AgentConfig

LowTemperatureAgentConfig 返回低温度(更确定性)的 Agent 配置

func MediumUsage

func MediumUsage() llm.ChatUsage

MediumUsage 返回中等 Token 使用

func MinimalAgentConfig

func MinimalAgentConfig() types.AgentConfig

MinimalAgentConfig 返回最小化的 Agent 配置

func ReflectionEnabledConfig

func ReflectionEnabledConfig() types.AgentConfig

ReflectionEnabledConfig 返回启用反思功能的配置

func RefusalResponse

func RefusalResponse(reason string) *llm.ChatResponse

RefusalResponse 返回拒绝响应

func ResponseWithSingleToolCall

func ResponseWithSingleToolCall(content, toolName, toolID string, args []byte) *llm.ChatResponse

ResponseWithSingleToolCall 返回带单个工具调用的响应

func ResponseWithToolCalls

func ResponseWithToolCalls(content string, toolCalls []types.ToolCall) *llm.ChatResponse

ResponseWithToolCalls 返回带工具调用的响应

func ResponseWithUsage

func ResponseWithUsage(content string, promptTokens, completionTokens int) *llm.ChatResponse

ResponseWithUsage 返回带自定义 Token 使用量的响应

func SearchResultResponse

func SearchResultResponse(results []string) *llm.ChatResponse

SearchResultResponse 返回搜索结果响应

func SearchToolCall

func SearchToolCall(id, query string, limit int) types.ToolCall

SearchToolCall 创建搜索工具调用

func SearchToolSchema

func SearchToolSchema() types.ToolSchema

SearchToolSchema 返回搜索工具定义

func SimpleConversation

func SimpleConversation() []types.Message

SimpleConversation 返回简单的对话历史

func SimpleResponse

func SimpleResponse(content string) *llm.ChatResponse

SimpleResponse 返回简单的文本响应

func SimpleStreamChunks

func SimpleStreamChunks(content string, chunkSize int) []llm.StreamChunk

SimpleStreamChunks 返回简单的流式块序列

func SmallUsage

func SmallUsage() llm.ChatUsage

SmallUsage 返回小量 Token 使用

func StreamingAgentConfig

func StreamingAgentConfig() types.AgentConfig

StreamingAgentConfig 返回启用流式输出的 Agent 配置

func SystemMessage

func SystemMessage(content string) types.Message

SystemMessage 创建系统消息

func TextChunk

func TextChunk(content string, finishReason string) llm.StreamChunk

TextChunk 创建文本流式块

func ThinkingResponse

func ThinkingResponse(thinking, conclusion string) *llm.ChatResponse

ThinkingResponse 返回思考过程响应

func ToolCallChunk

func ToolCallChunk(toolCall types.ToolCall, finishReason string) llm.StreamChunk

ToolCallChunk 创建工具调用流式块

func ToolMessage

func ToolMessage(toolCallID, content string) types.Message

ToolMessage 创建工具消息

func ToolSelectionEnabledConfig

func ToolSelectionEnabledConfig() types.AgentConfig

ToolSelectionEnabledConfig 返回启用工具选择的配置

func TruncatedResponse

func TruncatedResponse(content string) *llm.ChatResponse

TruncatedResponse 返回因长度限制而截断的响应

func UserMessage

func UserMessage(content string) types.Message

UserMessage 创建用户消息

func WeatherToolCall

func WeatherToolCall(id, location, unit string) types.ToolCall

WeatherToolCall 创建天气工具调用

func WeatherToolSchema

func WeatherToolSchema() types.ToolSchema

WeatherToolSchema 返回天气工具定义

func WordByWordChunks

func WordByWordChunks(words []string) []llm.StreamChunk

WordByWordChunks 返回逐词的流式块序列

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL