Files
crawlab/core/entity/llm.go
Marvin Zhang 8273507d20 refactor: update LLMResponseUsage struct and ChatMessage model for BSON compatibility
- Added BSON tags to fields in LLMResponseUsage struct to ensure proper serialization with MongoDB.
- Updated the Usage field in ChatMessage model to exclude it from JSON serialization while retaining BSON compatibility.
- Introduced GetUsage method in ChatMessage to aggregate token usage from contents, enhancing usage tracking capabilities.
2025-04-12 21:25:57 +08:00

8 lines
231 B
Go

package entity
type LLMResponseUsage struct {
InputTokens int `json:"input_tokens" bson:"input_tokens"`
OutputTokens int `json:"output_tokens" bson:"output_tokens"`
TotalTokens int `json:"total_tokens" bson:"total_tokens"`
}