Forum Discussion
chatgpt如何更简单的进行连续对话?How to do continuous dialogue more easily with chatgpt?
- Oct 12, 2023
Hi Yen_Harvey,
o do continuous dialogue more easily with ChatGPT, you can use the dialogue ID. The dialogue ID is a unique identifier that is generated for each conversation. It can be used to track the progress of a conversation and to prevent duplicate token deductions.
Here is a quick guide on how to use dialogue ID for continuous dialogue with ChatGPT:
- Generate a dialogue ID. You can use a UUID generator to generate a unique identifier for your conversation.
- Add the dialogue ID to the request. When you send a request to ChatGPT, include the dialogue ID in the request.
- Use the dialogue ID to retrieve the chat history. When you need to retrieve the chat history for a conversation, include the dialogue ID in the request.
Here is an example of how to use dialogue ID for continuous dialogue with ChatGPT using Python:
import openai # Generate a dialogue ID dialogue_id = openai.uuid.generate() # Add the dialogue ID to the request response = openai.ChatCompletion.create( model="text-davinci-002-render", prompt="Hello!", dialogue_id=dialogue_id ) # Print the response print(response.choices[0].text)
Here are some links you can take a look:
https://platform.openai.com/docs/api-reference
Conversation ID and Chat History ID parity - Plugin Development - OpenAI Developer ForumPlease click Mark as Best Response & Like if my post helped you to solve your issue.
This will help others to find the correct solution easily. It also closes the item.If the post was useful in other ways, please consider giving it Like.
Kindest regards,
Leon Pavesic
(LinkedIn)
Hi Yen_Harvey,
o do continuous dialogue more easily with ChatGPT, you can use the dialogue ID. The dialogue ID is a unique identifier that is generated for each conversation. It can be used to track the progress of a conversation and to prevent duplicate token deductions.
Here is a quick guide on how to use dialogue ID for continuous dialogue with ChatGPT:
- Generate a dialogue ID. You can use a UUID generator to generate a unique identifier for your conversation.
- Add the dialogue ID to the request. When you send a request to ChatGPT, include the dialogue ID in the request.
- Use the dialogue ID to retrieve the chat history. When you need to retrieve the chat history for a conversation, include the dialogue ID in the request.
Here is an example of how to use dialogue ID for continuous dialogue with ChatGPT using Python:
import openai
# Generate a dialogue ID
dialogue_id = openai.uuid.generate()
# Add the dialogue ID to the request
response = openai.ChatCompletion.create(
model="text-davinci-002-render",
prompt="Hello!",
dialogue_id=dialogue_id
)
# Print the response
print(response.choices[0].text)
Here are some links you can take a look:
https://platform.openai.com/docs/api-reference
Conversation ID and Chat History ID parity - Plugin Development - OpenAI Developer Forum
Please click Mark as Best Response & Like if my post helped you to solve your issue.
This will help others to find the correct solution easily. It also closes the item.
If the post was useful in other ways, please consider giving it Like.
Kindest regards,
Leon Pavesic
(LinkedIn)