gemini

package
v0.0.0-...-473c179 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGemini

func NewGemini(ctx context.Context, modelName string, systemPrompt string) (llms.Model, error)

NewGemini returns a new Gemini client.

Types

type Gemini

type Gemini struct {
	Client *genai.Client
	Model  *genai.GenerativeModel

	SystemPrompt string
	// contains filtered or unexported fields
}

Gemini is a wrapper around the Gemini API.

func (*Gemini) Chat

func (g *Gemini) Chat(ctx context.Context, message string) (string, error)

Chat with the model.

func (*Gemini) CloseBackend

func (g *Gemini) CloseBackend() error

Close the client.

func (*Gemini) ContentToString

func (g *Gemini) ContentToString(content *genai.Content) string

Cotent to string

func (*Gemini) GenerateContent

func (g *Gemini) GenerateContent(ctx context.Context, prompt string) (string, error)

GenerateContent generates content from a prompt.

func (*Gemini) SetSystemPrompt

func (g *Gemini) SetSystemPrompt(ctx context.Context, prompt string) error

Set system prompt

Jump to

Keyboard shortcuts

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