Simatwa / python-tgpt

AI Chat in Terminal + Package + REST-API
https://python-tgpt.onrender.com
MIT License
102 stars 15 forks source link

Bard-API #15

Closed johnd0e closed 6 months ago

johnd0e commented 7 months ago

(Bard provider does not work for me, that's why am I investigating this)

https://github.com/Simatwa/python-tgpt/blob/4eacc385443f5d7a5a6edbf14cd2e276443968f2/requirements.txt#L8 Here I wonder why version 1.4, while latest is 2.1. And what is also important - current GoogleBard lib in unmaintained (Public archive).

There is another package - bardapi. I have checked, and it is working for me, but only when I am using 3 cookies at once, like in this example. Just __Secure-1PSID is not enough.

johnd0e commented 7 months ago

BTW, bardapi it is possible not to specify cookies values explicitly, but extract them automatically from Chrome (via browser_cookie3)

Simatwa commented 7 months ago

(Bard provider does not work for me, that's why am I investigating this)

https://github.com/Simatwa/python-tgpt/blob/4eacc385443f5d7a5a6edbf14cd2e276443968f2/requirements.txt#L8

Here I wonder why version 1.4, while latest is 2.1. And what is also important - current GoogleBard lib in unmaintained (Public archive).

There is another package - bardapi. I have checked, and it is working for me, but only when I am using 3 cookies at once, like in this example. Just __Secure-1PSID is not enough.

It's only that I prioritized simplicity over functionality. Hoping to give it a fix soon.

github-actions[bot] commented 7 months ago

Bumping this issue because it has been open for 14 days with no activity. Closing automatically in 14 days unless it becomes active again.

Simatwa commented 7 months ago

Currently fixed. #https://github.com/Simatwa/python-tgpt/commit/b585dba9cbb1c14195109188620afe760cd822f4

johnd0e commented 7 months ago

Currently fixed. #https://github.com/Simatwa/python-tgpt/commit/b585dba9cbb1c14195109188620afe760cd822f4

Unfortunately does not work for me.

ERROR : SNlM0e value not found in response. Check __Secure_1PSID value.

Looking through your commit I found that these 2 cookies used: __Secure-1PSID, __Secure-1PAPISID. But for my case another cookies set required: __Secure-1PSID, __Secure-1PSIDTS, __Secure-1PSIDCC.

Please reopen the issue.

johnd0e commented 7 months ago

@Simatwa

Simatwa commented 7 months ago

Currently fixed. #b585dba

Unfortunately does not work for me.

ERROR : SNlM0e value not found in response. Check __Secure_1PSID value.

Looking through your commit I found that these 2 cookies used: __Secure-1PSID, __Secure-1PAPISID. But for my case another cookies set required: __Secure-1PSID, __Secure-1PSIDTS, __Secure-1PSIDCC.

Please reopen the issue.

Have you tried with updated cookies lately?

johnd0e commented 7 months ago

Have you tried with updated cookies lately?

Sure

Simatwa commented 7 months ago

Which extension did you used to export the cookies?

johnd0e commented 7 months ago

Cookie-Editor

Simatwa commented 7 months ago

Use export-cookie-for-puppeteer

johnd0e commented 7 months ago

Use export-cookie-for-puppeteer

Unfortunately no success either.

D:\AI\python-tgpt (main)>pygpt generate -p bard -k gemini.google.com.cookies.json
01:45:47 - ERROR : SNlM0e value not found in response. Check __Secure_1PSID value.
Quitting
Simatwa commented 7 months ago

I'm having a different error but it will be addressed in time.

Google Bard encountered an error:                                               
b')]}'\n\n104\n[["er",null,null,null,null,400,null,null,null,3],["di",15],["af.h
ttprm",15,"-5044462726004978363",51]]\n25\n[["e",4,null,null,140]]\n'.
johnd0e commented 7 months ago

By the way there is new implementation from g4f: https://github.com/xtekky/gpt4free/pull/1564 It works for me in gui. But not in cli

pygpt generate -p Gemini Hello
16:24:13 - ERROR : Gemini does not support "stream" argument

P.S. Same as Bard:

pygpt generate -p Bard Hello
16:26:56 - ERROR : Bard does not support "stream" argument
Simatwa commented 7 months ago

Nice. Disable streaming response using flag --whole, shortform -w

johnd0e commented 7 months ago

Can that be done automatically?

Simatwa commented 7 months ago

It's very much possible but it's not implemented because of CODE INTEGRITY.

johnd0e commented 6 months ago

because of CODE INTEGRITY.

What do you mean?

piotr25691 commented 6 months ago

gemini doesn't work yet.

this is my code:

import pytgpt.gemini as provider

ai = provider.GEMINI(cookie_file="gemini.cookie")
ai.chat("hi")

and i'm getting this error

"Gemini encountered an error: [...]"
johnd0e commented 6 months ago

gemini works for me in latest release.

Which extension did you used to export the cookies?

With both extensions is ok now.