route

package
v1.13.4 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: MIT Imports: 12 Imported by: 0

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