genai

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2025 License: MIT Imports: 8 Imported by: 2

Documentation

Index

Constants

View Source
const DefaultModelName = "gemini-1.5-flash"

Variables

View Source
var ErrNoApiKey = errors.New("no generative ai api key provided")

Functions

This section is empty.

Types

type AIGenerationError

type AIGenerationError struct {
	Reason genai.FinishReason
}

func (*AIGenerationError) Error

func (e *AIGenerationError) Error() string

type ClientOption

type ClientOption func(*ClientOptions)

func WithApiKey

func WithApiKey(key string) ClientOption

func WithModelName

func WithModelName(name string) ClientOption

type ClientOptions

type ClientOptions struct {
	ApiKey    string
	ModelName string
}

type GenAiClient

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

func NewGenAiClient

func NewGenAiClient(ctx context.Context, options ...ClientOption) (*GenAiClient, error)

func (*GenAiClient) Send

func (c *GenAiClient) Send(
	ctx context.Context,
	prompt string,
	mod *nexus.SchemaMod,
	hook markxus.LlmStreamConsumeHook,
) (string, error)

Jump to

Keyboard shortcuts

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