Commit Graph

8 Commits

Author SHA1 Message Date
Arsham Mirehvandi
ae53961fd2 Enhance product filtering logic with legal state checks
- Updated README.md to clarify the product prefiltering process, emphasizing the importance of legal catalog state in determining product eligibility.
- Refactored products.py to implement checks for product registration against the government catalog, ensuring only permitted products are included in recommendations.
- Added new functions to handle registration normalization and state validation, improving the accuracy of product filtering.
- Expanded unit tests in test_products.py to validate the new legal state checks and ensure correct behavior in filtering products based on their registration status.
2026-09-22 10:57:08 +02:00
Arsham Mirehvandi
ded1ba5fd0 Update treatment interval handling and refine advice generation logic
- Increased `thinking_budget` in `config.yaml` from 9216 to 11264 to enhance LLM performance.
- Clarified conditions for including `last_applied_treatment` in the advice JSON structure, ensuring it is appended even when `allowed_products` is empty.
- Refactored product filtering logic in `products.py` to implement a new function for checking if the treatment interval is open, improving the accuracy of product recommendations.
- Updated unit tests to validate the new treatment interval logic and ensure correct behavior in various scenarios.
2026-09-22 09:57:06 +02:00
Arsham Mirehvandi
d1569a301f Refactor treatment history handling and enhance product filtering logic
- Updated README.md to clarify the conditions for `last_applied_treatment` and its integration into the advice JSON structure.
- Refactored job.py to utilize a new `TreatmentHistory` class for managing treatment data, improving clarity and efficiency in treatment retrieval.
- Enhanced advice_context.py to conditionally include `last_applied_treatment` based on the treatment history, ensuring no redundant queries are made.
- Modified products.py to implement logic for excluding active ingredients based on the latest treatment's interval, refining the product prefiltering process.
- Updated vector.py to ensure the SQL allowlist is applied correctly, improving the efficiency of product searches.
- Added unit tests to validate the new treatment history functionality and product filtering logic.
2026-09-20 23:38:25 +02:00
Arsham Mirehvandi
884d42e125 Update weather metrics handling and LLM configuration
- Adjusted `max_tokens` in `config.yaml` for LLM models to optimize performance, setting `gpt-4o-mini` to 2048 and `gpt-4o` to 5120.
- Enhanced `assemble.py` to include a new `_weather_fields` function for improved metric handling, ensuring consistent data formatting across weather forecasts.
- Updated SQL queries in `weather.py` to incorporate additional wind speed metrics, enhancing the data model for weather analysis.
- Expanded query synthesis documentation in `_default.md` to include conditions for wind speed variations, improving advisory generation logic.
- Added unit tests in `test_assemble.py` to validate wind speed handling in weather forecasts and ensure robustness of the advisory generation process.
2026-09-17 14:05:50 +02:00
Arsham Mirehvandi
253a6d853d Update product retrieval limits in README and vector search logic
- Adjusted the maximum number of recommended products from 6 to 4 in README.md to reflect changes in the product retrieval process.
- Modified vector.py to limit the number of products retrieved per query to 4 for single queries and 2 for multiple queries, ensuring better deduplication and efficiency in product searches.
2026-09-16 23:18:23 +02:00
Arsham Mirehvandi
d45e4de40b Refactor assemble.py and disease.py for clarity and functionality
- Moved the assignment of `phenology_phase` in assemble.py to ensure it is included only for valid days.
- Updated the docstring in disease.py to clarify the rounding behavior of decimal values, enhancing the understanding of the formatting logic.
- Removed unnecessary checks in the decimal formatting function to streamline the code.
2026-09-16 22:40:14 +02:00
Arsham Mirehvandi
d8273b5cd1 Enhance advice context and treatment handling
- Updated README.md to clarify the conditions for including `last_applied_treatment` in the advice JSON structure.
- Modified job.py to pass `as_of` and `field_id` to the advice generation function.
- Enhanced advice_context.py to conditionally add `last_applied_treatment` based on recent treatment history and allowed products.
- Introduced new functions in treatments.py to group treatments by day and load the last treatment before the recent window.
- Updated _output_format.md to specify the conditions under which `last_applied_treatment` is included in the advisory.
2026-09-09 16:00:23 +02:00
Arsham Mirehvandi
8a6d48e5a1 Enhance advice generation and context handling
- Updated README.md to reflect changes in the `json_for_advice_generation` structure, including the addition of `date_of_today` and clarification of `last_advice` fields.
- Modified job.py to load and pass the issuance date of the last advice.
- Enhanced advice_context.py to include the issuance date in the last advice retrieval.
- Updated assemble.py to include `date_of_today` in the JSON assembly for advice generation.
- Improved advice.py to sanitize the `advice_summary` by removing relative date references and ensuring compliance with new guidelines.
2026-09-08 09:40:34 +02:00