Skip to content

Commit

Permalink
bring back live indexing
Browse files Browse the repository at this point in the history
  • Loading branch information
stripuramallu3 committed Nov 6, 2023
1 parent 6829443 commit a7614ab
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 24 deletions.
45 changes: 21 additions & 24 deletions mirageml/commands/utils/vectordb.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@

from ...constants import (
SERVICE_ID,
SUPABASE_KEY,
SUPABASE_URL,
VECTORDB_CREATE_WEB_COLLECTION,
VECTORDB_DELETE_ENDPOINT,
VECTORDB_LIST_ENDPOINT,
VECTORDB_SEARCH_ENDPOINT,
Expand Down Expand Up @@ -45,29 +44,27 @@ def exists_qdrant_db(collection_name="test"):

def create_remote_qdrant_db(collection_name, link=None, path=None):
user_id = keyring.get_password(SERVICE_ID, "user_id")
console = Console()
with Live(
Panel("Creating Embedding....", title="[bold green]Indexer[/bold green]", border_style="green"),
console=console,
transient=True,
auto_refresh=True,
vertical_overflow="visible",
) as live:
json_data = {
"user_id": user_id,
"collection_name": collection_name,
"url": link,
}
response = requests.post(VECTORDB_CREATE_WEB_COLLECTION, json=json_data, headers=get_headers(), stream=True)
if response.status_code == 200:
for chunk in response.iter_lines():
link = chunk.decode("utf-8")
live.update(Panel(f"{link}", title="[bold green]Indexer[/bold green]", border_style="green"))

json = {
"user_id": user_id,
"collection_name": collection_name,
"link": link,
}
headers = {
"apikey": SUPABASE_KEY,
"Authorization": f"Bearer {keyring.get_password(SERVICE_ID, 'access_token')}",
"Content-Type": "application/json",
"Prefer": "return=minimal",
}
requests.post(
f"{SUPABASE_URL}/rest/v1/user_collection_requests",
json=json,
headers=headers,
)
typer.secho(
f"Creating Remote Source: {collection_name}. You will receive an email once its ready",
fg=typer.colors.GREEN,
bold=True,
)

typer.secho(f"Created Source: {collection_name}", fg=typer.colors.GREEN, bold=True)
set_sources()
return True


Expand Down
1 change: 1 addition & 0 deletions mirageml/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
VECTORDB_CREATE_ENDPOINT = "https://mirageml--vectordb-create-db.modal.run"
VECTORDB_UPSERT_ENDPOINT = "https://mirageml--vectordb-upsert-db.modal.run"
VECTORDB_DELETE_ENDPOINT = "https://mirageml--vectordb-delete-db.modal.run"
VECTORDB_CREATE_WEB_COLLECTION = "https://mirageml--vectordb-create-web-collection.modal.run/"

FINETUNE_CREATE_ENDPOINT = "https://mirageml--finetune-create-model.modal.run"

Expand Down

0 comments on commit a7614ab

Please sign in to comment.