Documentation
¶
Index ¶
- type AIModel
- type AIResponse
- type OpenAIModel
- func (o *OpenAIModel) GetAPIKey() string
- func (o *OpenAIModel) GetAnswer(prompt string) (*AIResponse, error)
- func (o *OpenAIModel) GetChatModel() openai.ChatModel
- func (o *OpenAIModel) GetCommand(prompt string) (*AIResponse, error)
- func (o *OpenAIModel) GetCommandType() string
- func (o *OpenAIModel) GetContext() string
- func (o *OpenAIModel) GetName() string
- func (o *OpenAIModel) SetChatModel(chatModel openai.ChatModel)
- func (o *OpenAIModel) SetCommandType(commandType string)
- func (o *OpenAIModel) SetContext(context string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AIModel ¶
type AIModel interface { // GetName returns the name of the AI model. GetName() string // GetAPIKey returns the API key for the AI model. GetAPIKey() string // GetCommand generates a command based on user input. GetCommand(prompt string) (*AIResponse, error) // SetContext sets the context for the AI model. SetContext(context string) // GetContext returns the context for the AI model. GetContext() string // SetCommandType sets the command type for the AI model. SetCommandType(commandType string) // GetCommandType returns the command type for the AI model. GetCommandType() string }
AIModel defines the interface for different AI providers.
type AIResponse ¶
type AIResponse struct { // Prompt is the user prompt that is sent to the AI. Prompt string // Command is the command that is suggested by the AI. Command string // Answer is the answer that is provided by the AI. Answer string // NextSteps are the suggested next steps that are provided by the AI. NextSteps []string }
AIResponse holds the parsed command and suggested next steps.
type OpenAIModel ¶
type OpenAIModel struct {
// contains filtered or unexported fields
}
OpenAIModel is the OpenAI implementation of the AIModel interface.
func NewOpenAIModel ¶
func NewOpenAIModel(commandType, context string) (*OpenAIModel, error)
func (*OpenAIModel) GetAPIKey ¶
func (o *OpenAIModel) GetAPIKey() string
func (*OpenAIModel) GetAnswer ¶
func (o *OpenAIModel) GetAnswer(prompt string) (*AIResponse, error)
func (*OpenAIModel) GetChatModel ¶
func (o *OpenAIModel) GetChatModel() openai.ChatModel
func (*OpenAIModel) GetCommand ¶
func (o *OpenAIModel) GetCommand(prompt string) (*AIResponse, error)
GetCommand calls the OpenAI API with tool calling (if supported), then falls back to text parsing if no tool call is made.
func (*OpenAIModel) GetCommandType ¶
func (o *OpenAIModel) GetCommandType() string
func (*OpenAIModel) GetContext ¶
func (o *OpenAIModel) GetContext() string
func (*OpenAIModel) GetName ¶
func (o *OpenAIModel) GetName() string
func (*OpenAIModel) SetChatModel ¶
func (o *OpenAIModel) SetChatModel(chatModel openai.ChatModel)
func (*OpenAIModel) SetCommandType ¶
func (o *OpenAIModel) SetCommandType(commandType string)
func (*OpenAIModel) SetContext ¶
func (o *OpenAIModel) SetContext(context string)
Click to show internal directories.
Click to hide internal directories.