Documentation ¶
Index ¶
Constants ¶
View Source
const ( MAX_CONVERSATION_LENGTH = 100 MAX_TOKENS = 1600 )
View Source
const ( Mistral7BInstruct AnyscaleModel = "mistralai/Mistral-7B-Instruct-v0.1" Llama27bChat AnyscaleModel = "meta-llama/Llama-2-7b-chat-hf" Llama213bChat AnyscaleModel = "meta-llama/Llama-2-13b-chat-hf" Llama270bChat AnyscaleModel = "meta-llama/Llama-2-70b-chat-hf" Mixtral8x7BInstruct AnyscaleModel = "mistralai/Mixtral-8x7B-Instruct-v0.1" CodeLlama34b AnyscaleModel = "codellama/CodeLlama-34b-Instruct-hf" CodeLlama70b AnyscaleModel = "codellama/CodeLlama-70b-Instruct-hf" GPT35Turbo OpenAIModel = "gpt-3.5-turbo" )
Variables ¶
This section is empty.
Functions ¶
func MustCheckConnection ¶
func MustLoadAPIKey ¶
Ensure we have the right env variables set for the given source
Types ¶
type AnyscaleModel ¶
type AnyscaleModel string
func IsAnyscaleModel ¶
func IsAnyscaleModel(name string) (AnyscaleModel, bool)
func (AnyscaleModel) String ¶
func (a AnyscaleModel) String() string
type Client ¶
func MustConnectAnyscale ¶
func MustConnectAnyscale(model AnyscaleModel, temperature float32) *Client
func MustConnectOpenAI ¶
func MustConnectOpenAI(model OpenAIModel, temperature float32) *Client
func (*Client) SendCompletionRequest ¶
func (c *Client) SendCompletionRequest(ctx context.Context, conv *Conversation, userPrompt string) (string, error)
Waits for the entire response to be returned Adds the users request, and the response to the conversation
func (*Client) SendStreamRequest ¶
func (c *Client) SendStreamRequest(ctx context.Context, conv *Conversation, userPrompt string, responseChan chan string, errChan chan error)
Stream the response as it comes in Adds the users request, and the response to the conversation
type Conversation ¶
type Conversation struct { Messages []openai.ChatCompletionMessage // contains filtered or unexported fields }
func NewConversation ¶
func NewConversation(systemPrompt string, maxMessages int, maxTokens int) *Conversation
Start a new conversation with the system prompt A system prompt defines the initial context of the conversation This includes the persona of the bot and any information that you want to provide to the model.
func (*Conversation) Append ¶
func (c *Conversation) Append(m openai.ChatCompletionMessage) error
func (*Conversation) SeedConversation ¶ added in v0.0.2
func (c *Conversation) SeedConversation(requestResponseMap map[string]string)
type OpenAIModel ¶
type OpenAIModel string
func IsOpenAIModel ¶
func IsOpenAIModel(name string) (OpenAIModel, bool)
func (OpenAIModel) String ¶
func (o OpenAIModel) String() string
Click to show internal directories.
Click to hide internal directories.