From 567d1ab49d1f1be6e67b21afb2f5bb360e9e8079 Mon Sep 17 00:00:00 2001 From: Jose M Leon Date: Mon, 30 Dec 2024 08:45:21 -0500 Subject: [PATCH] FIX SyntaxError: f-string expression part cannot include a backslash (#25) * FIX unit tests * FEAT run tests prior to git push * FIX SyntaxError: f-string expression part cannot include a backslash --- .githooks/pre-push | 12 ++++++++++++ ra_aid/agents/ciayn_agent.py | 9 ++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) create mode 100755 .githooks/pre-push diff --git a/.githooks/pre-push b/.githooks/pre-push new file mode 100755 index 0000000..0378d80 --- /dev/null +++ b/.githooks/pre-push @@ -0,0 +1,12 @@ +#!/bin/bash + +echo "Running tests before push..." +make test +RESULT=$? + +if [ $RESULT -ne 0 ]; then + echo "Tests failed. Push aborted." + exit 1 +fi + +exit 0 diff --git a/ra_aid/agents/ciayn_agent.py b/ra_aid/agents/ciayn_agent.py index cf6a3af..70e5211 100644 --- a/ra_aid/agents/ciayn_agent.py +++ b/ra_aid/agents/ciayn_agent.py @@ -83,7 +83,11 @@ class CiaynAgent: if last_result is not None: base_prompt += f"\n{last_result}" - base_prompt += f""" + # Add available functions section + functions_list = "\n\n".join(self.available_functions) + + # Build the complete prompt without f-strings for the static parts + base_prompt += """ You are a ReAct agent. You run in a loop and use ONE of the available functions per iteration. @@ -101,8 +105,7 @@ You typically don't want to keep calling the same function over and over with th You must ONLY use ONE of the following functions (these are the ONLY functions that exist): - -{"\n\n".join(self.available_functions)} +""" + functions_list + """ You may use ANY of the above functions to complete your job. Use the best one for the current step you are on. Be efficient, avoid getting stuck in repetitive loops, and do not hesitate to call functions which delegate your work to make your life easier.