Problems Using Bard AI in Python Repl

Hi, I’ve been recently having problems interacting with Google Bard’s API in Python - I would love to hear your feedback on this error that I received despite indicating my API Key in the code.

Weirdly, it says the Bard API Key must be provided as token argument or extracted from browser even though I have that in my code.

You can see what I mean at https://replit.com/@CCodes/Bard-Interaction-Test because idk what is going on here.

If anyone finds a solution, please inform me, although I understand this isn’t mainstream Python. :slight_smile:

P.S sorry for the handwriting on the screenshot

Well yes, you’ve defined it, but you’re not passing it in anywhere.

Maybe do bardapi.Bard(token=key)? idk I’ve never used the API

1 Like

Hmm, sent me a new error. . .


I have no idea what it’s trying to tell me now

Do you mind inviting me to the Repl? Seems to be a problem with your secret.

Yep, invited. Thanks for taking the time to help me figure this out.

1 Like