Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ __pycache__/
# Distribution / packaging
.venv*/
dist/
venv/

.DS_Store

Expand Down
8 changes: 6 additions & 2 deletions examples/product_recommendation/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,12 @@ class ProductTaxonomyInfo:
- complementary_taxonomies: Think about when customers buy this product, what else they might need as complementary products. Put labels for these complentary products.
"""

taxonomies: list[ProductTaxonomy]
complementary_taxonomies: list[ProductTaxonomy]
taxonomies: list[ProductTaxonomy] = dataclasses.field(
metadata={"description": "Taxonomies for the current product."}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the standard way to add description for fields.

Please convert these dataclasses to Pydantic models.

Please also test these field descriptions are passed to LLM as expected.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HI, thanks for the review!. I noticed the original code used dataclasses for all the defined classes, and my assigned issue (#1088) asked to add field descriptions for the product recommendation example.

Just to confirm - you'd like me to convert these dataclasses to Pydantic models so the field descriptions are correctly recognized by the system?

Thanks again for your guidance!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for asking. Yes, we would like to convert them to Pydantic models iwth Pydantic field description.

BTW, the issue #1088 linked #1087 which has more background about this.

Thanks!

)
complementary_taxonomies: list[ProductTaxonomy] = dataclasses.field(
metadata={"description": "Think about when customers buy this product, what else they might need as complementary products. Put labels for these complentary products."}
)


@cocoindex.op.function(behavior_version=2)
Expand Down