-
Notifications
You must be signed in to change notification settings - Fork 60
Add mypy & ruff configs, fix type issues, add assertions, and initial vector DB CRUD with tests #246
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
base: main
Are you sure you want to change the base?
Conversation
All unit tests have passed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces several development improvements by adding type-checking and linting configurations, fixing misleading type annotations, adding runtime assertions, and implementing initial CRUD operations for vector databases with tests. Key changes include:
- Adding mypy and ruff configuration files and updating dependencies.
- Fixing type annotation issues and introducing assert statements for runtime safety.
- Replacing the generic VectorIndex with concrete implementations (e.g. FaissVectorIndex) across multiple modules.
Reviewed Changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
hugegraph_llm/src/hugegraph_llm/operators/kg_construction_task.py | Updated type annotations and added runtime assertions. |
hugegraph_llm/src/hugegraph_llm/operators/index_op/vector_index_query.py | Switched to FaissVectorIndex and added an assert with error message for query. |
hugegraph_llm/src/hugegraph_llm/operators/index_op/semantic_id_query.py | Updated index usage to FaissVectorIndex and adjusted formatting. |
hugegraph_llm/src/hugegraph_llm/operators/index_op/gremlin_example_index_query.py | Enhanced type hints and updated index initialization. |
hugegraph_llm/src/hugegraph_llm/operators/index_op/build_vector_index.py | Updated index instantiation to use FaissVectorIndex. |
hugegraph_llm/src/hugegraph_llm/operators/index_op/build_semantic_index.py | Updated index instantiation and integrated asynchronous embedding retrieval. |
hugegraph_llm/src/hugegraph_llm/operators/index_op/build_gremlin_example_index.py | Updated index instantiation to use FaissVectorIndex. |
hugegraph_llm/src/hugegraph_llm/operators/hugegraph_op/schema_manager.py | Minor improvements in dict formatting and type ignore usage. |
hugegraph_llm/src/hugegraph_llm/indices/vector_index/qdrant_vector_store.py | Added new Qdrant vector index implementation. |
hugegraph_llm/src/hugegraph_llm/indices/vector_index/milvus_vector_store.py | Added new Milvus vector index implementation. |
hugegraph_llm/src/hugegraph_llm/indices/vector_index/faiss_vector_store.py | Updated file handling and type annotations for FaissVectorIndex. |
hugegraph_llm/src/hugegraph_llm/indices/vector_index/base.py | Added an abstract base class for vector stores. |
hugegraph_llm/src/hugegraph_llm/indices/graph_index.py | Reformatted client instantiation for clarity. |
hugegraph_llm/src/hugegraph_llm/demo/rag_demo/app.py | Minor adjustments including assert modifications and type ignore hint. |
hugegraph_llm/src/hugegraph_llm/config/llm_config.py | Reordered import statements and maintained type consistency. |
hugegraph_llm/src/hugegraph_llm/config/index_config.py | New configuration file for vector index settings. |
hugegraph_llm/src/hugegraph_llm/config/hugegraph_config.py | Updated graph configuration to use non-optional types for mandatory values. |
hugegraph_llm/src/hugegraph_llm/config/init.py | Initialized index_settings and reorganized config imports. |
hugegraph-llm/requirements.txt | Added pymilvus and qdrant-client dependencies. |
hugegraph-llm/pyproject.toml | Introduced mypy and ruff configuration settings. |
Thanks, we have already switched to uv now (need update deps for it) |
already switched to uv |
This PR includes several development improvements and code updates:
Added mypy and ruff configuration files to support type checking and code style enforcement. These can be removed if not needed.
Fixed type annotation issues, such as cases like graph_url: Optional[str] = "127.0.0.1:8080", where using Optional is misleading because the value will never be None.
Added assert statements to guard against None where necessary for better runtime safety.
Implemented initial CRUD operations for several vector databases and added corresponding test cases. Integration is not yet done to keep this PR smaller and easier to review—full integration will follow in a separate PR.