gemini

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoAPIKey      = errors.New("gemini: API key is required")
	ErrInvalidModel  = errors.New("gemini: invalid model specified")
	ErrNoContent     = errors.New("gemini: no content generated")
	ErrSystemMessage = errors.New("gemini: does not support system messages in the middle of a conversation. Use SystemInstruction option")
)

Functions

This section is empty.

Types

type LLM

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

func New

func New(ctx context.Context, opts ...Option) (*LLM, error)

func (*LLM) Call

func (g *LLM) Call(ctx context.Context, prompt string, options ...llms.CallOption) (string, error)

func (*LLM) GenerateContent

func (g *LLM) GenerateContent(
	ctx context.Context,
	messages []schema.MessageContent,
	options ...llms.CallOption,
) (*schema.ContentResponse, error)

type Option

type Option func(*options)

Option is a function type for configuring the client.

func WithAPIKey

func WithAPIKey(apiKey string) Option

WithAPIKey sets the Gemini API key.

func WithLogger

func WithLogger(logger *slog.Logger) Option

func WithModel

func WithModel(model string) Option

WithModel sets the model name.

Jump to

Keyboard shortcuts

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