I want to create an agent with LangChain and followed one of their tutorials.
In my use case, I want to generate text with gpt and score the generated text with some kind of metrics. If the score of these metrics is too low, I want the agent to generate new text with the feedback of my metrics.
Right now, the agent generates the text and scores it using the metrics I provide as tools. Each tool is used only once and not recursively.
The agent looks like this:
agent = LLMSingleActionAgent(
llm_chain=llm_chain,
output_parser=output_parser,
stop=["\nObservation:"],
allowed_tools=tool_names,
max_iterations_per_tool=10,
)
In the agent template I described that the agent should regenerate the text when tool x returns a value below a certain threshold, but this does not work.
Any ideas how to solve this problem?