config

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2023 License: MIT Imports: 8 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

This section is empty.

Types

type ApiLoggerConfig

type ApiLoggerConfig struct {
	HideIp      bool `yaml:"hide_ip"`
	HideHeaders bool `yaml:"hide_headers"`
}

func (*ApiLoggerConfig) GetHideHeaders

func (alc *ApiLoggerConfig) GetHideHeaders() bool

func (*ApiLoggerConfig) GetHideIp

func (alc *ApiLoggerConfig) GetHideIp() bool

type Config

type Config struct {
	LoggerConfig *LoggerConfig  `yaml:"logger"`
	Routes       []*RouteConfig `yaml:"routes"`
	Server       *ServerConfig  `yaml:"server"`
	OpenAiConfig *OpenAiConfig  `yaml:"openai"`
}

func NewConfig

func NewConfig(filePath string) (*Config, error)

type CorsConfig

type CorsConfig struct {
	AllowedOrgins      []string `yaml:"allowed_origins"`
	AllowedCredentials bool     `yaml:"allowed_credentials"`
}

func (*CorsConfig) Enabled

func (cc *CorsConfig) Enabled() bool

func (*CorsConfig) GetAllowedCredentials

func (cc *CorsConfig) GetAllowedCredentials() bool

func (*CorsConfig) GetAllowedOrigins

func (cc *CorsConfig) GetAllowedOrigins() []string

type DataType

type DataType string
const (
	StringDataType  DataType = "string"
	NumberDataType  DataType = "number"
	ArrayDataType   DataType = "array"
	ObjectDataType  DataType = "object"
	BooleanDataType DataType = "boolean"
)

func (DataType) Valid

func (d DataType) Valid() bool

type InputValue

type InputValue struct {
	DataType   DataType               `yaml:"type"`
	Properties map[string]interface{} `yaml:"properties"`
	Items      interface{}            `yaml:"items"`
}

type KeyAuthConfig

type KeyAuthConfig struct {
	Key string `yaml:"key"`
}

func (*KeyAuthConfig) Enabled

func (kac *KeyAuthConfig) Enabled() bool

func (*KeyAuthConfig) GetKey

func (kac *KeyAuthConfig) GetKey() string

type LlmLoggerConfig

type LlmLoggerConfig struct {
	HideHeaders         bool `yaml:"hide_headers"`
	HideResponseContent bool `yaml:"hide_response_content"`
	HidePromptContent   bool `yaml:"hide_prompt_content"`
}

func (*LlmLoggerConfig) GetHideHeaders

func (llc *LlmLoggerConfig) GetHideHeaders() bool

func (*LlmLoggerConfig) GetHidePromptContent

func (llc *LlmLoggerConfig) GetHidePromptContent() bool

func (*LlmLoggerConfig) GetHideResponseContent

func (llc *LlmLoggerConfig) GetHideResponseContent() bool

type LoggerConfig

type LoggerConfig struct {
	Api *ApiLoggerConfig `yaml:"api"`
	Llm *LlmLoggerConfig `yaml:"llm"`
}

type OpenAiConfig

type OpenAiConfig struct {
	ApiCredential string `yaml:"api_credential"`
}

type OpenAiMessageRole

type OpenAiMessageRole string
const (
	SystemMessageRole   OpenAiMessageRole = "system"
	UserMessageRole     OpenAiMessageRole = "user"
	AssitantMessageRole OpenAiMessageRole = "assistant"
	FunctionMessageRole OpenAiMessageRole = "function"
)

func (OpenAiMessageRole) Valid

func (r OpenAiMessageRole) Valid() bool

type OpenAiModel

type OpenAiModel string
const (
	Gpt35Turbo        OpenAiModel = "gpt-3.5-turbo"
	Gpt35Turbo16k     OpenAiModel = "gpt-3.5-turbo-16k"
	Gpt35Turbo0613    OpenAiModel = "gpt-3.5-turbo-0613"
	Gpt35Turbo16k0613 OpenAiModel = "gpt-3.5-turbo-16k-0613"
	Gpt4              OpenAiModel = "gpt-4"
	Gpt40613          OpenAiModel = "gpt-4-0613"
	Gpt432k           OpenAiModel = "gpt-4-32k"
	Gpt432k0613       OpenAiModel = "gpt-4-32k-0613"
)

func (OpenAiModel) Valid

func (m OpenAiModel) Valid() bool

type OpenAiPrompt

type OpenAiPrompt struct {
	Role    OpenAiMessageRole `yaml:"role"`
	Content string            `yaml:"content"`
}

type OpenAiRouteConfig

type OpenAiRouteConfig struct {
	ApiCredential string          `yaml:"api_credential"`
	Model         OpenAiModel     `yaml:"model"`
	Prompts       []*OpenAiPrompt `yaml:"prompts"`
}

type Protocol

type Protocol string
const (
	Http  Protocol = "http"
	Https Protocol = "https"
)

func (Protocol) Valid

func (p Protocol) Valid() bool

type Provider

type Provider string
const (
	OpenaiProvider Provider = "openai"
)

func (Provider) Valid

func (p Provider) Valid() bool

type RateLimitConfig

type RateLimitConfig struct {
	Count    string `yaml:"count"`
	Interval string `yaml:"interval"`
}

type RouteConfig

type RouteConfig struct {
	Path                string                `yaml:"path"`
	CorsConfig          *CorsConfig           `yaml:"cors"`
	Input               map[string]InputValue `yaml:"input"`
	Provider            Provider              `yaml:"provider"`
	OpenAiConfig        *OpenAiRouteConfig    `yaml:"openai_config"`
	Description         string                `yaml:"description"`
	Protocol            Protocol              `yaml:"protocol"`
	CertFile            string                `yaml:"cert_file"`
	KeyFile             string                `yaml:"key_file"`
	KeyAuthConfig       *KeyAuthConfig        `yaml:"key_auth"`
	UpstreamSendTimeout time.Duration         `yaml:"upstream_send_time"`
}

type ServerConfig

type ServerConfig struct {
	Port int `yaml:"port"`
}

Jump to

Keyboard shortcuts

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