Documentation ¶
Index ¶
- Constants
- func Init() error
- func InitFromConfigFile() error
- func InitFromEnvironmentVariables(apiVersion, endpoint, openaiModelMapper string)
- func ModelProxy(c *gin.Context)
- func Proxy(c *gin.Context, requestConverter RequestConverter)
- func ProxyWithConverter(requestConverter RequestConverter) gin.HandlerFunc
- type Config
- type DeploymentConfig
- type DeploymentInfo
- type RequestConverter
- type StripPrefixConverter
- type TemplateConverter
Constants ¶
View Source
const (
AuthHeaderKey = "api-key"
)
Variables ¶
This section is empty.
Functions ¶
func InitFromConfigFile ¶ added in v1.3.5
func InitFromConfigFile() error
func InitFromEnvironmentVariables ¶ added in v1.3.5
func InitFromEnvironmentVariables(apiVersion, endpoint, openaiModelMapper string)
func ModelProxy ¶ added in v1.3.8
func ProxyWithConverter ¶ added in v1.3.5
func ProxyWithConverter(requestConverter RequestConverter) gin.HandlerFunc
Types ¶
type Config ¶ added in v1.3.5
type Config struct { ApiBase string `yaml:"api_base" mapstructure:"api_base"` // if you use openai、langchain as sdk, it will be useful DeploymentConfig []DeploymentConfig `yaml:"deployment_config" mapstructure:"deployment_config"` // deployment config }
var ( C Config ModelDeploymentConfig = map[string]DeploymentConfig{} )
type DeploymentConfig ¶ added in v1.3.5
type DeploymentConfig struct { DeploymentName string `yaml:"deployment_name" json:"deployment_name" mapstructure:"deployment_name"` // azure openai deployment name ModelName string `yaml:"model_name" json:"model_name" mapstructure:"model_name"` // corresponding model name in openai Endpoint string `yaml:"endpoint" json:"endpoint" mapstructure:"endpoint"` // deployment endpoint ApiKey string `yaml:"api_key" json:"api_key" mapstructure:"api_key"` // secrect key1 or 2 ApiVersion string `yaml:"api_version" json:"api_version" mapstructure:"api_version"` // deployment version, not required EndpointUrl *url.URL // url.URL form deployment endpoint }
func GetDeploymentByModel ¶
func GetDeploymentByModel(model string) (*DeploymentConfig, error)
type DeploymentInfo ¶ added in v1.3.8
type RequestConverter ¶ added in v1.3.5
type StripPrefixConverter ¶ added in v1.3.5
type StripPrefixConverter struct {
Prefix string
}
func NewStripPrefixConverter ¶ added in v1.3.5
func NewStripPrefixConverter(prefix string) *StripPrefixConverter
func (*StripPrefixConverter) Convert ¶ added in v1.3.5
func (c *StripPrefixConverter) Convert(req *http.Request, config *DeploymentConfig) (*http.Request, error)
func (*StripPrefixConverter) Name ¶ added in v1.3.5
func (c *StripPrefixConverter) Name() string
type TemplateConverter ¶ added in v1.3.5
func NewTemplateConverter ¶ added in v1.3.5
func NewTemplateConverter(tpl string) *TemplateConverter
func (*TemplateConverter) Convert ¶ added in v1.3.5
func (c *TemplateConverter) Convert(req *http.Request, config *DeploymentConfig) (*http.Request, error)
func (*TemplateConverter) Name ¶ added in v1.3.5
func (c *TemplateConverter) Name() string
Click to show internal directories.
Click to hide internal directories.