Use PromptKit prepared execution for structured model calls
This commit is contained in:
@@ -3,6 +3,7 @@ package structuredoutput
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"time"
|
||||
|
||||
"gitea.maximumdirect.net/eric/audita/internal/framework/responseschema"
|
||||
)
|
||||
@@ -39,13 +40,38 @@ type PromptMetadata struct {
|
||||
}
|
||||
|
||||
type Response struct {
|
||||
Content json.RawMessage `json:"content,omitempty"`
|
||||
Provider string `json:"provider,omitempty"`
|
||||
Model string `json:"model,omitempty"`
|
||||
PromptTokens int `json:"prompt_tokens,omitempty"`
|
||||
CompletionTokens int `json:"completion_tokens,omitempty"`
|
||||
TotalTokens int `json:"total_tokens,omitempty"`
|
||||
Prompt PromptMetadata `json:"prompt"`
|
||||
Content json.RawMessage `json:"content,omitempty"`
|
||||
Provider string `json:"provider,omitempty"`
|
||||
Model string `json:"model,omitempty"`
|
||||
PromptTokens int `json:"prompt_tokens,omitempty"`
|
||||
CompletionTokens int `json:"completion_tokens,omitempty"`
|
||||
TotalTokens int `json:"total_tokens,omitempty"`
|
||||
Prompt PromptMetadata `json:"prompt"`
|
||||
Prepared *PreparedSnapshot `json:"prepared,omitempty"`
|
||||
FinalContent string `json:"final_content,omitempty"`
|
||||
}
|
||||
|
||||
// PreparedSnapshot is the exact rendered request snapshot. Its messages may
|
||||
// contain transcript and glossary content and belong only in protected diagnostics.
|
||||
type PreparedSnapshot struct {
|
||||
Messages []Message `json:"messages"`
|
||||
Prompt PromptMetadata `json:"prompt"`
|
||||
}
|
||||
|
||||
type Message struct {
|
||||
Role string `json:"role"`
|
||||
Content string `json:"content"`
|
||||
}
|
||||
|
||||
// CallRecord brackets one logical operation, including preparation. Content
|
||||
// is present only when a model returned it; consumers must protect it.
|
||||
type CallRecord struct {
|
||||
Context DiagnosticContext `json:"context"`
|
||||
Started time.Time `json:"started"`
|
||||
Finished time.Time `json:"finished,omitempty"`
|
||||
Prepared *PreparedSnapshot `json:"prepared,omitempty"`
|
||||
FinalContent string `json:"final_content,omitempty"`
|
||||
Failure FailureKind `json:"failure,omitempty"`
|
||||
}
|
||||
|
||||
type Client interface {
|
||||
|
||||
Reference in New Issue
Block a user