route

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: MIT Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeCacheKeyForChatCompletionRequest added in v1.7.1

func ComputeCacheKeyForChatCompletionRequest(path string, req *goopenai.ChatCompletionRequest) string

func ComputeCacheKeyForEmbeddingsRequest added in v1.7.1

func ComputeCacheKeyForEmbeddingsRequest(path string, req *goopenai.EmbeddingRequest) string

Types

type CacheConfig

type CacheConfig struct {
	Enabled bool   `json:"enabled"`
	Ttl     string `json:"ttl"`
}

type Request

type Request struct {
	Settings  map[string]*provider.Setting
	Key       *key.ResponseKey
	Client    http.Client
	Forwarded *http.Request
}

func (*Request) GetSettingValue

func (r *Request) GetSettingValue(provider string, param string) (string, error)

type Response

type Response struct {
	Provider string
	Model    string
	Cancel   context.CancelFunc
	Response *http.Response
}

type Route

type Route struct {
	Id          string       `json:"id"`
	CreatedAt   int64        `json:"createdAt"`
	UpdatedAt   int64        `json:"updatedAt"`
	Name        string       `json:"name"`
	Path        string       `json:"path"`
	KeyIds      []string     `json:"keyIds"`
	Steps       []*Step      `json:"steps"`
	CacheConfig *CacheConfig `json:"cacheConfig"`
}

func (*Route) RunSteps

func (r *Route) RunSteps(req *Request) (*Response, error)

func (*Route) ShouldRunEmbeddings

func (r *Route) ShouldRunEmbeddings() bool

func (*Route) ValidateSettings

func (r *Route) ValidateSettings(settings []*provider.Setting) bool

type Step

type Step struct {
	Retries  int               `json:"retries"`
	Provider string            `json:"provider"`
	Params   map[string]string `json:"params"`
	Model    string            `json:"model"`
	Timeout  string            `json:"timeout"`
}

Jump to

Keyboard shortcuts

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