ai

package
v0.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateBranchName added in v0.0.4

func GenerateBranchName(prompt string, config Config) (string, error)

GenerateBranchName generates a branch name using the configured AI model

func GenerateCommitMessage

func GenerateCommitMessage(prompt string, config Config) (string, error)

GenerateCommitMessage generates a commit message using the configured AI model

Types

type AnthropicConfig

type AnthropicConfig struct {
	APIKey  string `yaml:"api_key" json:"api_key"`
	Model   string `yaml:"model" json:"model"`
	BaseURL string `yaml:"base_url" json:"base_url"`
}

AnthropicConfig holds Anthropic-specific configuration

type AnthropicRequest

type AnthropicRequest struct {
	Model    string    `json:"model"`
	Messages []Message `json:"messages"`
}

AnthropicRequest represents the request structure for Anthropic API

type AnthropicResponse

type AnthropicResponse struct {
	Content []Message `json:"content"`
}

AnthropicResponse represents the response structure from Anthropic API

type Config

type Config struct {
	Type      ModelType       `yaml:"type" json:"type"`
	OpenAI    OpenAIConfig    `yaml:"openai,omitempty" json:"openai,omitempty"`
	Ollama    OllamaConfig    `yaml:"ollama,omitempty" json:"ollama,omitempty"`
	Anthropic AnthropicConfig `yaml:"anthropic,omitempty" json:"anthropic,omitempty"`
	DeepSeek  DeepSeekConfig  `yaml:"deepseek,omitempty" json:"deepseek,omitempty"`
	Qwen      QwenConfig      `yaml:"qwen,omitempty" json:"qwen,omitempty"`
}

Config holds the configuration for AI models

func LoadConfig

func LoadConfig() (*Config, error)

LoadConfig loads the configuration from the specified file

type DeepSeekConfig added in v0.0.3

type DeepSeekConfig struct {
	APIKey  string `yaml:"api_key" json:"api_key"`
	Model   string `yaml:"model" json:"model"`
	BaseURL string `yaml:"base_url" json:"base_url"`
}

DeepSeekConfig holds DeepSeek-specific configuration

type DeepSeekRequest added in v0.0.3

type DeepSeekRequest struct {
	Model    string    `json:"model"`
	Messages []Message `json:"messages"`
	Stream   bool      `json:"stream"` // Always set to false
}

DeepSeekRequest represents the request structure for DeepSeek API

type DeepSeekResponse added in v0.0.3

type DeepSeekResponse struct {
	Choices []struct {
		Message Message `json:"message"`
	} `json:"choices"`
}

DeepSeekResponse represents the response structure from DeepSeek API

type Message

type Message struct {
	Role    string `json:"role"`
	Content string `json:"content"`
}

Message represents a chat message

type ModelType

type ModelType string

ModelType represents the type of AI model

const (
	ModelOpenAI    ModelType = "openai"
	ModelOllama    ModelType = "ollama"
	ModelAnthropic ModelType = "anthropic"
	ModelDeepSeek  ModelType = "deepseek"
	ModelQwen      ModelType = "qwen"
)

type OllamaConfig

type OllamaConfig struct {
	BaseURL string `yaml:"base_url" json:"base_url"`
	Model   string `yaml:"model" json:"model"`
}

OllamaConfig holds Ollama-specific configuration

type OllamaRequest

type OllamaRequest struct {
	Model    string    `json:"model"`
	Messages []Message `json:"messages"`
	Stream   bool      `json:"stream"` // Always set to false
}

OllamaRequest represents the request structure for Ollama API

type OllamaResponse

type OllamaResponse struct {
	Message Message `json:"message"`
}

OllamaResponse represents the response structure from Ollama API

type OpenAIConfig

type OpenAIConfig struct {
	APIKey  string `yaml:"api_key" json:"api_key"`
	Model   string `yaml:"model" json:"model"`
	BaseURL string `yaml:"base_url" json:"base_url"`
}

OpenAIConfig holds OpenAI-specific configuration

type OpenAIRequest

type OpenAIRequest struct {
	Model    string    `json:"model"`
	Messages []Message `json:"messages"`
	Stream   bool      `json:"stream"` // Always set to false
}

OpenAIRequest represents the request structure for OpenAI API

type OpenAIResponse

type OpenAIResponse struct {
	Choices []struct {
		Message Message `json:"message"`
	} `json:"choices"`
}

OpenAIResponse represents the response structure from OpenAI API

type QwenConfig added in v0.0.3

type QwenConfig struct {
	APIKey  string `yaml:"api_key" json:"api_key"`
	Model   string `yaml:"model" json:"model"`
	BaseURL string `yaml:"base_url" json:"base_url"`
}

QwenConfig holds Qwen-specific configuration

type QwenRequest added in v0.0.3

type QwenRequest struct {
	Model    string    `json:"model"`
	Messages []Message `json:"messages"`
	Stream   bool      `json:"stream"`
}

QwenRequest represents the request structure for Qwen API

type QwenResponse added in v0.0.3

type QwenResponse struct {
	Choices []struct {
		Message Message `json:"message"`
	} `json:"choices"`
}

QwenResponse represents the response structure from Qwen API

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL