inou/api/llm_types.go

67 lines
2.3 KiB
Go

package main
// --- LLM and Prompt Generation Structs ---
// TriageResponse is the structure for the first-pass classification of user input.
type TriageResponse struct {
Category string `json:"category"`
Language string `json:"language"`
HasData bool `json:"has_data"`
Error string `json:"error,omitempty"`
}
// ExtractionResult is the detailed structure extracted from user input.
type ExtractionResult struct {
Question string `json:"question"`
Category string `json:"category"`
Type string `json:"type"`
InputType string `json:"input_type"`
InputConfig InputConfig `json:"input_config"`
Schedule []ScheduleSlot `json:"schedule"`
Entries []*EntryData `json:"entries,omitempty"`
Error string `json:"error,omitempty"`
}
// InputConfig defines the structure of a form. It can contain either
// a simple list of fields or a list of groups with fields.
type InputConfig struct {
Fields []FormField `json:"fields,omitempty"`
Groups []FormGroup `json:"groups,omitempty"`
}
// FormGroup represents a group of fields in a form.
type FormGroup struct {
Title string `json:"title"`
Fields []FormField `json:"fields"`
}
// FormField represents a single field in a form.
type FormField struct {
Key string `json:"key"`
Type string `json:"type"`
Label string `json:"label"`
Unit string `json:"unit,omitempty"`
Options []string `json:"options,omitempty"`
}
// ScheduleSlot defines a time for a prompt to be shown.
type ScheduleSlot struct {
Days []string `json:"days"`
Time string `json:"time"`
}
// EntryData represents a single piece of data extracted from user input.
type EntryData struct {
Value string `json:"value"`
Data interface{} `json:"data"`
}
// ValidCategories is the list of recognized categories.
var ValidCategories = map[string]bool{
"vital": true, "exercise": true, "medication": true, "supplement": true,
"symptom": true, "note": true, "surgery": true, "hospitalization": true,
"consultation": true, "diagnosis": true, "device": true, "therapy": true,
"assessment": true, "birth": true, "imaging_finding": true, "eeg_finding": true,
"provider": true, "question": true, "history": true, "family_history": true,
"nutrition": true, "fertility": true, "out_of_domain": true,
}