110 lines
4.2 KiB
Go
110 lines
4.2 KiB
Go
package httpadapter
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
type runRequestDTO struct {
|
|
PromptID string `json:"prompt_id"`
|
|
PromptVersion string `json:"prompt_version,omitempty"`
|
|
ProfileID string `json:"profile_id,omitempty"`
|
|
Inputs map[string]inputRefDTO `json:"inputs"`
|
|
Vars map[string]string `json:"vars,omitempty"`
|
|
Model *modelOverrideRequestDTO `json:"model,omitempty"`
|
|
IncludeRawOutput bool `json:"include_raw_output,omitempty"`
|
|
}
|
|
|
|
type inputRefDTO struct {
|
|
Type string `json:"type"`
|
|
URI string `json:"uri,omitempty"`
|
|
Body string `json:"body,omitempty"`
|
|
}
|
|
|
|
type modelOverrideRequestDTO struct {
|
|
Endpoint string `json:"endpoint,omitempty"`
|
|
Model string `json:"model,omitempty"`
|
|
Temperature float64 `json:"temperature,omitempty"`
|
|
MaxTokens int `json:"max_tokens,omitempty"`
|
|
TopP float64 `json:"top_p,omitempty"`
|
|
TimeoutSeconds int `json:"timeout_seconds,omitempty"`
|
|
ServiceTier string `json:"service_tier,omitempty"`
|
|
ReasoningEffort string `json:"reasoning_effort,omitempty"`
|
|
APIKeyEnv string `json:"api_key_env,omitempty"`
|
|
ExtraParams map[string]string `json:"extra_params,omitempty"`
|
|
}
|
|
|
|
type runResponseDTO struct {
|
|
Artifact artifactDTO `json:"artifact"`
|
|
Validation validationDTO `json:"validation"`
|
|
Metadata metadataDTO `json:"metadata"`
|
|
RawModelOutput *string `json:"raw_model_output,omitempty"`
|
|
}
|
|
|
|
type artifactDTO struct {
|
|
Name string `json:"name"`
|
|
ContentType string `json:"content_type"`
|
|
Body string `json:"body"`
|
|
URI string `json:"uri,omitempty"`
|
|
Size int64 `json:"size"`
|
|
Hash string `json:"hash"`
|
|
}
|
|
|
|
type metadataDTO struct {
|
|
RunID string `json:"run_id"`
|
|
PromptID string `json:"prompt_id"`
|
|
PromptVersion string `json:"prompt_version"`
|
|
PromptHash string `json:"prompt_hash"`
|
|
RenderedPromptHash string `json:"rendered_prompt_hash"`
|
|
SelectedProfileID string `json:"selected_profile_id"`
|
|
ModelName string `json:"model_name"`
|
|
Endpoint string `json:"endpoint"`
|
|
ModelParams modelParamsDTO `json:"model_params"`
|
|
InputHashes map[string]string `json:"input_hashes"`
|
|
Usage tokenUsageDTO `json:"usage"`
|
|
StartTime time.Time `json:"start_time"`
|
|
EndTime time.Time `json:"end_time"`
|
|
DurationMS int64 `json:"duration_ms"`
|
|
ValidationMode string `json:"validation_mode"`
|
|
ValidationStatus string `json:"validation_status"`
|
|
RepairAttemptsUsed int `json:"repair_attempts_used"`
|
|
}
|
|
|
|
type modelParamsDTO struct {
|
|
Endpoint string `json:"endpoint"`
|
|
Model string `json:"model"`
|
|
Temperature float64 `json:"temperature"`
|
|
MaxTokens int `json:"max_tokens"`
|
|
TopP float64 `json:"top_p"`
|
|
TimeoutSeconds int `json:"timeout_seconds"`
|
|
ServiceTier string `json:"service_tier,omitempty"`
|
|
ReasoningEffort string `json:"reasoning_effort,omitempty"`
|
|
APIKeyEnv string `json:"api_key_env,omitempty"`
|
|
ExtraParams map[string]string `json:"extra_params,omitempty"`
|
|
}
|
|
|
|
type tokenUsageDTO struct {
|
|
PromptTokens int `json:"prompt_tokens"`
|
|
CompletionTokens int `json:"completion_tokens"`
|
|
TotalTokens int `json:"total_tokens"`
|
|
CachedTokens int `json:"cached_tokens"`
|
|
CacheWriteTokens int `json:"cache_write_tokens"`
|
|
}
|
|
|
|
type validationDTO struct {
|
|
Status string `json:"status"`
|
|
Mode string `json:"mode"`
|
|
Errors []string `json:"errors,omitempty"`
|
|
SchemaPath string `json:"schema_path,omitempty"`
|
|
RepairAttempts int `json:"repair_attempts"`
|
|
IsValid bool `json:"is_valid"`
|
|
}
|
|
|
|
type errorResponse struct {
|
|
Error errorBody `json:"error"`
|
|
}
|
|
|
|
type errorBody struct {
|
|
Code string `json:"code"`
|
|
Message string `json:"message"`
|
|
}
|