Architectural improvements in the http adapter
This commit is contained in:
@@ -2,8 +2,6 @@ package httpadapter
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gitea.maximumdirect.net/eric/scriptorium/internal/domain"
|
||||
)
|
||||
|
||||
type runRequestDTO struct {
|
||||
@@ -30,10 +28,10 @@ type modelOverrideRequestDTO struct {
|
||||
}
|
||||
|
||||
type runResponseDTO struct {
|
||||
Artifact artifactDTO `json:"artifact"`
|
||||
Validation domain.ValidationResult `json:"validation"`
|
||||
Metadata metadataDTO `json:"metadata"`
|
||||
RawModelOutput string `json:"raw_model_output"`
|
||||
Artifact artifactDTO `json:"artifact"`
|
||||
Validation validationDTO `json:"validation"`
|
||||
Metadata metadataDTO `json:"metadata"`
|
||||
RawModelOutput string `json:"raw_model_output"`
|
||||
}
|
||||
|
||||
type artifactDTO struct {
|
||||
@@ -52,11 +50,26 @@ type metadataDTO struct {
|
||||
Endpoint string `json:"endpoint"`
|
||||
InputHashes map[string]string `json:"input_hashes"`
|
||||
PromptHash string `json:"prompt_hash"`
|
||||
Usage domain.TokenUsage `json:"usage"`
|
||||
Usage tokenUsageDTO `json:"usage"`
|
||||
StartTime time.Time `json:"start_time"`
|
||||
EndTime time.Time `json:"end_time"`
|
||||
}
|
||||
|
||||
type tokenUsageDTO struct {
|
||||
PromptTokens int `json:"prompt_tokens"`
|
||||
CompletionTokens int `json:"completion_tokens"`
|
||||
TotalTokens int `json:"total_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"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user