Git Product home page Git Product logo

Comments (7)

CatAnonymous avatar CatAnonymous commented on May 19, 2024

I think it is correct to get the conversation data (conversation_id...) somewhere before get_answer

from bard-api.

dsdanielpark avatar dsdanielpark commented on May 19, 2024

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.

dsdanielpark avatar dsdanielpark commented on May 19, 2024

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.

NightMachinery avatar NightMachinery commented on May 19, 2024

@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 avatar dsdanielpark commented on May 19, 2024

@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.

CatAnonymous avatar CatAnonymous commented on May 19, 2024

@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.

dsdanielpark avatar dsdanielpark commented on May 19, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.