Documentation ¶
Index ¶
- Variables
- func EmbeddingsHandler(c *gin.Context, resp *http.Response) (*model.ErrorWithStatusCode, *model.Usage)
- func GetToken(apikey string) string
- 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(_ *gin.Context, relayMode int, request *model.GeneralOpenAIRequest) (any, error)
- func (a *Adaptor) ConvertSTTRequest(*http.Request) (io.ReadCloser, error)
- func (a *Adaptor) ConvertTTSRequest(*model.TextToSpeechRequest) (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) DoResponseV4(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)
- func (a *Adaptor) SetVersionByModeName(modelName string)
- func (a *Adaptor) SetupRequestHeader(c *gin.Context, req *http.Request, meta *meta.Meta) error
- type EmbeddingData
- type EmbeddingRequest
- type EmbeddingResponse
- type ImageRequest
- type Request
- type Response
- type ResponseData
- type StreamMetaResponse
Constants ¶
This section is empty.
Variables ¶
View Source
var ModelList = []string{
"chatglm_turbo", "chatglm_pro", "chatglm_std", "chatglm_lite",
"glm-4", "glm-4v", "glm-3-turbo", "embedding-2",
"cogview-3",
}
Functions ¶
func EmbeddingsHandler ¶
func StreamHandler ¶
Types ¶
type Adaptor ¶
type Adaptor struct {
APIVersion string
}
func (*Adaptor) ConvertImageRequest ¶
func (a *Adaptor) ConvertImageRequest(request *model.ImageRequest) (any, error)
func (*Adaptor) ConvertRequest ¶
func (*Adaptor) ConvertSTTRequest ¶
func (*Adaptor) ConvertTTSRequest ¶
func (a *Adaptor) ConvertTTSRequest(*model.TextToSpeechRequest) (any, error)
func (*Adaptor) DoResponse ¶
func (*Adaptor) DoResponseV4 ¶
func (*Adaptor) GetChannelName ¶
func (*Adaptor) GetModelList ¶
func (*Adaptor) SetVersionByModeName ¶
type EmbeddingData ¶
type EmbeddingRequest ¶
func ConvertEmbeddingRequest ¶
func ConvertEmbeddingRequest(request model.GeneralOpenAIRequest) (*EmbeddingRequest, error)
type EmbeddingResponse ¶
type EmbeddingResponse struct { Model string `json:"model"` Object string `json:"object"` Embeddings []EmbeddingData `json:"data"` model.Usage `json:"usage"` }
type ImageRequest ¶
type Request ¶
type Request struct { Temperature *float64 `json:"temperature,omitempty"` TopP *float64 `json:"top_p,omitempty"` RequestID string `json:"request_id,omitempty"` Prompt []model.Message `json:"prompt"` Incremental bool `json:"incremental,omitempty"` }
func ConvertRequest ¶
func ConvertRequest(request *model.GeneralOpenAIRequest) *Request
type Response ¶
type Response struct { Msg string `json:"msg"` Data ResponseData `json:"data"` Code int `json:"code"` Success bool `json:"success"` }
type ResponseData ¶
Click to show internal directories.
Click to hide internal directories.