- Classify the sentiment of each piece of feedback (using GPT-4o-mini)
- Categorize the topic of each piece of feedback (using GPT-4o-mini)
- Generate a comprehensive summary of the feedback (using GPT-4o)
Code
Example usage
Key points
- Multiple LLM Models: We use GPT-4o-mini for quick classification tasks (sentiment and topic) and GPT-4o for the more complex task of summarization.
- Specialized Agents: We create separate agents for different tasks, each with its own LLM model. This allows us to optimize for both speed and quality.
-
Structured Data: We use Pydantic models (
Feedback
andFeedbackSummary
) to ensure type safety and consistent data structures throughout the workflow. -
Task-Specific Result Types: Each task has a specific
result_type
that matches the expected output, ensuring that the agents provide the correct type of information. -
Workflow Composition: The
analyze_customer_feedback
flow composes multiple tasks into a cohesive workflow, demonstrating how ControlFlow can manage complex, multi-step processes that include loops and conditional logic.