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
This commit is contained in:
Jose M Leon 2024-12-30 08:45:21 -05:00 committed by GitHub
parent 712663b086
commit 567d1ab49d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 3 deletions

12
.githooks/pre-push Executable file
View File

@ -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

View File

@ -83,7 +83,11 @@ class CiaynAgent:
if last_result is not None:
base_prompt += f"\n<last result>{last_result}</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 += """
<agent instructions>
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):
<available functions>
{"\n\n".join(self.available_functions)}
<available functions>""" + functions_list + """
</available functions>
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.