Carry evidence through built-in generation retries
This commit is contained in:
38
internal/generation/evidence.go
Normal file
38
internal/generation/evidence.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package generation
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gitea.maximumdirect.net/eric/promptkit/internal/domain"
|
||||
"gitea.maximumdirect.net/eric/promptkit/internal/llm"
|
||||
)
|
||||
|
||||
// GenerationEvidence contains invocation-local request evidence without raw
|
||||
// provider bodies, headers, credentials, or generated content.
|
||||
type GenerationEvidence struct {
|
||||
Attempts []AttemptEvidence
|
||||
RetryDelays []time.Duration
|
||||
Usage domain.ObservedTokenUsage
|
||||
}
|
||||
|
||||
// AttemptEvidence describes one capacity acquisition and any dispatch it
|
||||
// reached. Generated content remains on the separate response return value.
|
||||
type AttemptEvidence struct {
|
||||
Dispatched bool
|
||||
HTTP llm.HTTPExecutionEvidence
|
||||
CapacityWait time.Duration
|
||||
RequestDuration time.Duration
|
||||
Failure domain.ExecutionFailureKind
|
||||
Usage domain.ObservedTokenUsage
|
||||
ResponseDecoded bool
|
||||
GenerationCompleted bool
|
||||
StructuredOutputRequested *bool
|
||||
}
|
||||
|
||||
func cloneHTTPEvidence(evidence llm.HTTPExecutionEvidence) llm.HTTPExecutionEvidence {
|
||||
if evidence.HTTPStatus != nil {
|
||||
status := *evidence.HTTPStatus
|
||||
evidence.HTTPStatus = &status
|
||||
}
|
||||
return evidence
|
||||
}
|
||||
Reference in New Issue
Block a user