-
-
Notifications
You must be signed in to change notification settings - Fork 535
How to continue an conversation? #19
Comments
I think it is correct to get the conversation data (conversation_id...) somewhere before get_answer |
Trying to stick more cookie information into the session and then proceeding may be able to fix it. Try using a |
It was confirmed that the conversation can be continued through a reusable session. Use the following code. Close the issue. from bardapi import Bard
import os
import requests
token='VwhVqhvFpnOm_sSsLszdru_DWm8otZBt3hPR9fud2BePGTk2jQmGmfcbKb_vyr3IjJFKEA.'
session = requests.Session()
session.headers = {
"Host": "bard.google.com",
"X-Same-Domain": "1",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36",
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
"Origin": "https://bard.google.com",
"Referer": "https://bard.google.com/",
}
session.cookies.set("__Secure-1PSID", token)
bard = Bard(token=token, timeout=30, session=session)
bard.get_answer("나와 내 동년배들이 좋아하는 뉴진스에 대해서 알려줘")['content'] bard.get_answer("What is my last prompt is?")['content'] |
@dsdanielpark This re-usable session is the same as in the readme, correct? So one must not use sessions if one wants to reset the conversation? Worth adding to the readme. |
In the current version of Bard, having extended conversations is limited due to its short session lengths. The Bard API serves as a more simplified version of chatting on the official Bard website. The fact that Bards have a short memory implies that they don't update parameters during conversations, only keeping chat history for a brief period. To better understand how the Bard service operates, it's essential to explore its functionality with the large language model (LLM). |
The way programming languages work is different . Basically, Bard's server will rely on the SNlM0e conversation_id choice_id response_id of the previous conversation and the new question to answer the question, if those elements are not found then the equivalent of a new conversation. So we need to save it after each response and send it again with the question to achieve the goal, I got it. |
If you keep the session fixed and test it, you can receive the last prompt of the previous conversation as part of the result. Please confirm and let me know. If that's not the case, it would be best to maintain the conversation history and continue the conversation based on that. |
Can you show me what I need to save so that Bard can remember the previous conversation without starting a new one after each question?
I'm trying to write it on PHP
I used Chrome Dev Tools to monitor and found SNlM0e and conversation_id unchanged, I tried saving it again but the result is not as expected
The text was updated successfully, but these errors were encountered: