Documentation
¶
Index ¶
Constants ¶
View Source
const ( CTX_CLIENT_REQ_MODEL_KEY = "model" CTX_CLIENT_REQ_BACKEND_KEY = "backend" )
Variables ¶
This section is empty.
Functions ¶
func AddBackendToContext ¶
AddBackendToContext adds the backend string to the context
Types ¶
type ErrorResponse ¶
type ErrorResponse struct {
ErrorBody *openai.Error `json:"error"`
}
ErrorResponse is the response body for an error
type OpenAIPassthroughClient ¶
type OpenAIPassthroughClient struct { BaseURL string APIKey string // contains filtered or unexported fields }
OpenAIPassthroughClient is a client for the OpenAI API
func NewOpenAIClient ¶
func NewOpenAIClient(baseURL, apiKey string) *OpenAIPassthroughClient
NewOpenAIClient creates a new OpenAI client with the given base URL and API key
func (*OpenAIPassthroughClient) DoRequest ¶
func (c *OpenAIPassthroughClient) DoRequest( ctx context.Context, method, path string, body *bytes.Reader, ) (*http.Response, error)
DoRequest performs an HTTP request to the upstream API, use raw client request to do a passthrough instead of using the OpenAI client which does custom handling, retries, etc and would need manual handling of the response and streaming.
Click to show internal directories.
Click to hide internal directories.