Quick Start
This Quick Start guide is intended to show you how to upload documents and search them using the GroundX APIs. The code within this QuickStart guide can be downloaded from the code samples GitHub repository in Python and TypeScript.
Step 1: Download GroundX SDK (optional)
This step is optional. Do this step only if you want to use our TypeScript (for javascript and NodeJS projects) or Python SDKs.
Use the following shell commands to install:
Step 2: Register and Get Your API Key
Before you can use our APIs, you will need to create an account here.
Log into the GroundX Dashboard and navigate to API Keys.
Copy your API Key and save it somewhere for use later in this tutorial.
Step 3: Initialize Your SDK (optional)
If you're using one of our SDKs, you will use your API key to initialize your client:
Replace groundxKey
with your GroundX API key.
Step 4: Make Your First Request
All of our API requests require your API Key in the header. Here is an example of how to include it:
For bash requests, replace <your_api_key> with your actual API key.
If your request is successful, you will receive a response that looks something like this:
This request will return a list of your content buckets where you can upload your documents. Make note of the bucketId
for use later in this tutorial.
Step 5: Upload Content
To upload document content, use the Document Upload API:
Replace ingestLocal
with the path to your local file, ingestHosted
to the URL of your hosted file, fileType
with one of the enumerated file types (e.g. txt, pdf), fileName
with a name for your file, and bucketId
with the content bucket you would like to add the document to.
If your request is successful, will receive a response that looks something like this:
Make note of processId
. You will need it in the next step of this Quick Start guide.
Step 6: Check the Status of Your Upload
Make the following request to query the status of your document upload as it is processed through the GroundX ingestion pipeline:
Replace processId
the processId from the previous step.
If your request is successful, will receive a response that looks something like this:
The value of status
will be one of queued
, processing
, error
, or complete
.
Step 7: Search Your Content
Make the following request to search your ingested content:
You can also use projectId
or groupId
in place of bucketId
in your search query. Any of the 3 values will work for search queries. Replace query
with the query you want to use to search your content.
If your request is successful, will receive a response that looks something like this:
We strongly recommend you use search.text
for your LLM completions. We provide search.results
in case you want to create your own context from the search results. If you choose to do this, rather than use search.text
, we strongly recommend you use search.results[n].suggestedText
for your context.
If you need to look up a projectId
, groupId
, or bucketId
, you can find them in the GroundX Dashboard or by querying for them using the APIs.
Make the following request to query for your projects:
If your request is successful, will receive a response that looks something like this:
Next Steps
Now that you've successfully used the GroundX APIs to upload and search content, you can dive into our tutorials and documentation!
Remember, our APIs are still in closed beta, so we appreciate your patience and feedback as we continue to improve our service.