Documentation
¶
Index ¶
- Variables
- func EmbeddingHandler(c *gin.Context, resp *http.Response) (*model.ErrorWithStatusCode, *model.Usage)
- func GetAccessToken(apiKey string) (string, error)
- 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 AccessToken
- 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 ChatStreamResponse
- type EmbeddingData
- type EmbeddingRequest
- type EmbeddingResponse
- type Error
- type Message
- type TokenResponse
Constants ¶
This section is empty.
Variables ¶
View Source
var ModelList = []string{
"ERNIE-4.0-8K",
"ERNIE-3.5-8K",
"ERNIE-3.5-8K-0205",
"ERNIE-3.5-8K-1222",
"ERNIE-Bot-8K",
"ERNIE-3.5-4K-0205",
"ERNIE-Speed-8K",
"ERNIE-Speed-128K",
"ERNIE-Lite-8K-0922",
"ERNIE-Lite-8K-0308",
"ERNIE-Tiny-8K",
"BLOOMZ-7B",
"Embedding-V1",
"bge-large-zh",
"bge-large-en",
"tao-8k",
}
Functions ¶
func EmbeddingHandler ¶
func GetAccessToken ¶
func StreamHandler ¶
Types ¶
type AccessToken ¶
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 { Messages []Message `json:"messages"` Temperature *float64 `json:"temperature,omitempty"` TopP *float64 `json:"top_p,omitempty"` PenaltyScore *float64 `json:"penalty_score,omitempty"` Stream bool `json:"stream,omitempty"` System string `json:"system,omitempty"` DisableSearch bool `json:"disable_search,omitempty"` EnableCitation bool `json:"enable_citation,omitempty"` MaxOutputTokens int `json:"max_output_tokens,omitempty"` UserId string `json:"user_id,omitempty"` }
func ConvertRequest ¶
func ConvertRequest(request model.GeneralOpenAIRequest) *ChatRequest
type ChatResponse ¶
type ChatStreamResponse ¶
type ChatStreamResponse struct { ChatResponse SentenceId int `json:"sentence_id"` IsEnd bool `json:"is_end"` }
type EmbeddingData ¶
type EmbeddingRequest ¶
type EmbeddingRequest struct {
Input []string `json:"input"`
}
func ConvertEmbeddingRequest ¶
func ConvertEmbeddingRequest(request model.GeneralOpenAIRequest) *EmbeddingRequest
type EmbeddingResponse ¶
type TokenResponse ¶
Click to show internal directories.
Click to hide internal directories.