#๐ Chatbot API confusion
58 messages ยท Page 1 of 1 (latest)
@cursive shoal
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
from google import genai
from google.genai import types
import chatbot
client = genai.Client()
chat = client.chats.create(model="gemini-2.5-flash")
print("Your Character is ready! You can start chatting now. (Type 'exit' to quit)")
user_input = input("Enter your message to the character: ")
while user_input.lower() != 'exit':
response = chat.send_message(chatbot.prompt)
print(f"{chatbot.choice_name}: {response.text}\n")
user_input = input("Enter your message to the character: ")
where do i add api and logic behind it
can anybody explain
@cursive shoal do you know what website gemini-2.5-flash is coming from? do you have an account there?
the API key is so that your code knows which account you are. Your API key is both a username and a password, so once you have it, never post it in the server!!!
the youtuber didn't add an api key but his worked
how ?
he probably had the api key in a .env file
how do i add it
can you tell ?
is that your computer, or the youtuber's?
the youtuber's
you still haven't answered my question.
i do have an account
on what website?
got it
the page I linked to also shows you how to store the api key in a .env file
ok
i will read it
you're showing a few characters of your API key. that's probably fine, but remember what I said about keeping your API key a secret.
yes, i got it, i shared cause it is not complete
if you post your API key in Discord, a bot will probably take it and start using it, and you will have to pay for whatever they do.
ohk
@waxen folio
Yes?
It's a keyboard interrupt. Did you do control+c?
where ?
it says at the bottom.
yw
the thing is i am learning to code and am new to this
that's why i am asking silly questions
it's okay
I hope you're enjoying the journey
enjoying a lot
it's a fun activity to do and me and my friend are working on a roleplay chatbot
can I have the role of pope?
where multiple characters can talk
but for the mvp, we decided to do just one-to-one
pope ?
yes
ok
i was thinking of multiple chats for different character personality, the prompt will include the recent message from user and others and a whole summary of the chat that had happened
multiple chats in the sense like multiple api, one for one character
but mvp will be simple compared to that
it will have one-to-one
This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.