Skip to content

Conversation

mikumifa
Copy link
Contributor

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.

@dosubot dosubot bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label May 20, 2025
@github-actions github-actions bot added the llm label May 20, 2025
@dosubot dosubot bot added the enhancement New feature or request label May 20, 2025
@mikumifa
Copy link
Contributor Author

All unit tests have passed
Manual testing of the web interface and its functionalities showed no issues.

@imbajin imbajin requested a review from Copilot May 21, 2025 02:49
Copy link

@Copilot Copilot AI left a 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.

@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. and removed size:XL This PR changes 500-999 lines, ignoring generated files. labels May 21, 2025
@mikumifa
Copy link
Contributor Author

  • step 5 is the settings conf
    image
  • Updated the way configuration values are loaded in the UI. with dynamic value loading using a lambda function. This ensures that updated settings are dynamically reflected after refresh.
gr.Textbox(value=llm_settings.reranker_api_key, label="api_key", type="password") # old
gr.Textbox(value=lambda: llm_settings.reranker_api_key, label="api_key", type="password") #new
  • Added index_settings, Values will be saved into the .env file for persistence.
  • Manually tested rag and text2gremlin_block. both components are functioning correctly after changes.
  • Added a now_vector_index field to the get_vector_index_info() method. Displays the currently selected vector index database.

@imbajin
Copy link
Member

imbajin commented May 22, 2025

Thanks, we have already switched to uv now (need update deps for it)

@mikumifa
Copy link
Contributor Author

already switched to uv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request llm size:XXL This PR changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants