Add a model flag

This commit is contained in:
kardolus
2023-05-05 14:33:10 -04:00
parent ec26fea3f6
commit c09c7b8800
3 changed files with 21 additions and 7 deletions

View File

@@ -25,8 +25,9 @@ const (
type Client struct {
History []types.Message
caller http.Caller
readWriter history.Store
capacity int
model string
readWriter history.Store
}
func New(caller http.Caller, rw history.Store) *Client {
@@ -34,6 +35,7 @@ func New(caller http.Caller, rw history.Store) *Client {
caller: caller,
readWriter: rw,
capacity: MaxTokenSize,
model: GPTModel,
}
}
@@ -42,6 +44,11 @@ func (c *Client) WithCapacity(capacity int) *Client {
return c
}
func (c *Client) WithModel(model string) *Client {
c.model = model
return c
}
// Query sends a query to the API and returns the response as a string.
// It takes an input string as a parameter and returns a string containing
// the API response or an error if there's any issue during the process.
@@ -119,8 +126,8 @@ func (c *Client) ProvideContext(context string) {
func (c *Client) createBody(stream bool) ([]byte, error) {
body := types.Request{
Model: GPTModel,
Messages: c.History,
Model: c.model,
Stream: stream,
}