diff --git a/docs/docs/documentation/getting-started/installation/backend-config.md b/docs/docs/documentation/getting-started/installation/backend-config.md index 2fd34f973..0857e7f63 100644 --- a/docs/docs/documentation/getting-started/installation/backend-config.md +++ b/docs/docs/documentation/getting-started/installation/backend-config.md @@ -131,7 +131,7 @@ For custom mapping variables (e.g. OPENAI_CUSTOM_HEADERS) you should pass values | 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 | +| OPENAI_REQUEST_TIMEOUT | 300 | 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 | ### Theming diff --git a/mealie/core/settings/settings.py b/mealie/core/settings/settings.py index c388c813a..1f30fdf14 100644 --- a/mealie/core/settings/settings.py +++ b/mealie/core/settings/settings.py @@ -398,7 +398,7 @@ class AppSettings(AppLoggingSettings): Sending database data may increase accuracy in certain requests, but will incur additional API costs """ - OPENAI_REQUEST_TIMEOUT: int = 60 + OPENAI_REQUEST_TIMEOUT: int = 300 """ The number of seconds to wait for an OpenAI request to complete before cancelling the request """ diff --git a/mealie/services/openai/openai.py b/mealie/services/openai/openai.py index e94aedc3b..0919a6367 100644 --- a/mealie/services/openai/openai.py +++ b/mealie/services/openai/openai.py @@ -135,9 +135,7 @@ class OpenAIService(BaseService): ) return "\n".join(content_parts) - async def _get_raw_response( - self, prompt: str, content: list[dict], temperature=0.2, force_json_response=True - ) -> ChatCompletion: + async def _get_raw_response(self, prompt: str, content: list[dict], force_json_response=True) -> ChatCompletion: client = self.get_client() return await client.chat.completions.create( messages=[ @@ -151,7 +149,6 @@ class OpenAIService(BaseService): }, ], model=self.model, - temperature=temperature, response_format={"type": "json_object"} if force_json_response else NOT_GIVEN, ) @@ -161,7 +158,6 @@ class OpenAIService(BaseService): message: str, *, images: list[OpenAIImageBase] | None = None, - temperature=0.2, force_json_response=True, ) -> str | None: """Send data to OpenAI and return the response message content""" @@ -174,7 +170,7 @@ class OpenAIService(BaseService): for image in images or []: user_messages.append(image.build_message()) - response = await self._get_raw_response(prompt, user_messages, temperature, force_json_response) + response = await self._get_raw_response(prompt, user_messages, force_json_response) if not response.choices: return None return response.choices[0].message.content