📝 Add docstrings to feat/chunking - #172
Conversation
Docstrings generation was requested by @Ahmath-Gadji. * #165 (comment) The following files were modified: * `openrag/components/indexer/chunker/chunker.py` * `openrag/components/indexer/chunker/test_chunking.py` * `openrag/components/indexer/chunker/utils.py` * `openrag/components/indexer/embeddings/openai.py` * `openrag/components/indexer/loaders/base.py` * `openrag/components/indexer/vectordb/vectordb.py` * `openrag/components/pipeline.py` * `openrag/components/retriever.py` * `openrag/components/utils.py`
|
Important Review skippedCodeRabbit bot authored PR detected. To trigger a single review, invoke the You can disable this status message by setting the Comment |
There was a problem hiding this comment.
Gates Failed
Prevent hotspot decline
(1 hotspot with Complex Method)
Enforce advisory code health rules
(1 file with Complex Method)
Gates Passed
4 Quality Gates Passed
See analysis details in CodeScene
Reason for failure
| Prevent hotspot decline | Violations | Code Health Impact | |
|---|---|---|---|
| vectordb.py | 1 rule in this hotspot | 7.08 → 6.92 | Suppress |
| Enforce advisory code health rules | Violations | Code Health Impact | |
|---|---|---|---|
| vectordb.py | 1 advisory rule | 7.08 → 6.92 | Suppress |
Quality Gate Profile: Pay Down Tech Debt
Want more control? Customize Code Health rules or catch issues early with our IDE extension and CLI tool.
| """ | ||
| Perform a nearest-neighbor search for the given text query in the collection and return matching Documents. | ||
|
|
||
| Parameters: | ||
| query (str): Text query to search for. | ||
| top_k (int): Maximum number of results to return per search. | ||
| similarity_threshold (float): Cosine similarity radius used to filter results; higher values require closer matches. | ||
| partition (list[str] | None): List of partition names to restrict the search to, or ["all"] to search every partition. | ||
| filter (Optional[dict]): Mapping of field names to values; each pair is applied as an equality condition in the search expression. | ||
| with_surrounding_chunks (bool): If True, include neighboring chunks (previous/next sections) of matched documents in the results. | ||
|
|
||
| Returns: | ||
| list[Document]: Matching Documents from the vector store; when `with_surrounding_chunks` is True, includes additional surrounding chunk Documents. | ||
|
|
||
| Raises: | ||
| VDBSearchError: If the underlying Milvus search fails. | ||
| EmbeddingError: If query embedding fails. | ||
| UnexpectedVDBError: For any other unexpected errors during the search. | ||
| """ |
There was a problem hiding this comment.
❌ Getting worse: Complex Method
MilvusDB.async_search already has high cyclomatic complexity, and now it increases in Lines of Code from 89 to 105
Docstrings generation was requested by @Ahmath-Gadji.
The following files were modified:
openrag/components/indexer/chunker/chunker.pyopenrag/components/indexer/chunker/test_chunking.pyopenrag/components/indexer/chunker/utils.pyopenrag/components/indexer/embeddings/openai.pyopenrag/components/indexer/loaders/base.pyopenrag/components/indexer/vectordb/vectordb.pyopenrag/components/pipeline.pyopenrag/components/retriever.pyopenrag/components/utils.pyThese file types are not supported
.hydra_config/config.yaml.hydra_config/rag/ChatBotRag.yaml.hydra_config/rag/SimpleRag.yaml.hydra_config/rag/base.yaml.hydra_config/retriever/base.yamldocker-compose.yamldocs/content/docs/documentation/env_vars.mdprompts/example1/chunk_contextualizer_tmpl.txtpytest.iniquick_start/docker-compose.yamlℹ️ Note