Skip to content

Commit 867f444

Browse files
author
David Straub
authored
Do not import LLM functions at top level (#594)
1 parent 19b6873 commit 867f444

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

gramps_webapi/api/resources/chat.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
from marshmallow import Schema
2323
from webargs import fields
2424

25-
from ..llm import answer_prompt_retrieve
2625
from ..util import (
2726
get_tree_from_jwt,
2827
use_args,
@@ -54,6 +53,9 @@ def post(self, args):
5453
"""Create a chat response."""
5554
require_permissions({PERM_USE_CHAT})
5655
check_quota_ai(requested=1)
56+
# import here to avoid error if OpenAI-Python is not installed
57+
from gramps_webapi.api.llm import answer_prompt_retrieve
58+
5759
tree = get_tree_from_jwt()
5860
try:
5961
response = answer_prompt_retrieve(

0 commit comments

Comments
 (0)