-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathresponse.go
More file actions
29 lines (24 loc) · 930 Bytes
/
response.go
File metadata and controls
29 lines (24 loc) · 930 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package llm
// TokenUsage holds token consumption metrics for a Prompt or PromptSingle call.
type TokenUsage struct {
InputTokens int
OutputTokens int
CachedInputTokens int
}
// Response is the return type for Prompt and PromptSingle calls.
type Response struct {
// Value is the final text content returned by the model.
Value string
// Conversation contains all messages up to and including the final
// assistant response. When tool calls are involved this includes the
// intermediate assistant tool-call messages and tool response messages.
Conversation []Message
// Usage holds the accumulated token usage across all API round-trips
// that occurred during this call (including tool-call loops).
Usage TokenUsage
}
// String returns the Value field, making it easy to migrate from the old
// (string, error) return type to (Response, error).
func (r Response) String() string {
return r.Value
}