Skip to content

Commit

Permalink
feat: Import + Translate recipe images with OpenAI (mealie-recipes#3974)
Browse files Browse the repository at this point in the history
Co-authored-by: Johan Lindell <[email protected]>
Co-authored-by: boc-the-git <[email protected]>
  • Loading branch information
3 people authored Aug 17, 2024
1 parent 3d921cb commit 8a15f40
Show file tree
Hide file tree
Showing 23 changed files with 935 additions and 252 deletions.
9 changes: 8 additions & 1 deletion dev/code-generation/gen_py_pytest_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,16 @@ class PathObject(BaseModel):
http_verbs: list[HTTPRequest]


def force_include_in_schema(app: FastAPI):
# clear schema cache
app.openapi_schema = None
for route in app.routes:
route.include_in_schema = True


def get_path_objects(app: FastAPI):
force_include_in_schema(app)
paths = []

for key, value in app.openapi().items():
if key == "paths":
for key, value2 in value.items():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,15 @@ For usage, see [Usage - OpenID Connect](../authentication/oidc.md)

Mealie supports various integrations using OpenAI. To enable OpenAI, [you must provide your OpenAI API key](https://platform.openai.com/api-keys). You can tweak how OpenAI is used using these backend settings. Please note that while OpenAI usage is optimized to reduce API costs, you're unlikely to be able to use OpenAI features with the free tier limits.

| Variables | Default | Description |
| ------------------------- | :-----: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| OPENAI_BASE_URL | None | The base URL for the OpenAI API. If you're not sure, leave this empty to use the standard OpenAI platform |
| OPENAI_API_KEY | None | Your OpenAI API Key. Enables OpenAI-related features |
| OPENAI_MODEL | gpt-4o | Which OpenAI model to use. If you're not sure, leave this empty |
| OPENAI_WORKERS | 2 | Number of OpenAI workers per request. Higher values may increase processing speed, but will incur additional API costs |
| OPENAI_SEND_DATABASE_DATA | True | Whether to send Mealie data to OpenAI to improve request accuracy. This will incur additional API costs |
| OPENAI_REQUEST_TIMEOUT | 10 | The number of seconds to wait for an OpenAI request to complete before cancelling the request. Leave this empty unless you're running into timeout issues on slower hardware |
| Variables | Default | Description |
| ---------------------------- | :-----: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| OPENAI_BASE_URL | None | The base URL for the OpenAI API. If you're not sure, leave this empty to use the standard OpenAI platform |
| OPENAI_API_KEY | None | Your OpenAI API Key. Enables OpenAI-related features |
| OPENAI_MODEL | gpt-4o | Which OpenAI model to use. If you're not sure, leave this empty |
| OPENAI_ENABLE_IMAGE_SERVICES | True | Whether to enable OpenAI image services, such as creating recipes via image. Leave this enabled unless your custom model doesn't support it, or you want to reduce costs |
| OPENAI_WORKERS | 2 | Number of OpenAI workers per request. Higher values may increase processing speed, but will incur additional API costs |
| OPENAI_SEND_DATABASE_DATA | True | Whether to send Mealie data to OpenAI to improve request accuracy. This will incur additional API costs |
| OPENAI_REQUEST_TIMEOUT | 60 | The number of seconds to wait for an OpenAI request to complete before cancelling the request. Leave this empty unless you're running into timeout issues on slower hardware |

### Themeing

Expand Down
Loading

0 comments on commit 8a15f40

Please sign in to comment.