mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2024-10-01 01:06:10 -04:00
Use the default for max_tokens to avoid errors.
This commit is contained in:
parent
b24ace372b
commit
79d6243fe1
@ -81,12 +81,16 @@ void ChatGPT::prompt(const std::string &prompt,
|
||||
m_ctx = &promptCtx;
|
||||
m_responseCallback = responseCallback;
|
||||
|
||||
// FIXME: We don't set the max_tokens on purpose because in order to do so safely without encountering
|
||||
// an error we need to be able to count the tokens in our prompt. The only way to do this is to use
|
||||
// the OpenAI tiktokken library or to implement our own tokenization function that matches precisely
|
||||
// the tokenization used by the OpenAI model we're calling. OpenAI has not introduced any means of
|
||||
// using the REST API to count tokens in a prompt.
|
||||
QJsonObject root;
|
||||
root.insert("model", m_modelName);
|
||||
root.insert("stream", true);
|
||||
root.insert("temperature", promptCtx.temp);
|
||||
root.insert("top_p", promptCtx.top_p);
|
||||
root.insert("max_tokens", 200);
|
||||
|
||||
QJsonArray messages;
|
||||
for (int i = 0; i < m_context.count() && i < promptCtx.n_past; ++i) {
|
||||
|
Loading…
Reference in New Issue
Block a user