Skip to content

Commit

Permalink
Do not import LLM functions at top level (#594)
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidMStraub authored Dec 28, 2024
1 parent 19b6873 commit 867f444
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion gramps_webapi/api/resources/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
from marshmallow import Schema
from webargs import fields

from ..llm import answer_prompt_retrieve
from ..util import (
get_tree_from_jwt,
use_args,
Expand Down Expand Up @@ -54,6 +53,9 @@ def post(self, args):
"""Create a chat response."""
require_permissions({PERM_USE_CHAT})
check_quota_ai(requested=1)
# import here to avoid error if OpenAI-Python is not installed
from gramps_webapi.api.llm import answer_prompt_retrieve

tree = get_tree_from_jwt()
try:
response = answer_prompt_retrieve(
Expand Down

0 comments on commit 867f444

Please sign in to comment.