dsdanielpark / Bard-API

The unofficial python package that returns response of Google Bard through cookie value.

Home Page:https://pypi.org/project/bardapi/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error: 'NoneType' object is not subscriptable

charls-a opened this issue Β· comments

πŸ’šπŸ’œ Thank you for interest. β€οΈπŸ’›
Please make sure to check for more efficient package management.

To Reproduce

  • I have read README.md. Please read me.
  • I have searched for existing issues and FAQ (Most of the issues are duplicates.)
  • I installed the appropriate version and confirmed that the previous version was properly removed upon reinstallation.
  • I also checked the environment (not only on a single local machine but also on Google Colab, different Google accounts, and tried resetting cookies, etc. Please make sure to attempt these steps if necessary, and test the functionality in a new virtual environment if needed.)

Example

pip uninstall bardapi             # and restart kernel
pip install bardapi==0.1.29       # check proper version
pip install -u bardapi==0.1.29    # upgrade version
import bardapi
bardapi.__version__

----------Please delete the content above this line, including this line.-------------

Describe the bug
A clear and concise description of what the bug is.

Version
OS: Ubuntu 20.04.6 LTS
Python: 2.7.18
Bard API: 0.1.29
Using proxy: No
Legion:

Code

code line

Error

error message

Error: 'NoneType' object is not subscriptable

I'm trying to run a IRC BOT (https://github.com/knrd1/bard/), but after it connects to IRC and ask a question, it shows this error message in console:

Error: 'NoneType' object is not subscriptable

and on IRC:

<@bard> BARD PANIC! Check console for error message.

How can this be fixed it?

Conclusion: It's challenging to address at the package level. Code to allow for temporary circumvention when using the service.

In cases of 'NoneType subscriptable' or 'object not iterable' errors, it typically indicates that the response thrown by Bard is insufficient or the interface has slightly changed. This can often be a temporary block or may occur even when repeating the same question multiple times.

Therefore, instead of porting this Bard to some solution, it's better to aim for one or two reproductions, and even then, it might be preferable to use the official APIs of OpenAI or PALM.

If you wish to use it for free, it's advisable to use it in a way that avoids hitting the limit rating.

As you know, the inference cost for a large language model is enormous, so another option could be to find a model with similar functionality on Hugging Face and use it with quantization to reduce costs.

Ultimately, there aren't many free APIs available that can provide smooth and quick responses for free, so it's best to use them for a few reproductions...

Conclusively, this error is hard to resolve at the package level, unfortunately...

Also, if you input a new cookie to start clean (the error may not be reproduced), in bard.get_response, you can only code to avoid these difficult situations by hard coding an exception block with messages like "I'm having trouble answering now. Please ask again later." or "I'm having trouble answering now. Please contact the developer after exiting."

Thanks for your response!
After not giving up I finally found the solution... i have to install bardapi version 0.1.30 to make it works

charls-a

I will check 0.1.30. thanks.