Проблема с Gemini API в Discord Bot (с использованием discord.py) ⇐ Python
Проблема с Gemini API в Discord Bot (с использованием discord.py)
Alright so 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 canidates.
Источник: https://stackoverflow.com/questions/781 ... discord-py
Alright so 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 canidates.
Источник: https://stackoverflow.com/questions/781 ... discord-py
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Gemini возвращает ошибку: 400 Многоходовой чат не включен для моделей/gemini-pro-vision
Anonymous » » в форуме Python - 0 Ответы
- 142 Просмотры
-
Последнее сообщение Anonymous
-
-
-
Gemini возвращает ошибку: 400 Многоходовой чат не включен для моделей/gemini-pro-vision
Anonymous » » в форуме Python - 0 Ответы
- 136 Просмотры
-
Последнее сообщение Anonymous
-
-
-
«Настойчивое преследование: подключение моего Discord.py Discord Bot к сети на Python»
Anonymous » » в форуме Python - 0 Ответы
- 132 Просмотры
-
Последнее сообщение Anonymous
-