def get_plan_agent(llm_model, doc_ids, embedding_name):
planer = Agent(
name=“Planner”,
role=“Make plan”,
description=“You are an API development engineer”
“You need to convert user needs into one or more API requests based on the API information in the knowledgebase to meet user expectations.”,
instructions=[
“You will be provided with one or more APIs, but this is just for your reference. Do not try to use all the APIs. You need to use the necessary and as few APIs as possible to complete the corresponding requirements.”,
“Do not generate plans that are not relevant to the query message”,
“If multiple steps are required, please describe in detail what the before_request and after_request of each step are to do.”,
“If some property is required but use not provide, please use default value from API”,
“Do not return comments starting with // in the return output”
],
knowledge=KnowledgeBaseFactory(embedding_model=embedding_name).json_knowledge_base,
add_context=True,
retriever=functools.partial(get_docs_by_ids, doc_ids, embedding_name),
response_model=PlanSteps,
structured_outputs=True,
add_datetime_to_instructions=True,
debug_mode=True,
user_id=“123”,
storage=PgAgentStorage(table_name=“personalized_agent_sessions”, db_url=PG_URL),
)
if llm_model.startswith(“gpt”):
model_ = OpenAIChat(id=llm_model, api_key=OPEN_AI_KEY)
else:
model_ = Groq(id=llm_model, api_key=GROQ_AI_KEY)
planer.structured_outputs = False
planer.response_model = None
planer.expected_output = format_steps_text
planer.model = model_
return planer
I have an agent, defined as shown in the figure. When I use the gpt4 series llm and provide a response_model, it runs normally. However, when I switch to the groq llm for the same code, an error occurs. The error message is as follows
So I have to use branch judgment. If it is not a gpt series model, I use the expected_output parameter to specify the format and leave response_model empty.
My current version is 2.7.7, but I remember that groq also supported structured output when Agent was the Assistant version before, so please help me check if my usage is wrong?