Hey all,
I have a use case where I need to use a ReAct prompt for reasoning and search, after which I want to output data in Json Format.
Here is an example describing the use case,
Context - I am making a JD and CV matching system. The ReAct agent will search about all the companies candidate has worked for, using a bing search tool provided, and then give the results in JSON derived from a
pydantic object.
JD - {KFC company hiring for sales manager}
CV - {candidate has worked for mcDonalds and Pizza Hut as sales rep}
Determine , if the companies candidate has worked for are similiar to KFC or not by using the seach_tool.
After determining, output in
class ScoringReasoning(BaseModel):
reasoning: str = Field(description="Detailed reasoning behind the score.")
score: str = Field(description="Score for this factor. please always show the out of how much you are scoring. For example, if a criteria has to be scored out of 50. Then please output the score in format 20/50 or 21/50, etc. and not just as 20 or 21")
# Define your desired data structure.
class scoring_schema(BaseModel):
name_of_candiate : str = Field(description="Name of the candiate")
email_of_candidate : str = Field(description="Email of the candidate")
phone_no_of_candidate : str = Field(description="Phone number of the candidate")
company_similarity_score : ScoringReasoning = Field(description="Score, Reasoning for candidate's similarity score between candidate's previous companies and the hiring company.")
I have tried to use the output_parser with ReAct agent, with this gives errors.
from llama_index.core.agent import ReActAgent
react_agent = ReActAgent.from_tools([search_bing_tool], llm=llm, verbose=True,output_parser=scoring_schema)
is there another approach I can take to accomplish this?