Versions in this module Expand all Collapse all v0 v0.0.1 Feb 6, 2025 Changes in this version + var CompatibleChannels = []int + var ModelList = []string + func CountToken(text string) int + func CountTokenInput(input any, model string) int + func CountTokenMessages(messages []model.Message, model string) int + func CountTokenText(text string, model string) int + func ErrorWrapper(err error, code string, statusCode int) *model.ErrorWithStatusCode + func GetCompatibleChannelMeta(channelType int) (string, []string) + func GetFullRequestURL(baseURL string, requestURL string, channelType int) string + func Handler(c *gin.Context, resp *http.Response, promptTokens int, modelName string) (*model.ErrorWithStatusCode, *model.Usage) + func ImageHandler(c *gin.Context, resp *http.Response) (*model.ErrorWithStatusCode, *model.Usage) + func InitTokenEncoders() + func ResponseText2Usage(responseText string, modelName string, promptTokens int) *model.Usage + func StreamHandler(c *gin.Context, resp *http.Response, relayMode int) (*model.ErrorWithStatusCode, string, *model.Usage) + type Adaptor struct + ChannelType int + 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 ChatCompletionsStreamResponse struct + Choices []ChatCompletionsStreamResponseChoice + Created int64 + Id string + Model string + Object string + Usage *model.Usage + type ChatCompletionsStreamResponseChoice struct + Delta model.Message + FinishReason *string + Index int + type ChatRequest struct + MaxTokens int + Messages []model.Message + Model string + type CompletionsStreamResponse struct + Choices []struct{ ... } + type EmbeddingResponse struct + Data []EmbeddingResponseItem + Model string + Object string + type EmbeddingResponseItem struct + Embedding []float64 + Index int + Object string + type ImageContent struct + ImageURL *model.ImageURL + Type string + type ImageData struct + B64Json string + RevisedPrompt string + Url string + type ImageRequest struct + Model string + N int + Prompt string + Quality string + ResponseFormat string + Size string + Style string + User string + type ImageResponse struct + Created int64 + Data []ImageData + type Segment struct + AvgLogprob float64 + CompressionRatio float64 + End float64 + Id int + NoSpeechProb float64 + Seek int + Start float64 + Temperature float64 + Text string + Tokens []int + type SlimTextResponse struct + Choices []TextResponseChoice + Error model.Error + type TextContent struct + Text string + Type string + type TextRequest struct + MaxTokens int + Messages []model.Message + Model string + Prompt string + type TextResponse struct + Choices []TextResponseChoice + Created int64 + Id string + Model string + Object string + type TextResponseChoice struct + FinishReason string + Index int + type TextToSpeechRequest struct + Input string + Model string + ResponseFormat string + Speed float64 + Voice string + type UsageOrResponseText struct + ResponseText string + type WhisperJSONResponse struct + Text string + type WhisperVerboseJSONResponse struct + Duration float64 + Language string + Segments []Segment + Task string + Text string