Merge pull request 'Handle missing pgvector tables on first run' (#29) from refactor/chromadb-to-pgvector into main
Reviewed-on: #29
This commit was merged in pull request #29.
This commit is contained in:
+11
-7
@@ -59,13 +59,17 @@ text_splitter = RecursiveCharacterTextSplitter(
|
|||||||
def _get_collection_id():
|
def _get_collection_id():
|
||||||
"""Get the UUID of our collection from the langchain_pg_collection table."""
|
"""Get the UUID of our collection from the langchain_pg_collection table."""
|
||||||
engine = _get_engine()
|
engine = _get_engine()
|
||||||
with engine.connect() as conn:
|
try:
|
||||||
result = conn.execute(
|
with engine.connect() as conn:
|
||||||
text("SELECT uuid FROM langchain_pg_collection WHERE name = :name"),
|
result = conn.execute(
|
||||||
{"name": "simba_docs"},
|
text("SELECT uuid FROM langchain_pg_collection WHERE name = :name"),
|
||||||
)
|
{"name": "simba_docs"},
|
||||||
row = result.fetchone()
|
)
|
||||||
return row[0] if row else None
|
row = result.fetchone()
|
||||||
|
return row[0] if row else None
|
||||||
|
except Exception:
|
||||||
|
# Table doesn't exist yet (first run before any indexing)
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
def date_to_epoch(date_str: str) -> float:
|
def date_to_epoch(date_str: str) -> float:
|
||||||
|
|||||||
Reference in New Issue
Block a user