mirror of
https://github.com/kardolus/chatgpt-cli.git
synced 2024-09-08 23:15:00 +03:00
Add a model flag
This commit is contained in:
@@ -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,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user