EvanZhouDev / bard-ai

A lightweight library to access Google Bard.
https://www.npmjs.com/package/bard-ai
GNU General Public License v3.0
117 stars 31 forks source link

Use cases for advance and json response #25

Closed mashwishi closed 1 year ago

mashwishi commented 1 year ago

I am quite confuse about:

let myConversationContinued = new Bard.Chat({
    conversationID: string,
    responseID: string,
    choiceID: string,
    _reqID: string,
});

I can understand the conversationID however why do we need the responseID, choiceID, and _reqID we need brief explanation such us what does it do, how important it is. conversationID based on what I understand this is the one that keeps or holds the entire conversation. but I am lost at responseID, choiceID, and _reqID. Can you enlighten me about this? or is it possible to use conversationID id only? because i have conversationID via supabase database that group them together and maybe i can use that to specify which conversation they are talking right?

Also how do you guys use the useJSON if ever i use the advanced way? do i have to include it on the myConversationContinued thing to i still have to do it next to the message?

ThatXliner commented 1 year ago

Is this a question about importing a chat?

mashwishi commented 1 year ago

About understanding the usage of the responseID, choiceID, and _reqID..

EvanZhouDev commented 1 year ago

Yes, you can assume they are necessary.

I'm not too sure what they do, but I'm safely assuming: responseID is the actual response you're on in the conversation choiceID is which response you chose out of the possible responses and _reqID is probably some form of a index to keep track of responses

As for useJSON, it's mostly for the advanced image information.

Any other questions? Closing otherwise.

mashwishi commented 1 year ago

Do i have to manually put it ?

Aldhanekaa commented 1 year ago

Do i have to manually put it ?

No, It's optional. It is used when you want to begin new chat that is linked to previous conversations (So Bard able to understand the context, or you can link to a custom prompts)

EvanZhouDev commented 1 year ago

Yes, please read the documentation. Closing.

mashwishi commented 1 year ago

I am not asking for "optional" or not.

What i am pointing here is is it "OKAY" to apply "conversationID" or it is required to use responseID, choiceID, and _reqID.

That's the question here, As can you see the issue title is Use cases, I know it is optional but it isn't declare if all of this are required to be in the post request.

Now, Do i have to manually specify the "value" of the responseID, choiceID, and _reqID.

You know I am from google bard ai module and it only require us to put "conversationID" the reason i have this kind of question, I don't think this question is included in the docs. Well export is in different section while this topic points the "creating a new conversation"

image

EvanZhouDev commented 1 year ago

Oh... So if I understand correctly: You came from GoogleBard, which only gave you a conversationID... now, you've migrated to bard-ai, you're asking how responseID, choiceID, and _reqID should be filled in.

From the code I have right now, that's not possible... however in Version 2, we may address this issue... if only 1 ID is required, the better!

Please stay tuned, especially to #30.

mashwishi commented 1 year ago

Thank you, This will help us lessen our code process!

EvanZhouDev commented 1 year ago

Okay, after a little bit of digging through GoogleBard code, here's how it works: The so-called "conversationID" in GoogleBard is a abstracted ID (that technically doesn't mean anything to Bard)... GoogleBard takes that ID, and associates it to a JSON with all of the real IDs that Bard uses. These real IDs are split into four:

conversationID: string
responseID: string
choiceID: string
_reqID: string

Because of this, to find these real IDs, you're going to have to look through the JSON files that GoogleBard generates.

These are the IDs that bard-ai gives, and are the IDs that are able to be used universally across all "unofficial" Google Bard APIs. You may need to migrate some things, but honestly I believe it's for the better if you do it in this way.

@ThatXliner @Aldhanekaa @RFS-ADRENO What do y'all think?

ThatXliner commented 1 year ago

I personally would like to keep it raw.