英文:
ChatGPT completion /v1/chat/completions memorize across multiple requests
问题
当我在https://api.openai.com/v1/chat/completions上使用user
参数时,记忆不会在多个请求之间保留。我们如何让模型在多个请求之间记住它?
例如,ChatGPT API是否会记住消息"My name is XXX"?还是我每次都必须发送它?那么如果它不用于记忆事物,"user"变量的目的是什么?
{
"model": "gpt-4",
"messages": [
{
"role": "user",
"content": "My name is XXX."
}
],
"user": "myuser"
}
英文:
When I use user
parameter on https://api.openai.com/v1/chat/completions, the memory is not persisted across multiple requests. How can we let the model memorize it across multiple requests?
Eg. is the message "My name is XXX" remembered by the ChatGPT API? Or do I have to send it every time? Then what is the purpose of the "user" variable if it is not used to remember things?
{
"model": "gpt-4",
"messages": [
{
"role": "user",
"content": "My name is XXX."
}
],
"user": "myuser"
}
答案1
得分: 2
你是说之前的消息被删除了吗?你需要记住它们。API 不会执行删除操作。将 messages
设为变量,并将响应附加到其中。下次发送包含先前响应的 messages
变量。
英文:
Do you mean that previous messages are deleted? You'll have to remember them. The API doesn't do that. Make messages
a variable and append the response to it. Next time send the messages
variable which contains the previous response
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论