Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not import LLM functions at top level #594

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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