diff --git a/README.md b/README.md index 234f3004ea..eeb53fa6d3 100644 --- a/README.md +++ b/README.md @@ -58,10 +58,16 @@ config = { chatbot = Chatbot(config, conversation_id=None) chatbot.reset_chat() # Forgets conversation chatbot.refresh_session() # Uses the session_token to get a new bearer token -resp = chatbot.get_chat_response(prompt) # Sends a request to the API and returns the response by OpenAI +resp = chatbot.get_chat_response(prompt, output="text") # Sends a request to the API and returns the response by OpenAI resp['message'] # The message sent by the response resp['conversation_id'] # The current conversation id resp['parent_id'] # The ID of the response + +response = requests.post("https://chat.openai.com/backend-api/conversation", headers=self.headers, data=json.dumps(data), stream=True) # This returns a stream of text (live update) + +for message in response: # You have to loop through the response stream + print(line['message']) # Same format as text return type + ... ``` This can be imported to projects for bots and much more. You can have multiple independent conversations by keeping track of the conversation_id.