Documentation ¶
Index ¶
- Variables
- type LLM
- func (o *LLM) Call(ctx context.Context, prompt string, options ...llms.CallOption) (string, error)
- func (o *LLM) CreateEmbedding(ctx context.Context, inputTexts []string) ([][]float32, error)
- func (o *LLM) GenerateContent(ctx context.Context, messages []llms.MessageContent, ...) (*llms.ContentResponse, error)
- type Option
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrEmptyResponse = errors.New("no response") ErrIncompleteEmbedding = errors.New("not all input got embedded") )
Functions ¶
This section is empty.
Types ¶
type LLM ¶
LLM is a cloudflare LLM implementation.
func (*LLM) CreateEmbedding ¶
CreateEmbedding creates embeddings for the given input texts.
func (*LLM) GenerateContent ¶
func (o *LLM) GenerateContent(ctx context.Context, messages []llms.MessageContent, options ...llms.CallOption) (*llms.ContentResponse, error)
GenerateContent implements the Model interface.
type Option ¶
type Option func(*options)
func WithAccountID ¶
WithAccountID Set the Account Id of the cloudflare account to use.
func WithEmbeddingModel ¶
func WithHTTPClient ¶
WithHTTPClient Set custom http client.
func WithServerURL ¶
WithServerURL Set the URL of the cloudflare Workers AI service.
func WithSystemPrompt ¶
WithSystemPrompt Set the system prompt. This is only valid if WithCustomTemplate is not set and the cloudflare model use .System in its model template OR if WithCustomTemplate is set using {{.System}}.
Click to show internal directories.
Click to hide internal directories.