mirror of
https://github.com/VectifyAI/PageIndex.git
synced 2026-07-24 21:41:04 +02:00
fix: exit with a clear message when PAGEINDEX_API_KEY is unset in cloud demo
This commit is contained in:
parent
4ffc6b5c0c
commit
a84d88b4ce
1 changed files with 5 additions and 1 deletions
|
|
@ -14,6 +14,7 @@ Requirements:
|
|||
"""
|
||||
import asyncio
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
import requests
|
||||
from pageindex import CloudClient
|
||||
|
|
@ -34,7 +35,10 @@ if not PDF_PATH.exists():
|
|||
f.write(chunk)
|
||||
print("Download complete.\n")
|
||||
|
||||
client = CloudClient(api_key=os.environ["PAGEINDEX_API_KEY"])
|
||||
api_key = os.environ.get("PAGEINDEX_API_KEY")
|
||||
if not api_key:
|
||||
sys.exit("PAGEINDEX_API_KEY not set — get a key at https://dash.pageindex.ai")
|
||||
client = CloudClient(api_key=api_key)
|
||||
collection = client.collection()
|
||||
|
||||
doc_id = collection.add(str(PDF_PATH))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue