generic

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GenericProvider

type GenericProvider struct {
	// contains filtered or unexported fields
}

GenericProvider implements the AIProvider interface for OpenAI-compatible APIs

func NewGenericProvider

func NewGenericProvider(apiKey, proxy, url, provider string) (*GenericProvider, error)

NewGenericProvider creates a new provider for OpenAI-compatible APIs

func (*GenericProvider) GenerateCommitMessage

func (p *GenericProvider) GenerateCommitMessage(ctx context.Context, diff string, opts ai.MessageOptions) (string, error)

GenerateCommitMessage generates a commit message using the API

type Message

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

type Request

type Request struct {
	Model       string    `json:"model"`
	Messages    []Message `json:"messages"`
	MaxTokens   int       `json:"max_tokens,omitempty"`
	Temperature float32   `json:"temperature,omitempty"`
}

type Response

type Response struct {
	Choices []struct {
		Message Message `json:"message"`
	} `json:"choices"`
	Error struct {
		Message string `json:"message"`
	} `json:"error,omitempty"`
}

Jump to

Keyboard shortcuts

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