mirror of
https://github.com/theroyallab/tabbyAPI.git
synced 2026-03-15 00:07:28 +00:00
fix issues with optional dependencies (#204)
* fix issues with optional dependencies * format document * Tree: Format and comment
This commit is contained in:
@@ -5,16 +5,12 @@ from loguru import logger
|
||||
from typing import List, Optional
|
||||
|
||||
from common.utils import unwrap
|
||||
from common.optional_dependencies import dependencies
|
||||
|
||||
# Conditionally import infinity to sidestep its logger
|
||||
has_infinity_emb: bool = False
|
||||
try:
|
||||
if dependencies.extras:
|
||||
from infinity_emb import EngineArgs, AsyncEmbeddingEngine
|
||||
|
||||
has_infinity_emb = True
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
|
||||
class InfinityContainer:
|
||||
model_dir: pathlib.Path
|
||||
@@ -23,7 +19,7 @@ class InfinityContainer:
|
||||
|
||||
# Conditionally set the type hint based on importablity
|
||||
# TODO: Clean this up
|
||||
if has_infinity_emb:
|
||||
if dependencies.extras:
|
||||
engine: Optional[AsyncEmbeddingEngine] = None
|
||||
else:
|
||||
engine = None
|
||||
|
||||
Reference in New Issue
Block a user