yigitcanozdemir
commited on
Commit
·
95f8049
1
Parent(s):
20ce711
Parsed outpu fix
Browse files
models/pydantic_schemas.py
CHANGED
|
@@ -16,7 +16,7 @@ class Features(BaseModel):
|
|
| 16 |
themes: list[str] = Field(
|
| 17 |
description="Actual thematic content (not quality descriptors)"
|
| 18 |
)
|
| 19 |
-
date_range: list[int] = Field(description="Date range [min_year, max_year]")
|
| 20 |
negative_keywords: list[str] = Field(description="List of negative keywords")
|
| 21 |
production_region: list[str] = Field(description="Production region")
|
| 22 |
min_rating: Optional[float] = Field(
|
|
|
|
| 16 |
themes: list[str] = Field(
|
| 17 |
description="Actual thematic content (not quality descriptors)"
|
| 18 |
)
|
| 19 |
+
date_range: list[int] = Field(description="Date range [min_year, max_year] (note: max_year is 2025)")
|
| 20 |
negative_keywords: list[str] = Field(description="List of negative keywords")
|
| 21 |
production_region: list[str] = Field(description="Production region")
|
| 22 |
min_rating: Optional[float] = Field(
|
models/recommendation_engine.py
CHANGED
|
@@ -57,8 +57,19 @@ class RecommendationEngine:
|
|
| 57 |
],
|
| 58 |
response_format=Features,
|
| 59 |
)
|
| 60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
except Exception as e:
|
|
|
|
| 62 |
return Features(
|
| 63 |
movie_or_series="both",
|
| 64 |
genres=[],
|
|
|
|
| 57 |
],
|
| 58 |
response_format=Features,
|
| 59 |
)
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
response_model = response.choices[0].message.parsed
|
| 63 |
+
|
| 64 |
+
print(type(response_model))
|
| 65 |
+
print(response_model.model_dump_json(indent=2))
|
| 66 |
+
print(f"✅ Parsed features: {response_model}")
|
| 67 |
+
return response_model
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
|
| 71 |
except Exception as e:
|
| 72 |
+
print(f"❌ Error parsing user query: {str(e)}")
|
| 73 |
return Features(
|
| 74 |
movie_or_series="both",
|
| 75 |
genres=[],
|