I am aware of several similar questions, but was unable to find a working solution in any of them. Here’s my code:
<code>found = False
tool : str
for tool in task.tools:
print(f"{tool} ({len(tool)} chars) found, looking for {directive.split(': ')[1]} ({len(directive.split(': ')[1])} chars).n")
if tool == directive.split(": ")[1]:
# Do work
found = True
break
if not found:
response = f"Could not find {tool}. To use a tool, your first line must contain only the tool directive as outlined. You may try again or try to reach your goal another way."
</code>
<code>found = False
tool : str
for tool in task.tools:
print(f"{tool} ({len(tool)} chars) found, looking for {directive.split(': ')[1]} ({len(directive.split(': ')[1])} chars).n")
if tool == directive.split(": ")[1]:
# Do work
found = True
break
if not found:
response = f"Could not find {tool}. To use a tool, your first line must contain only the tool directive as outlined. You may try again or try to reach your goal another way."
</code>
found = False
tool : str
for tool in task.tools:
print(f"{tool} ({len(tool)} chars) found, looking for {directive.split(': ')[1]} ({len(directive.split(': ')[1])} chars).n")
if tool == directive.split(": ")[1]:
# Do work
found = True
break
if not found:
response = f"Could not find {tool}. To use a tool, your first line must contain only the tool directive as outlined. You may try again or try to reach your goal another way."
And here’s the response:
<code>Human Feedback (14 chars) found, looking for Human Feedback (14 chars).
Could not find Human Feedback. To use a tool, your first line must contain only the tool directive as outlined. You may try again or try to reach your goal another way.
</code>
<code>Human Feedback (14 chars) found, looking for Human Feedback (14 chars).
Could not find Human Feedback. To use a tool, your first line must contain only the tool directive as outlined. You may try again or try to reach your goal another way.
</code>
Human Feedback (14 chars) found, looking for Human Feedback (14 chars).
Could not find Human Feedback. To use a tool, your first line must contain only the tool directive as outlined. You may try again or try to reach your goal another way.
task.tools
is a dict, the keys are strings. The directive
was the first line of another string, created by splitting on n
so this isn’t a hidden character issue. The fact that the strings have the same number of characters is further evidence of this.