-
Notifications
You must be signed in to change notification settings - Fork 1
add support for Qdrant cloud & fix path to run project from inside folder #2
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| QDRANT_API_KEY= | ||
| QDRANT_URL= |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,5 +1,5 @@ | ||||||||||
| """Public package surface for the standalone Qdrant cleaner.""" | ||||||||||
| from .cleaner import QdrantCleaner | ||||||||||
| from .cleaner_cli import QdrantCleanerCLI | ||||||||||
| from cleaner import QdrantCleaner | ||||||||||
| from cleaner_cli import QdrantCleanerCLI | ||||||||||
|
Comment on lines
+2
to
+3
|
||||||||||
| from cleaner import QdrantCleaner | |
| from cleaner_cli import QdrantCleanerCLI | |
| from .cleaner import QdrantCleaner | |
| from .cleaner_cli import QdrantCleanerCLI |
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2,7 +2,7 @@ | |||||||||||
|
|
||||||||||||
| from __future__ import annotations | ||||||||||||
|
|
||||||||||||
| from .cleaner_cli import QdrantCleanerCLI | ||||||||||||
| from cleaner_cli import QdrantCleanerCLI | ||||||||||||
|
||||||||||||
| from cleaner_cli import QdrantCleanerCLI | |
| try: | |
| from .cleaner_cli import QdrantCleanerCLI | |
| except ImportError: | |
| from cleaner_cli import QdrantCleanerCLI |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,8 +10,8 @@ | |
| from typing import Any, Dict, List, Optional, Tuple | ||
| from urllib.parse import urlparse | ||
|
|
||
| from .config import CANONICAL_TEXT_FIELDS | ||
| from .dependencies import ( | ||
| from config import CANONICAL_TEXT_FIELDS, QDRANT_API_KEY | ||
| from dependencies import ( | ||
|
Comment on lines
+13
to
+14
|
||
| CuMLDBSCAN, | ||
| GPU_CLUSTERING_AVAILABLE, | ||
| IsolationForest, | ||
|
|
@@ -31,16 +31,25 @@ | |
| class QdrantCleaner: | ||
| """Collection cleaning utilities""" | ||
|
|
||
| def __init__(self, host="localhost", port=6333): | ||
| def __init__(self, host="localhost", port=6333, api_key=None): | ||
| if QdrantClient is None: | ||
| raise ImportError("qdrant-client required") | ||
|
|
||
| if host.startswith("http://") or host.startswith("https://"): | ||
| parsed = urlparse(host) | ||
| host = parsed.hostname | ||
| port = parsed.port or port | ||
|
|
||
| self.client = QdrantClient(host=host, port=int(port)) | ||
|
|
||
| api_key = api_key or QDRANT_API_KEY | ||
|
|
||
| # Use 'url' parameter for HTTPS/cloud, 'host'+'port' for local HTTP | ||
| if host.startswith("https://"): | ||
| client_kwargs = {"url": host} | ||
| if api_key: | ||
| client_kwargs["api_key"] = api_key | ||
| elif host.startswith("http://"): | ||
| client_kwargs = {"url": host} | ||
| else: | ||
| client_kwargs = {"host": host, "port": int(port)} | ||
| if api_key: | ||
| client_kwargs["api_key"] = api_key | ||
|
|
||
| self.client = QdrantClient(**client_kwargs) | ||
| self.collection_name = None | ||
| self.has_optimize_method = hasattr(self.client, 'optimize_collection') | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -5,8 +5,8 @@ | |||||||||||||||||
| from typing import Any, Dict, List, Optional | ||||||||||||||||||
| from urllib.parse import urlparse | ||||||||||||||||||
|
|
||||||||||||||||||
| from .cleaner import QdrantCleaner | ||||||||||||||||||
| from .config import QDRANT_DIRECT | ||||||||||||||||||
| from cleaner import QdrantCleaner | ||||||||||||||||||
| from config import QDRANT_DIRECT, QDRANT_API_KEY | ||||||||||||||||||
|
Comment on lines
+8
to
+9
|
||||||||||||||||||
| from cleaner import QdrantCleaner | |
| from config import QDRANT_DIRECT, QDRANT_API_KEY | |
| try: | |
| from .cleaner import QdrantCleaner | |
| from .config import QDRANT_DIRECT, QDRANT_API_KEY | |
| except ImportError: | |
| from cleaner import QdrantCleaner | |
| from config import QDRANT_DIRECT, QDRANT_API_KEY |
Copilot
AI
Apr 10, 2026
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.
_set_qdrant_url() parses the URL but then passes only parsed.hostname into QdrantCleaner. For https://...cloud.qdrant.io this strips the scheme, so QdrantCleaner won’t take the HTTPS/cloud path and will instead try host=<domain>, port=6333, which is incorrect for Qdrant Cloud. Pass the full URL (including scheme) through to QdrantCleaner, or preserve the scheme when building the endpoint so HTTPS + API key works.
| host = parsed.hostname or "localhost" | |
| port = parsed.port or 6333 | |
| if parsed.scheme and parsed.hostname: | |
| host = qdrant_url | |
| port = parsed.port or 6333 | |
| else: | |
| host = parsed.hostname or "localhost" | |
| port = parsed.port or 6333 |
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.
The README now instructs running
python __main__.py, but the rest of the README still presents this as an importable package (qdrant_manager.*surface andfrom qdrant_manager import QdrantCleaner). These two modes require different import structures; as written, the docs are internally inconsistent and will likely confuse users. Please align the run instructions with the supported execution mode (e.g. preferpython -m qdrant_managerfor package usage, or update the package-surface/programmatic examples if the project is moving to a script-only layout).