mealie-recipes / mealie

Mealie is a self hosted recipe manager and meal planner with a RestAPI backend and a reactive frontend application built in Vue for a pleasant user experience for the whole family. Easily add recipes into your database by providing the url and mealie will automatically import the relevant data or add a family recipe with the UI editor
https://docs.mealie.io
GNU Affero General Public License v3.0
5.59k stars 608 forks source link

fix: Open AI Parsing Fails When Group Has No Units #3769

Closed michael-genson closed 1 week ago

michael-genson commented 1 week ago

What type of PR is this?

(REQUIRED)

What this PR does / why we need it:

(REQUIRED)

By default, we pass all units to OpenAI when parsing. This increases parser accuracy by giving the LLM sample units. We don't check if the group actually has any units, and we can't send nothing (we raise a Pydantic validation error if we try to). This PR skips the injection in this case.

Which issue(s) this PR fixes:

(REQUIRED)

N/A, raised in Discord

Testing

(fill-in or delete this section)

I had the user try adding one unit before trying to parse and that fixed their issue.