Migrate CLI execution and terminal reports
This commit is contained in:
@@ -6,7 +6,6 @@ import "go.maximumdirect.net/promptkit"
|
||||
type Execution struct {
|
||||
RunID string `json:"run_id,omitempty"`
|
||||
PromptID string `json:"prompt_id,omitempty"`
|
||||
PromptVersion string `json:"prompt_version,omitempty"`
|
||||
ProfileID string `json:"profile_id,omitempty"`
|
||||
BackendID string `json:"backend_id,omitempty"`
|
||||
Model string `json:"model,omitempty"`
|
||||
@@ -53,7 +52,7 @@ func (collector *Collector) Observe(event promptkit.ExecutionEvent) {
|
||||
return TokenCount{Value: value.Value, Known: value.Known, Complete: value.Complete}
|
||||
}
|
||||
collector.report = &Execution{
|
||||
RunID: event.RunID, PromptID: event.PromptID, PromptVersion: event.PromptVersion,
|
||||
RunID: event.RunID, PromptID: event.PromptID,
|
||||
ProfileID: event.ProfileID, BackendID: event.BackendID, Model: event.Model,
|
||||
Outcome: outcome(event.Outcome), Failure: failure(event.Failure),
|
||||
StatusCode: event.StatusCode, RetriesExhausted: event.RetriesExhausted,
|
||||
|
||||
@@ -24,7 +24,7 @@ func TestCollectorProjectsOnlyTerminalAggregates(t *testing.T) {
|
||||
}
|
||||
collector.Observe(promptkit.ExecutionEvent{
|
||||
Kind: promptkit.ExecutionFinished, RunID: "run-1", PromptID: "prompt-1",
|
||||
PromptVersion: "1", ProfileID: "profile-1", BackendID: "backend-1", Model: "model-1",
|
||||
ProfileID: "profile-1", BackendID: "backend-1", Model: "model-1",
|
||||
Outcome: promptkit.ExecutionOutcomeError, Failure: promptkit.ExecutionFailureProviderStatus,
|
||||
StatusCode: 503, RetriesExhausted: true, Attempts: 3, TransientRetries: 2, RepairCalls: 1,
|
||||
Duration: 1500 * time.Millisecond, CapacityWait: 20 * time.Millisecond,
|
||||
@@ -54,7 +54,7 @@ func TestCollectorProjectsOnlyTerminalAggregates(t *testing.T) {
|
||||
if err := json.Unmarshal(encoded, &fields); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, key := range []string{"run_id", "prompt_id", "prompt_version", "profile_id", "backend_id", "model", "outcome", "failure", "status_code", "retries_exhausted", "attempts", "transient_retries", "repair_calls", "duration_ms", "capacity_wait_ms", "generation_duration_ms", "retry_delay_ms", "usage"} {
|
||||
for _, key := range []string{"run_id", "prompt_id", "profile_id", "backend_id", "model", "outcome", "failure", "status_code", "retries_exhausted", "attempts", "transient_retries", "repair_calls", "duration_ms", "capacity_wait_ms", "generation_duration_ms", "retry_delay_ms", "usage"} {
|
||||
if _, ok := fields[key]; !ok {
|
||||
t.Fatalf("report missing %q: %s", key, encoded)
|
||||
}
|
||||
@@ -65,7 +65,7 @@ func TestCollectorProjectsOnlyTerminalAggregates(t *testing.T) {
|
||||
t.Fatalf("incomplete token count %q: %#v", key, item)
|
||||
}
|
||||
}
|
||||
for _, forbidden := range []string{"session_id", "headers", "endpoint", "api_key", "error", "output", "input"} {
|
||||
for _, forbidden := range []string{"prompt_version", "session_id", "headers", "endpoint", "api_key", "error", "output", "input"} {
|
||||
if _, present := fields[forbidden]; present {
|
||||
t.Fatalf("report exposed %q: %s", forbidden, encoded)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user