Skip to content

Instantly share code, notes, and snippets.

@cdxker
Last active February 20, 2024 01:53
Show Gist options
  • Save cdxker/a184d6b38493c88e2ddc7e40eaed71a6 to your computer and use it in GitHub Desktop.
Save cdxker/a184d6b38493c88e2ddc7e40eaed71a6 to your computer and use it in GitHub Desktop.
How to reindex collection if qdrant point id's get lost, or to change the embedding model.
import os
import csv
from trieve_client import AuthenticatedClient
from trieve_client.api.chunk import update_chunk
from trieve_client.models import UpdateChunkData, ReturnCreatedChunk
from trieve_client.models.error_response_body import ErrorResponseBody
api_key = "tr-XXXXXXXXXXXXXXXXXXXXXXXXXXX"
client = AuthenticatedClient(base_url="https://api.trieve.ai", prefix="", token=api_key)
with client as client:
with open("files_to_index.csv") as f:
reader = csv.DictReader(f)
for i, row in enumerate(reader):
chunk_id = row["id"]
dataset = row["dataset_id"]
response = update_chunk.sync(body=UpdateChunkData(chunk_uuid=chunk_id), client=client, tr_dataset=dataset)
print(i, response)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment