Documentation
¶
Index ¶
- Variables
- func EmbeddingHandler(c *gin.Context, resp *http.Response) (*model.ErrorWithStatusCode, *model.Usage)
- func Handler(c *gin.Context, resp *http.Response) (*model.ErrorWithStatusCode, *model.Usage)
- func StreamHandler(c *gin.Context, resp *http.Response) (*model.ErrorWithStatusCode, *model.Usage)
- type Adaptor
- func (a *Adaptor) ConvertImageRequest(request *model.ImageRequest) (any, error)
- func (a *Adaptor) ConvertRequest(c *gin.Context, relayMode int, request *model.GeneralOpenAIRequest) (any, error)
- func (a *Adaptor) DoRequest(c *gin.Context, meta *meta.Meta, requestBody io.Reader) (*http.Response, error)
- func (a *Adaptor) DoResponse(c *gin.Context, resp *http.Response, meta *meta.Meta) (usage *model.Usage, err *model.ErrorWithStatusCode)
- func (a *Adaptor) GetChannelName() string
- func (a *Adaptor) GetModelList() []string
- func (a *Adaptor) GetRequestURL(meta *meta.Meta) (string, error)
- func (a *Adaptor) Init(meta *meta.Meta)
- func (a *Adaptor) SetupRequestHeader(c *gin.Context, req *http.Request, meta *meta.Meta) error
- type ChatRequest
- type ChatResponse
- type EmbeddingRequest
- type EmbeddingResponse
- type Message
- type Options
Constants ¶
This section is empty.
Variables ¶
View Source
var ModelList = []string{
"codellama:7b-instruct",
"llama2:7b",
"llama2:latest",
"llama3:latest",
"phi3:latest",
"qwen:0.5b-chat",
"qwen:7b",
}
Functions ¶
func EmbeddingHandler ¶
func StreamHandler ¶
Types ¶
type Adaptor ¶
type Adaptor struct { }
func (*Adaptor) ConvertImageRequest ¶
func (a *Adaptor) ConvertImageRequest(request *model.ImageRequest) (any, error)
func (*Adaptor) ConvertRequest ¶
func (*Adaptor) DoResponse ¶
func (*Adaptor) GetChannelName ¶
func (*Adaptor) GetModelList ¶
type ChatRequest ¶
type ChatRequest struct { Model string `json:"model,omitempty"` Messages []Message `json:"messages,omitempty"` Stream bool `json:"stream"` Options *Options `json:"options,omitempty"` }
func ConvertRequest ¶
func ConvertRequest(request model.GeneralOpenAIRequest) *ChatRequest
type ChatResponse ¶
type ChatResponse struct { Model string `json:"model,omitempty"` CreatedAt string `json:"created_at,omitempty"` Message Message `json:"message,omitempty"` Response string `json:"response,omitempty"` // for stream response Done bool `json:"done,omitempty"` TotalDuration int `json:"total_duration,omitempty"` LoadDuration int `json:"load_duration,omitempty"` PromptEvalCount int `json:"prompt_eval_count,omitempty"` EvalCount int `json:"eval_count,omitempty"` EvalDuration int `json:"eval_duration,omitempty"` Error string `json:"error,omitempty"` }
type EmbeddingRequest ¶
func ConvertEmbeddingRequest ¶
func ConvertEmbeddingRequest(request model.GeneralOpenAIRequest) *EmbeddingRequest
type EmbeddingResponse ¶
type Options ¶
type Options struct { Seed int `json:"seed,omitempty"` Temperature float64 `json:"temperature,omitempty"` TopK int `json:"top_k,omitempty"` TopP float64 `json:"top_p,omitempty"` FrequencyPenalty float64 `json:"frequency_penalty,omitempty"` PresencePenalty float64 `json:"presence_penalty,omitempty"` }
Click to show internal directories.
Click to hide internal directories.