Проблема с Gemini API в Discord Bot (с использованием discord.py) ⇐ Python
-
Anonymous
Проблема с Gemini API в Discord Bot (с использованием discord.py)
I have a discord ask command that's supposed to let the user ask any thing and take the input and give it to gemini through the API but it seems to keep returning 0 canidates. I included a try statement only incase the user asks something innapropriate but it seems like its always being used no matter what i ask. Heres the code:
# Bot command: Ask a question @bot.command() async def ask(ctx, *, question): if question == None: await ctx.send("**Please provide a question.**") return await ctx.send("**Generating Response...**") print(f"ques: {question}") response = model.generate_content(str(question)) try: await send_long_message(ctx, response.text) except ValueError: print(response.text) await ctx.send(f"There was an error. Prompt Feedback: {response.prompt_feedback}") Its not a problem with the send_long_message function
I tried removing the send_long_message function and adding/removing await but nothing seemed to work. Same problem. Sometimes a value error or sometimes a type error. It always returns 0 candidates.
Источник: https://stackoverflow.com/questions/781 ... discord-py
I have a discord ask command that's supposed to let the user ask any thing and take the input and give it to gemini through the API but it seems to keep returning 0 canidates. I included a try statement only incase the user asks something innapropriate but it seems like its always being used no matter what i ask. Heres the code:
# Bot command: Ask a question @bot.command() async def ask(ctx, *, question): if question == None: await ctx.send("**Please provide a question.**") return await ctx.send("**Generating Response...**") print(f"ques: {question}") response = model.generate_content(str(question)) try: await send_long_message(ctx, response.text) except ValueError: print(response.text) await ctx.send(f"There was an error. Prompt Feedback: {response.prompt_feedback}") Its not a problem with the send_long_message function
I tried removing the send_long_message function and adding/removing await but nothing seemed to work. Same problem. Sometimes a value error or sometimes a type error. It always returns 0 candidates.
Источник: https://stackoverflow.com/questions/781 ... discord-py