Skip to content

Commit

Permalink
Fix: Circular import error
Browse files Browse the repository at this point in the history
  • Loading branch information
jfrverdasca committed Nov 20, 2024
1 parent 8ff330b commit a7ab970
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion labs/embeddings/vectorizers/chunk_vectorizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import os

import pathspec
from core.models import Model
from embeddings.embedder import Embedder
from langchain.text_splitter import CharacterTextSplitter
from langchain_community.document_loaders import TextLoader
Expand All @@ -12,6 +11,8 @@

class ChunkVectorizer:
def __init__(self):
from core.models import Model # Avoid circular imports

embedder_class, *embeder_args = Model.get_active_embedding_model()
self.embedder = Embedder(embedder_class, *embeder_args)

Expand Down
3 changes: 2 additions & 1 deletion labs/embeddings/vectorizers/python_vectorizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from types import SimpleNamespace

import pathspec
from core.models import Model
from embeddings.embedder import Embedder
from langchain_community.document_loaders import TextLoader
from langchain_core.documents import Document
Expand All @@ -14,6 +13,8 @@

class PythonVectorizer:
def __init__(self):
from core.models import Model # Avoid circular imports

embedder_class, *embeder_args = Model.get_active_embedding_model()
self.embedder = Embedder(embedder_class, *embeder_args)

Expand Down

0 comments on commit a7ab970

Please sign in to comment.