NousResearch / Hermes-Function-Calling

MIT License
475 stars 74 forks source link

File "/workspace/Hermes-Function-Calling/functioncall.py", line 126 :^^^^ SyntaxError: f-string: unmatched '(' #9

Closed henri-edh closed 3 months ago

henri-edh commented 3 months ago

line 126: inference_logger.info(f"Here's the response from the function call: {tool_call.get("name")}\n{function_response}")

The use of double quotes inside an f-string, which itself is delimited by double quotes causes an error. This causes Python to interpret the inner double quotes as the end of the string, leading to a syntax error.

To fix this: Use single quotes inside the f-string if the string you're calling (e.g., the name in tool_call.get("name")) does not itself contain single quotes. This is a simple fix but might not always be suitable if the inner string could contain single quotes.

inference_logger.info(f"Here's the response from the function call: {tool_call.get('name')}\n{function_response}")

This would apply to code lines : 126, 129 and 132

interstellarninja commented 3 months ago

hi henri, thank you for spotting it. i have updated the f-strings with single quotes. https://github.com/NousResearch/Hermes-Function-Calling/commit/bd02a3ad352e98f05d9516ec8a9d37eb2ebeab2f