What should I do if kickoff return nothing on pydantic even if I give pydantic model?

hi bros

my problem is that the crew.kickoff(..) result does not have pydantic model when I properly define output_pydantic on my tasks…

splitter_agent = Agent(**splitter_agent_params)
splitter_task = Task(
    **splitter_task_params,
    agent=splitter_agent,
    output_pydantic=SplitterOutput,
)

sanitizer_agent = Agent(**sanitizer_agent_params)
sanitizer_task = Task(
    **sanitizer_task_params,
    agent=sanitizer_agent,
    contexts=[splitter_task],
    output_pydantic=SanitizerOutput,
)

crew = Crew(
    agents=[splitter_agent, sanitizer_agent],
    tasks=[splitter_task, sanitizer_task],
    verbose=True,
)

its gpt-4o-mini model and sometimes return value is right formatted pydantic model or sometimes returns just string raw return, not pydantic model.

how can I enhance this… workers to produce always right formatted result?

editted *
I lookup pydantic result related topics and I found a message implies ‘using open ai model’ is maybe problematic. … really? If yes, what should I do?

I would say it’s not that OpenAI models are problematic. It looks more like the gpt-4o-mini is not capable enough in your case.

Switching the gpt-4o-mini with gpt-4o might solve the issue.