Errors
from datetime import date
import workflowai
from pydantic import BaseModel, Field
from workflowai import Model, WorkflowAIError
# define your input and output fields
class Input(BaseModel):
transcript: str
call_date: date
class Output(BaseModel):
positive_points: list[str] = Field(description="List of positive points from the call", default_factory=list)
negative_points: list[str] = Field(description="List of negative points from the call", default_factory=list)
# define your agent
@workflowai.agent(model=Model.GEMINI_2_0_FLASH_LATEST)
async def analyze_call_feedback(input: Input) -> Output:
"""
Analyze customer call feedback and extract positive and negative points.
"""
...
try:
await analyze_call_feedback(
CallFeedbackInput(
transcript="[00:01:15] Customer: The product is great!",
call_date=date(2024, 1, 15)
)
)
except WorkflowAIError as e:
print(e.code)
print(e.message)Recoverable errors
Last updated