Documentation ¶
Index ¶
- Constants
- func BuildAudioSpeechRequest(model string) (io.Reader, error)
- func BuildChatCompletionRequest(model string) (io.Reader, error)
- func BuildEmbeddingsRequest(model string) (io.Reader, error)
- func BuildImagesGenerationsRequest(modelConfig *model.ModelConfig) (io.Reader, error)
- func BuildModeDefaultPath(mode int) string
- func BuildModerationsRequest(model string) (io.Reader, error)
- func BuildRequest(modelName string) (io.Reader, int, error)
- func BuildRerankRequest(model string) (io.Reader, error)
- func DoRequest(req *http.Request) (*http.Response, error)
- func IsStreamResponse(resp *http.Response) bool
- func RelayDefaultErrorHanlder(resp *http.Response) *model.ErrorWithStatusCode
- func RelayErrorHandler(meta *meta.Meta, resp *http.Response) *model.ErrorWithStatusCode
- func RerankErrorHandler(resp *http.Response) *model.ErrorWithStatusCode
- func UnmarshalGeneralOpenAIRequest(req *http.Request) (*relaymodel.GeneralOpenAIRequest, error)
- func UnmarshalImageRequest(req *http.Request) (*relaymodel.ImageRequest, error)
- func UnmarshalMap(req *http.Request) (map[string]any, error)
- func UnmarshalRerankRequest(req *http.Request) (*relaymodel.RerankRequest, error)
- func UnmarshalTTSRequest(req *http.Request) (*relaymodel.TextToSpeechRequest, error)
- type GeneralErrorResponse
- type UnsupportedModelTypeError
Constants ¶
View Source
const ( ErrorTypeUpstream = "upstream_error" ErrorCodeBadResponse = "bad_response" )
Variables ¶
This section is empty.
Functions ¶
func BuildImagesGenerationsRequest ¶
func BuildImagesGenerationsRequest(modelConfig *model.ModelConfig) (io.Reader, error)
func BuildModeDefaultPath ¶
func IsStreamResponse ¶
func RelayDefaultErrorHanlder ¶
func RelayDefaultErrorHanlder(resp *http.Response) *model.ErrorWithStatusCode
func RelayErrorHandler ¶
func RerankErrorHandler ¶
func RerankErrorHandler(resp *http.Response) *model.ErrorWithStatusCode
func UnmarshalGeneralOpenAIRequest ¶
func UnmarshalGeneralOpenAIRequest(req *http.Request) (*relaymodel.GeneralOpenAIRequest, error)
func UnmarshalImageRequest ¶
func UnmarshalImageRequest(req *http.Request) (*relaymodel.ImageRequest, error)
func UnmarshalRerankRequest ¶
func UnmarshalRerankRequest(req *http.Request) (*relaymodel.RerankRequest, error)
func UnmarshalTTSRequest ¶
func UnmarshalTTSRequest(req *http.Request) (*relaymodel.TextToSpeechRequest, error)
Types ¶
type GeneralErrorResponse ¶
type GeneralErrorResponse struct { Error model.Error `json:"error"` Message string `json:"message"` Msg string `json:"msg"` Err string `json:"err"` ErrorMsg string `json:"error_msg"` Header struct { Message string `json:"message"` } `json:"header"` Response struct { Error struct { Message string `json:"message"` } `json:"error"` } `json:"response"` }
func (GeneralErrorResponse) ToMessage ¶
func (e GeneralErrorResponse) ToMessage() string
type UnsupportedModelTypeError ¶
type UnsupportedModelTypeError struct {
ModelType string
}
func NewErrUnsupportedModelType ¶
func NewErrUnsupportedModelType(modelType string) *UnsupportedModelTypeError
func (*UnsupportedModelTypeError) Error ¶
func (e *UnsupportedModelTypeError) Error() string
Click to show internal directories.
Click to hide internal directories.