llm

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateMessageContent

func CreateMessageContent(r *http.Request, cfg *config.Config, provider string) ([]llms.MessageContent, error)

CreateMessageContent creates the message content to be processed by the LLM.

func GenerateLLMResponse

func GenerateLLMResponse(ctx context.Context, model llms.Model, temperature float64, messages []llms.MessageContent) (string, error)

GenerateLLMResponse generates a response from the LLM using the input message.

func New

func New(ctx context.Context, config Config) (llms.Model, error)

New initializes the LLM client based on the provided configuration.

func ValidateJSON

func ValidateJSON(jsonStr string) error

ValidateJSON validates the JSON structure of the input.

Types

type Config

type Config struct {
	APIKey        string
	CloudLocation string
	CloudProject  string
	Model         string
	Provider      string
	ServerURL     string
	Temperature   float64
}

Config holds configuration settings for the LLM.

type JSONResponse

type JSONResponse struct {
	Headers map[string]string `json:"headers" validate:"required"`
	Body    string            `json:"body" validate:"required"`
}

JSONResponse defines the expected JSON response from the LLM.

Jump to

Keyboard shortcuts

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