Documentation
¶
Index ¶
- type APIError
- type Choice
- type Message
- type ModelInfo
- type ModelListResponse
- type OllamaGenerateRequest
- type OllamaGenerateResponse
- type OllamaModel
- type OllamaTagsResponse
- type OpenAIClient
- func (c *OpenAIClient) AnalyzeLog(logMessage, severity, timestamp string, attributes map[string]string) (string, error)
- func (c *OpenAIClient) AnalyzeLogWithContext(logMessage, severity, timestamp string, attributes map[string]string, ...) (string, error)
- func (c *OpenAIClient) GetAvailableModels() ([]string, error)
- func (c *OpenAIClient) GetValidationStatus() (bool, string, string, string)
- func (c *OpenAIClient) ValidateConfiguration()
- type OpenAIRequest
- type OpenAIResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIError ¶
type APIError struct {
Message string `json:"message"`
Type string `json:"type"`
Code string `json:"code"`
}
APIError represents an API error
type Choice ¶
type Choice struct {
Message Message `json:"message"`
}
Choice represents a response choice
type ModelListResponse ¶
type ModelListResponse struct {
Data []ModelInfo `json:"data"`
}
ModelListResponse represents the /v1/models endpoint response
type OllamaGenerateRequest ¶
type OllamaGenerateRequest struct {
Model string `json:"model"`
Prompt string `json:"prompt"`
Stream bool `json:"stream"`
}
OllamaGenerateRequest represents Ollama's /api/generate request
type OllamaGenerateResponse ¶
OllamaGenerateResponse represents Ollama's /api/generate response
type OllamaModel ¶
OllamaModel represents a model in Ollama's response
type OllamaTagsResponse ¶
type OllamaTagsResponse struct {
Models []OllamaModel `json:"models"`
}
OllamaTagsResponse represents Ollama's /api/tags response
type OpenAIClient ¶
type OpenAIClient struct {
APIKey string
BaseURL string
Model string
HTTPClient *http.Client
Validated bool
ValidationErr string
ServiceName string
AvailableModels []string
AutoSelectModel bool // True if no model was specified, should auto-select
}
OpenAIClient handles OpenAI API compatible requests
func NewOpenAIClient ¶
func NewOpenAIClient(model string) *OpenAIClient
NewOpenAIClient creates a new OpenAI client with environment variable detection
func (*OpenAIClient) AnalyzeLog ¶
func (c *OpenAIClient) AnalyzeLog(logMessage, severity, timestamp string, attributes map[string]string) (string, error)
AnalyzeLog sends a log message to the AI for analysis
func (*OpenAIClient) AnalyzeLogWithContext ¶
func (c *OpenAIClient) AnalyzeLogWithContext(logMessage, severity, timestamp string, attributes map[string]string, previousAnalysis string, question string) (string, error)
AnalyzeLogWithContext sends a log message to the AI with chat context
func (*OpenAIClient) GetAvailableModels ¶
func (c *OpenAIClient) GetAvailableModels() ([]string, error)
GetAvailableModels fetches the list of available models from the API
func (*OpenAIClient) GetValidationStatus ¶
func (c *OpenAIClient) GetValidationStatus() (bool, string, string, string)
GetValidationStatus returns the validation status and any error message
func (*OpenAIClient) ValidateConfiguration ¶
func (c *OpenAIClient) ValidateConfiguration()
ValidateConfiguration checks if the AI client is properly configured
type OpenAIRequest ¶
OpenAIRequest represents the request structure
type OpenAIResponse ¶
type OpenAIResponse struct {
Choices []Choice `json:"choices"`
Error any `json:"error,omitempty"` // Can be string or object
}
OpenAIResponse represents the API response with flexible error handling