123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- package eta_llm_http
- import "encoding/json"
- type BaseResponse struct {
- Ret int `json:"ret"`
- Msg string `json:"msg"`
- Success bool `json:"success"`
- Data json.RawMessage `json:"data"`
- }
- type SteamResponse struct {
- Data ChunkResponse `json:"data"`
- }
- // ChunkResponse 定义流式响应的结构体
- type ChunkResponse struct {
- ID string `json:"id"`
- Object string `json:"object"`
- Model string `json:"model"`
- Created int64 `json:"created"`
- Status *string `json:"status"`
- MessageType int `json:"message_type"`
- MessageID *string `json:"message_id"`
- IsRef bool `json:"is_ref"`
- Docs []string `json:"docs"`
- Choices []Choice `json:"choices"`
- }
- // Choice 定义选择的结构体
- type Choice struct {
- Delta Delta `json:"delta"`
- Role string `json:"role"`
- }
- // Delta 定义增量的结构体
- type Delta struct {
- Content string `json:"content"`
- ToolCalls []ToolCall `json:"tool_calls"`
- }
- // ToolCall 定义工具调用的结构体
- type ToolCall struct {
- ID string `json:"id"`
- Type string `json:"type"`
- Function Function `json:"function"`
- }
- // Function 定义函数的结构体
- type Function struct {
- Name string `json:"name"`
- Arguments json.RawMessage `json:"arguments"`
- }
- type SearchDocsResponse struct {
- PageContent string `json:"page_content"`
- Metadata Metadata `json:"metadata"`
- Type string `json:"type"`
- Id string `json:"id"`
- Score float32 `json:"score"`
- }
- type Metadata struct {
- Source string `json:"source"`
- Id string `json:"id"`
- }
|