Skip to content
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

adapt storage of metadate in qdrant #25

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/slackbot/ai_fcts.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
client=QdrantClient(url=qdrant_uri, port=6333),
collection_name=qdrant_collection_name,
content_payload_key="content",
metadata_payload_key=None,
metadata_payload_key="metadata",
distance_strategy="Cosine",
embeddings=InfinityEmbeddings(model=infinity_model, infinity_api_url=infinity_api_url)
)
Expand Down Expand Up @@ -80,7 +80,7 @@
def format_docs(docs):
context = ""
for index, doc in enumerate(docs):
context += f"Document Rank {index + 1}: {doc.page_content}\n\n"
context += f"Document Rank {index + 1}. Source: https://www.notion.so/{doc.metadata['page_id']}. Content: {doc.page_content}\n\n"
return context

# create function to invoke the retrievalQA
Expand Down
6 changes: 3 additions & 3 deletions apps/vectordb_sync/vectordb_sync_fcts.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def notion_to_qdrant(id_to_process) -> None:

points_to_update = [PointStruct(id=str(uuid.uuid4()),
vector=chunk_embedding,
payload={"content": chunk, "page_id": id_to_process, "type": "notion"}) for chunk_embedding, chunk in zip(chunks_embedded, chunks)]
payload={"content": chunk, "metadata":{"page_id": id_to_process, "type": "notion"}}) for chunk_embedding, chunk in zip(chunks_embedded, chunks)]



Expand Down Expand Up @@ -179,7 +179,7 @@ def web_to_qdrant(id_to_process):
# Insert the preprocessed chunk into Qdrant
points_to_update = [PointStruct(id=str(uuid.uuid4()),
vector=chunk_embedding,
payload={"content": chunk, "page_id": id_to_process, "type": "web"}) for
payload={"content": chunk, "metadata":{"page_id": id_to_process, "type": "web"}}) for
chunk_embedding, chunk in zip(chunks_embedded, chunks)]

qdrant_client.upsert(
Expand Down Expand Up @@ -258,7 +258,7 @@ def slack_to_qdrant(id_to_process):

points_to_update = [PointStruct(id=str(uuid.uuid4()),
vector=chunk_embedding,
payload={"content": chunk, "page_id": id_to_process, "type": "slack"}) for chunk_embedding, chunk in zip(chunks_embedded, chunks)]
payload={"content": chunk, "metadata":{"page_id": id_to_process, "type": "slack"}}) for chunk_embedding, chunk in zip(chunks_embedded, chunks)]



Expand Down
Loading