Report actual inference smoke test destinations
This commit is contained in:
@@ -38,6 +38,10 @@ func TestEngineSmokeTestUsesInjectedGenerationWithoutHTTPSupport(t *testing.T) {
|
||||
report.Facts.EndpointReachable != nil || report.Target.BackendID != "rakestrawhome" {
|
||||
t.Fatalf("injected smoke report calls=%d: %+v", calls, report)
|
||||
}
|
||||
if report.Target.Endpoint != "" || report.Target.EffectiveSettings.Endpoint == "" || len(report.Attempts) != 1 ||
|
||||
report.Attempts[0].InitialEndpoint != "" || report.Attempts[0].Endpoint != "" {
|
||||
t.Fatalf("injected report claimed HTTP destinations: %+v", report)
|
||||
}
|
||||
|
||||
authentication, err := assembled.SmokeTest(context.Background(), domain.SmokeTestRequest{
|
||||
Kind: domain.SmokeTestAuthentication, BackendID: "rakestrawhome",
|
||||
|
||||
@@ -99,6 +99,9 @@ func (c *Coordinator) generate(
|
||||
}
|
||||
|
||||
evidence := GenerationEvidence{}
|
||||
if captureEvidence {
|
||||
evidence.InitialEndpoint = prepared.InitialEndpoint()
|
||||
}
|
||||
var usage observation.UsageAccumulator
|
||||
finish := func(response *domain.GenerateResponse, err error) (*domain.GenerateResponse, error, GenerationEvidence) {
|
||||
if captureEvidence {
|
||||
|
||||
@@ -10,9 +10,12 @@ import (
|
||||
// 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
|
||||
// InitialEndpoint is the frozen built-in request URL, if prepared.
|
||||
// Injected generation leaves it unknown.
|
||||
InitialEndpoint string
|
||||
Attempts []AttemptEvidence
|
||||
RetryDelays []time.Duration
|
||||
Usage domain.ObservedTokenUsage
|
||||
}
|
||||
|
||||
// AttemptEvidence describes one capacity acquisition and any dispatch it
|
||||
|
||||
@@ -193,6 +193,9 @@ func resolveAPIKey(target domain.ExecutionTarget) string {
|
||||
return apiKey
|
||||
}
|
||||
|
||||
// InitialEndpoint returns the frozen request URL before redirects.
|
||||
func (p *PreparedGeneration) InitialEndpoint() string { return p.endpoint }
|
||||
|
||||
// Execute dispatches one attempt. The returned response is non-nil only when
|
||||
// the successful envelope contains a usable first choice.
|
||||
func (p *PreparedGeneration) Execute(ctx context.Context) AttemptOutcome {
|
||||
|
||||
@@ -73,6 +73,9 @@ func (t *SmokeTester) Run(ctx context.Context, request domain.SmokeTestRequest)
|
||||
return nil, err
|
||||
}
|
||||
if isInferenceSmokeTest(request.Kind) {
|
||||
// The configured base is not evidence of an HTTP request destination.
|
||||
// Built-in generation supplies its composed URL after preparation.
|
||||
report.Target.Endpoint = ""
|
||||
report.Supported = true
|
||||
report.Applicable = boolPointer(true)
|
||||
} else if err := t.setSupport(report, selection); err != nil {
|
||||
@@ -238,13 +241,14 @@ func (t *SmokeTester) runInference(
|
||||
}
|
||||
|
||||
func (t *SmokeTester) recordGenerationEvidence(report *domain.SmokeTestReport, evidence generation.GenerationEvidence) {
|
||||
report.Target.Endpoint = evidence.InitialEndpoint
|
||||
report.Usage = evidence.Usage
|
||||
var capacityWait, requestDuration time.Duration
|
||||
for _, attemptEvidence := range evidence.Attempts {
|
||||
capacityWait += attemptEvidence.CapacityWait
|
||||
attempt := domain.SmokeTestAttempt{
|
||||
Dispatched: attemptEvidence.Dispatched,
|
||||
InitialEndpoint: report.Target.Endpoint,
|
||||
InitialEndpoint: evidence.InitialEndpoint,
|
||||
Endpoint: attemptEvidence.HTTP.Endpoint,
|
||||
Facts: generationAttemptFacts(attemptEvidence),
|
||||
Usage: attemptEvidence.Usage,
|
||||
|
||||
Reference in New Issue
Block a user