Replies: 6 comments 1 reply
-
Same problem here. Didn't find the answer yet. Following the discussion |
Beta Was this translation helpful? Give feedback.
-
Same problem here. I am clueless on these errors:
I am using Azure OpenAI - GPT-4o 2024-06-01 Below is my code for the Pydantic Model to get the structured output: from typing import List
from pydantic import BaseModel, Field
class InvoiceLineItemDetails(BaseModel):
invoice_number: str = Field(..., description="Invoice Number available in the invoice")
po_no: str = Field(..., description="Purchase Order Number against each line-item in the invoice")
po_line_no: str = Field(..., description="Purchase Order Line Number associated with each Purchase Order")
material_no: str = Field(..., description="Material Number of each line-item in the invoice")
quantity: str = Field(..., description="Quantity of each line-item specified in the invoice")
class InvoiceData(BaseModel):
invoice_data: List[InvoiceLineItemDetails] = Field(..., description="List of invoice line items details") |
Beta Was this translation helpful? Give feedback.
-
Update: I fixed my error by passing required keys in one of the task description and also corrected my pydantic model to match the same keys. I am getting expected results now! :D I corrected my above pydantic model code as below from typing import List
from pydantic import BaseModel, Field
class InvoiceLineItemDetails(BaseModel):
invoice_number: str = Field(..., description="Invoice Number available in the invoice")
po_no: str = Field(..., description="Purchase Order Number against each line-item in the invoice")
po_line: str = Field(..., description="Purchase Order Line Number associated with each Purchase Order")
material_no: str = Field(..., description="Material Number of each line-item in the invoice")
quantity: str = Field(..., description="Quantity of each line-item specified in the invoice")
class InvoiceData(BaseModel):
invoice_data: List[InvoiceLineItemDetails] = Field(..., description="List of invoice line items details") As you can see, I changed po_line_no to po_line because in one of my task description I was specifying this key as po_line. Now, it is working as expected and getting the output in a structured way |
Beta Was this translation helpful? Give feedback.
-
Hello, |
Beta Was this translation helpful? Give feedback.
-
No success here. I stopped using crewAI because of it and thought to check again later this month for a solution |
Beta Was this translation helpful? Give feedback.
-
any update on the output_pydantic parameter usage? I was getting this error if I'm using pydantic classes Traceback (most recent call last): |
Beta Was this translation helpful? Give feedback.
-
I tried creating pydantic base model and passed
Article
model toCrew
class but doesn't provide the structured output. What am I missing?Pydantic is None in the output.
Can you point me in right direction? I have included the error in the end. I have no clue to address that error without a documentation. Looked into this github issue on LiteLLM #4817
FYI: I'm using Azure OpenAI - GPT-4O
Output: I get the output but not the pydantic structured output.
Error: I get this error
Beta Was this translation helpful? Give feedback.
All reactions