I wrote an agent to retrieve relevant chunks from a proprietary knowledge base through an API that returns semantic chunks. I created a tool for this agent, where the tool accepts a user query and returns the relevant semantic chunks. In the instructions, I specified that the agent should retrieve the relevant chunks and pass the query as part of the instruction.
However, my agent is going into an infinite loop while trying to retrieve the data and eventually throws a max turn error after some time.”
i gave structured output in output_type
class DataChunk(BaseModel):
id: int
url: str
title: str
content:str
contentType:str
publishedDate:str
class SourceList(BaseModel):
items: List[DataChunk] = Field(
…,
description=“A list of dictionaries, where each dictionary contains information about a source here only relevant chunks for related to provided query.”
)