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

fix: Fix the mypy check error #1373

Merged
merged 4 commits into from
Apr 7, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ jobs:
run: make setup
- name: Check Python code style
run: make fmt-check
- name: Check Python code type
run: make mypy
8 changes: 7 additions & 1 deletion dbgpt/app/knowledge/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,13 @@ def delete_space(self, space_name: str):
if len(spaces) == 0:
raise Exception(f"delete error, no space name:{space_name} in database")
space = spaces[0]
config = VectorStoreConfig(name=space.name)
embedding_factory = CFG.SYSTEM_APP.get_component(
"embedding_factory", EmbeddingFactory
)
embedding_fn = embedding_factory.create(
model_name=EMBEDDING_MODEL_CONFIG[CFG.EMBEDDING_MODEL]
)
config = VectorStoreConfig(name=space.name, embedding_fn=embedding_fn)
vector_store_connector = VectorStoreConnector(
vector_store_type=CFG.VECTOR_STORE_TYPE,
vector_store_config=config,
Expand Down
5 changes: 4 additions & 1 deletion dbgpt/storage/vector_store/milvus_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,10 @@ def __init__(self, vector_store_config: MilvusVectorConfig) -> None:
bytes_str = self.collection_name.encode("utf-8")
hex_str = bytes_str.hex()
self.collection_name = hex_str

if vector_store_config.embedding_fn is None:
# Perform runtime checks on self.embedding to
# ensure it has been correctly set and loaded
raise ValueError("embedding_fn is required for MilvusStore")
self.embedding: Embeddings = vector_store_config.embedding_fn
self.fields: List = []
self.alias = milvus_vector_config.get("alias") or "default"
Expand Down
Loading