Documentation
¶
Index ¶
- Variables
- func AttributeNames() []string
- func EnhanceLiteraryContent(basePrompt, authorContext string) (string, error)
- func EnhancePrompt(prompt, authorType string) (string, error)
- func IsOpenAIRetryableError(err error, statusCode int) bool
- func IsRetryableHTTPStatus(statusCode int) bool
- type AiConfiguration
- type Attribute
- type DalleResponse1
- type Message
- type OpenAIAPIError
- type Request
Constants ¶
This section is empty.
Variables ¶
var ( PromptTemplate = template.Must(template.New("prompt").Parse(promptTemplateStr)) DataTemplate = template.Must(template.New("data").Parse(dataTemplateStr)) TerseTemplate = template.Must(template.New("terse").Parse(terseTemplateStr)) TitleTemplate = template.Must(template.New("title").Parse(titleTemplateStr)) AuthorTemplate = template.Must(template.New("author").Parse(authorTemplateStr)) TechnicalTemplate = template.Must(template.New("technical").Parse(technicalTemplateStr)) )
var DatabaseNames = []string{
"adverbs",
"adjectives",
"nouns",
"emotions",
"occupations",
"actions",
"artstyles",
"artstyles",
"litstyles",
"colors",
"colors",
"colors",
"viewpoints",
"gazes",
"backstyles",
"compositions",
}
DatabaseNames lists the databases used to derive attributes from a seed.
Functions ¶
func AttributeNames ¶
func AttributeNames() []string
AttributeNames returns the list of attribute names (for test and compatibility).
func EnhanceLiteraryContent ¶
EnhanceLiteraryContent performs Stage 1 enhancement focused on literary and creative content
func EnhancePrompt ¶
EnhancePrompt calls the OpenAI API to enhance a prompt using the given author type.
func IsOpenAIRetryableError ¶
IsOpenAIRetryableError determines if an error from OpenAI should be retried
func IsRetryableHTTPStatus ¶
IsRetryableHTTPStatus checks if an HTTP status code indicates a retryable error
Types ¶
type AiConfiguration ¶
type AiConfiguration struct {
// Prompt Enhancement Configuration
EnhancementModel string `json:"enhancement_model"`
EnhancementSeed int `json:"enhancement_seed"`
EnhancementTemperature float64 `json:"enhancement_temperature"`
EnhancementURL string `json:"enhancement_url"`
EnhancementTimeout time.Duration `json:"enhancement_timeout"`
// Image Generation Configuration
ImageModel string `json:"image_model"`
ImageQuality string `json:"image_quality"`
ImageStyle string `json:"image_style"`
ImageURL string `json:"image_url"`
ImageTimeout time.Duration `json:"image_timeout"`
}
AiConfiguration holds configuration for both prompt enhancement and image generation
func DefaultAiConfiguration ¶
func DefaultAiConfiguration() AiConfiguration
DefaultAiConfiguration returns the default AI configuration
type Attribute ¶
type Attribute struct {
Database string `json:"database"`
Name string `json:"name"`
Bytes string `json:"bytes"`
Number uint64 `json:"number"`
Factor float64 `json:"factor"`
Count uint64 `json:"count"`
Selector uint64 `json:"selector"`
Value string `json:"value"`
}
Attribute represents a data attribute with metadata used for prompt generation.
type DalleResponse1 ¶
type DalleResponse1 struct {
Data []struct {
Url string `json:"url"`
B64Data string `json:"b64_json"`
} `json:"data"`
}
DalleResponse1 represents the JSON structure returned by OpenAI image generation endpoints that contain either direct URLs or base64-encoded image data. This was previously defined privately in the root package as dalleResponse1 and has been moved here for reuse.
type OpenAIAPIError ¶
OpenAIAPIError represents an error from the OpenAI API
func (*OpenAIAPIError) Error ¶
func (e *OpenAIAPIError) Error() string
func (*OpenAIAPIError) IsRetryable ¶
func (e *OpenAIAPIError) IsRetryable() bool
IsRetryable determines if this error should be retried
type Request ¶
type Request struct {
Input string `json:"input,omitempty"`
Prompt string `json:"prompt,omitempty"`
N int `json:"n,omitempty"`
Quality string `json:"quality,omitempty"`
Model string `json:"model,omitempty"`
Style string `json:"style,omitempty"`
Size string `json:"size,omitempty"`
Seed int `json:"seed,omitempty"`
Temperature float64 `json:"temperature,omitempty"`
Messages []Message `json:"messages,omitempty"`
}
Request represents a request payload for the OpenAI API.