fixed lint
Browse files- examples/test_chromadb.py +3 -1
- lightrag/kg/chroma_impl.py +6 -2
- lightrag/types.py +1 -1
examples/test_chromadb.py
CHANGED
|
@@ -17,7 +17,9 @@ if not os.path.exists(WORKING_DIR):
|
|
| 17 |
# ChromaDB Configuration
|
| 18 |
CHROMADB_USE_LOCAL_PERSISTENT = False
|
| 19 |
# Local PersistentClient Configuration
|
| 20 |
-
CHROMADB_LOCAL_PATH = os.environ.get(
|
|
|
|
|
|
|
| 21 |
# Remote HttpClient Configuration
|
| 22 |
CHROMADB_HOST = os.environ.get("CHROMADB_HOST", "localhost")
|
| 23 |
CHROMADB_PORT = int(os.environ.get("CHROMADB_PORT", 8000))
|
|
|
|
| 17 |
# ChromaDB Configuration
|
| 18 |
CHROMADB_USE_LOCAL_PERSISTENT = False
|
| 19 |
# Local PersistentClient Configuration
|
| 20 |
+
CHROMADB_LOCAL_PATH = os.environ.get(
|
| 21 |
+
"CHROMADB_LOCAL_PATH", os.path.join(WORKING_DIR, "chroma_data")
|
| 22 |
+
)
|
| 23 |
# Remote HttpClient Configuration
|
| 24 |
CHROMADB_HOST = os.environ.get("CHROMADB_HOST", "localhost")
|
| 25 |
CHROMADB_PORT = int(os.environ.get("CHROMADB_PORT", 8000))
|
lightrag/kg/chroma_impl.py
CHANGED
|
@@ -67,7 +67,9 @@ class ChromaVectorDBStorage(BaseVectorStorage):
|
|
| 67 |
|
| 68 |
if "token_authn" in auth_provider:
|
| 69 |
headers = {
|
| 70 |
-
config.get(
|
|
|
|
|
|
|
| 71 |
}
|
| 72 |
elif "basic_authn" in auth_provider:
|
| 73 |
auth_credentials = config.get("auth_credentials", "admin:admin")
|
|
@@ -154,7 +156,9 @@ class ChromaVectorDBStorage(BaseVectorStorage):
|
|
| 154 |
embedding = await self.embedding_func([query])
|
| 155 |
|
| 156 |
results = self._collection.query(
|
| 157 |
-
query_embeddings=embedding.tolist()
|
|
|
|
|
|
|
| 158 |
n_results=top_k * 2, # Request more results to allow for filtering
|
| 159 |
include=["metadatas", "distances", "documents"],
|
| 160 |
)
|
|
|
|
| 67 |
|
| 68 |
if "token_authn" in auth_provider:
|
| 69 |
headers = {
|
| 70 |
+
config.get(
|
| 71 |
+
"auth_header_name", "X-Chroma-Token"
|
| 72 |
+
): auth_credentials
|
| 73 |
}
|
| 74 |
elif "basic_authn" in auth_provider:
|
| 75 |
auth_credentials = config.get("auth_credentials", "admin:admin")
|
|
|
|
| 156 |
embedding = await self.embedding_func([query])
|
| 157 |
|
| 158 |
results = self._collection.query(
|
| 159 |
+
query_embeddings=embedding.tolist()
|
| 160 |
+
if not isinstance(embedding, list)
|
| 161 |
+
else embedding,
|
| 162 |
n_results=top_k * 2, # Request more results to allow for filtering
|
| 163 |
include=["metadatas", "distances", "documents"],
|
| 164 |
)
|
lightrag/types.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
from __future__ import annotations
|
| 2 |
|
| 3 |
from pydantic import BaseModel
|
| 4 |
-
from typing import
|
| 5 |
|
| 6 |
|
| 7 |
class GPTKeywordExtractionFormat(BaseModel):
|
|
|
|
| 1 |
from __future__ import annotations
|
| 2 |
|
| 3 |
from pydantic import BaseModel
|
| 4 |
+
from typing import Any, Optional
|
| 5 |
|
| 6 |
|
| 7 |
class GPTKeywordExtractionFormat(BaseModel):
|