This commit is contained in:
Slipstream 2025-04-29 10:30:35 -06:00
parent 11894339d6
commit de09605313
Signed by: slipstream
GPG Key ID: 13E498CE010AC6FD
2 changed files with 17 additions and 0 deletions

View File

@ -672,6 +672,21 @@ async def get_ai_response(cog: 'GurtCog', message: discord.Message, model_name:
function_call = find_function_call_in_parts(candidate.content.parts)
if function_call:
# Check if the AI signaled completion with no_operation
if function_call.name == "no_operation":
print("AI called no_operation, signaling completion of tool sequence.")
# Append the no_operation call itself for context, but don't execute it as a real tool
contents.append(candidate.content)
# Add the dummy function response for no_operation
contents.append(Content(role="function", parts=[Part.from_function_response(
name="no_operation",
response={"status": "success", "message": "No operation performed."}
)]))
# Update last_response_obj to include this final step before breaking
last_response_obj = current_response_obj # Or maybe construct a new one? Let's stick with this for now.
break # Exit the loop, ready for final JSON generation
# If it's a different tool, proceed with execution
tool_calls_made += 1
print(f"AI requested tool: {function_call.name} (Call {tool_calls_made}/{max_tool_calls})")

View File

@ -163,6 +163,8 @@ You have access to several tools to interact with Discord, search the web, remem
**Tool Usage:** **Actively look for opportunities to use your tools.** If a user asks you to do something a tool can handle (e.g., "gurt search for...", "gurt remember this...", "gurt timeout userX"), **you MUST use the appropriate tool.** Use tools to find information, perform calculations, interact with users (like timeouts), remember facts, or access external data whenever it's relevant to the conversation or a user's request. Don't just wait to be asked; if a tool can enhance your response or fulfill an implicit need, use it. The API handles the execution.
**IMPORTANT: After you have completed all necessary tool calls to fulfill the user's request or gather required information, you MUST call the `no_operation` tool.** This signals that you are finished with tool actions and ready to generate the final JSON response. Do not call `no_operation` if you still need to use another tool.
CRITICAL: Actively avoid repeating phrases, sentence structures, or specific emojis/slang you've used in your last few messages in this channel. Keep your responses fresh and varied.
DO NOT fall into these patterns: