Documentation ¶
Index ¶
- Constants
- func NewEmbeddingsServiceClient(conn *grpc.ClientConn)
- func ToChatItems(messages []openai.ChatCompletionMessage) ([]*chat.ChatItem, error)
- func ToJsonMessage(chatItem *chat.ChatItem) (openai.ChatCompletionMessage, error)
- type AudioRequest
- type Embedding
- type EmbeddingRequest
- type EmbeddingResponse
- type OpenAIHandler
- type Usage
Constants ¶
const StopToken = "<|im_end|>"
TODO: this should get factored out into the .toml files for each model, but this is an intermediate fix
Variables ¶
This section is empty.
Functions ¶
func NewEmbeddingsServiceClient ¶
func NewEmbeddingsServiceClient(conn *grpc.ClientConn)
func ToChatItems ¶
Turn a list of openai.ChatCompletionMessages into a list of chat.ChatItems that can be added to a ChatCompletionRequest proto that can submitted for inference
func ToJsonMessage ¶
Convert a single ChatItem from a ChatCompletionResponse proto into an openai.ChatCompletionMessage that can be serialized to json and sent back to the client This only operates on a single ChatItem because the response from the inference server should only be a single ChatItem per prompt. If you request N responses to your prompt, this will get called separately for each of them.
Types ¶
type AudioRequest ¶
type EmbeddingRequest ¶
type EmbeddingRequest struct { // Input is a slice of strings for which you want to completion an Embedding vector. // Each input must not exceed 2048 tokens in length. // OpenAPI suggests replacing newlines (\n) in your input with a single space, as they // have observed inferior results when newlines are present. // E.g. // "The food was delicious and the waiter..." Input any `json:"input"` // ID of the model to use. You can use the List models API to see all of your available models, // or see our Model overview for descriptions of them. Model string `json:"model"` // A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse. User string `json:"user"` }
TODO: this probably isn't necessary EmbeddingRequest is the input to a Create embeddings request.
type EmbeddingResponse ¶
type OpenAIHandler ¶
type OpenAIHandler struct {
Prefix string
}
func (*OpenAIHandler) Routes ¶
func (o *OpenAIHandler) Routes(r *gin.Engine)