Comments (7)
I think it is correct to get the conversation data (conversation_id...) somewhere before get_answer
from bard-api.
Trying to stick more cookie information into the session and then proceeding may be able to fix it.
Try using a reusable session
first, then stick more cookie values to the session. If you find a solution, please contribute.
from bard-api.
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']
from bard-api.
@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.
from bard-api.
@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).
from bard-api.
@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.
from bard-api.
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.
from bard-api.
Related Issues (20)
- ChatBard: token_from_browser HOT 9
- ImportError: cannot import name 'BardCookies' from partially initialized module 'bardapi' (most likely due to a circular import) HOT 6
- Some code errors in README examples , os module import HOT 4
- Bard __SECURE-1PSID does not match HOT 2
- Exception: SNlM0e value not found. Double-check __Secure-1PSID value or pass it as Bard(token='xxxxx') HOT 1
- Google changed the the way "__Secure-1PSID" looks, how to use this package effectively,the cookie values does not end in '.' period now HOT 8
- Multiple-Cookies has been changed. HOT 15
- Image generation HOT 4
- Google renames its chatbot Bard to Gemini HOT 41
- Gemini Ultra? HOT 4
- TooManyRedirects: Exceeded 30 redirects. HOT 1
- Check out this Bard/Gemini project. HOT 2
- Google changed their __Secure-1PSID value stracture HOT 2
- ask_about_image Not working HOT 2
- Cookies refreshing very often and getting 429 all the time HOT 2
- How can automaticly get cookies value in no gui servers? HOT 2
- Please, go to Gemini-API `https://github.com/dsdanielpark/Gemini-API`
- a conversation towards getting advance AI HOT 1
- Reflection on the Bard API Project
- Connecting Geminei to Ads HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bard-api.