groundx-typescript-sdk
v1.3.32
Published
Client for GroundX APIs
Downloads
381
Readme
EyeLevel's GroundX APIs
RAG Made Simple, Secure and Hallucination Free
Table of Contents
- Installation
- Getting Started
- Reference
groundx.buckets.create
groundx.buckets.delete
groundx.buckets.get
groundx.buckets.list
groundx.buckets.update
groundx.customer.get
groundx.documents.crawlWebsite
groundx.documents.delete
groundx.documents.delete1
groundx.documents.get
groundx.documents.getProcessingStatusById
groundx.documents.ingestLocal
groundx.documents.ingestRemote
groundx.documents.list
groundx.documents.lookup
groundx.groups.addBucket
groundx.groups.create
groundx.groups.delete
groundx.groups.get
groundx.groups.list
groundx.groups.removeBucket
groundx.groups.update
groundx.health.get
groundx.health.list
groundx.search.content
groundx.search.documents
Installation
npm i groundx-typescript-sdk
pnpm i groundx-typescript-sdk
yarn add groundx-typescript-sdk
Getting Started
import { Groundx } from "groundx-typescript-sdk";
const groundx = new Groundx({
// Defining the base path is optional and defaults to https://api.groundx.ai/api
// basePath: "https://api.groundx.ai/api",
apiKey: "API_KEY",
});
const createResponse = await groundx.buckets.create({
name: "your_bucket_name",
});
console.log(createResponse);
Reference
groundx.buckets.create
Create a new bucket.
Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
🛠️ Usage
const createResponse = await groundx.buckets.create({
name: "your_bucket_name",
});
⚙️ Parameters
name: string
🔄 Return
🌐 Endpoint
/v1/bucket
POST
groundx.buckets.delete
Delete a bucket.
Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
🛠️ Usage
const deleteResponse = await groundx.buckets.delete({
bucketId: 1,
});
⚙️ Parameters
bucketId: number
The bucketId of the bucket being deleted.
🔄 Return
🌐 Endpoint
/v1/bucket/{bucketId}
DELETE
groundx.buckets.get
Look up a specific bucket by its bucketId.
Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
🛠️ Usage
const getResponse = await groundx.buckets.get({
bucketId: 1,
});
⚙️ Parameters
bucketId: number
The bucketId of the bucket to look up.
🔄 Return
🌐 Endpoint
/v1/bucket/{bucketId}
GET
groundx.buckets.list
List all buckets within your GroundX account
Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
🛠️ Usage
const listResponse = await groundx.buckets.list({});
⚙️ Parameters
n: number
The maximum number of returned buckets. Accepts 1-100 with a default of 20.
nextToken: string
A token for pagination. If the number of buckets for a given query is larger than n, the response will include a "nextToken" value. That token can be included in this field to retrieve the next batch of n buckets.
🔄 Return
🌐 Endpoint
/v1/bucket
GET
groundx.buckets.update
Rename a bucket.
Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
🛠️ Usage
const updateResponse = await groundx.buckets.update({
bucketId: 1,
newName: "your_bucket_name",
});
⚙️ Parameters
newName: string
The new name of the bucket being renamed.
bucketId: number
The bucketId of the bucket being updated.
🔄 Return
🌐 Endpoint
/v1/bucket/{bucketId}
PUT
groundx.customer.get
Get the account information associated with the API key.
🛠️ Usage
const getResponse = await groundx.customer.get();
🔄 Return
🌐 Endpoint
/v1/customer
GET
groundx.documents.crawlWebsite
Upload the content of a publicly accessible website for ingestion into a GroundX bucket. This is done by following links within a specified URL, recursively, up to a specified depth or number of pages.
Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
🛠️ Usage
const crawlWebsiteResponse = await groundx.documents.crawlWebsite({
websites: [
{
bucketId: 123,
cap: 100,
depth: 3,
sourceUrl: "https://my.website.com",
},
],
});
⚙️ Parameters
websites: WebsiteCrawlRequestWebsitesInner
[]
🔄 Return
🌐 Endpoint
/v1/ingest/documents/website
POST
groundx.documents.delete
Delete multiple documents hosted on GroundX
Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
🛠️ Usage
const deleteResponse = await groundx.documents.delete({
documentIds: ["documentIds_example"],
});
⚙️ Parameters
documentIds: string
[]
A list of documentIds which correspond to documents ingested by GroundX
🔄 Return
🌐 Endpoint
/v1/ingest/documents
DELETE
groundx.documents.delete1
Delete a single document hosted on GroundX
Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
🛠️ Usage
const delete1Response = await groundx.documents.delete1({
documentId: "documentId_example",
});
⚙️ Parameters
documentId: string
A documentId which correspond to a document ingested by GroundX
🔄 Return
🌐 Endpoint
/v1/ingest/document/{documentId}
DELETE
groundx.documents.get
Look up an existing document by documentId.
Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
🛠️ Usage
const getResponse = await groundx.documents.get({
documentId: "documentId_example",
});
⚙️ Parameters
documentId: string
The documentId of the document for which GroundX information will be provided.
🔄 Return
🌐 Endpoint
/v1/ingest/document/{documentId}
GET
groundx.documents.getProcessingStatusById
Get the current status of an ingest, initiated with documents.ingest_remote, documents.ingest_local, or documents.crawl_website, by specifying the processId (the processId is included in the response of the documents.ingest functions).
Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
🛠️ Usage
const getProcessingStatusByIdResponse =
await groundx.documents.getProcessingStatusById({
processId: "processId_example",
});
⚙️ Parameters
processId: string
the processId for the ingest process being checked
🔄 Return
🌐 Endpoint
/v1/ingest/{processId}
GET
groundx.documents.ingestLocal
Upload documents hosted on a local file system for ingestion into a GroundX bucket.
Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
🛠️ Usage
const ingestLocalResponse = await groundx.documents.ingestLocal([
{
blob: fs.readFileSync("/path/to/file"),
metadata: {
bucketId: 1234,
fileName: "my_file.txt",
fileType: "txt",
},
},
]);
⚙️ Request Body
DocumentLocalIngestRequestInner
[]
🔄 Return
🌐 Endpoint
/v1/ingest/documents/local
POST
groundx.documents.ingestRemote
Ingest documents hosted on public URLs to a GroundX bucket.
Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
🛠️ Usage
const ingestRemoteResponse = await groundx.documents.ingestRemote({
documents: [
{
bucketId: 1234,
fileName: "my_file.txt",
fileType: "txt",
sourceUrl: "https://my.source.url.com/file.txt",
},
],
});
⚙️ Parameters
documents: DocumentRemoteIngestRequestDocumentsInner
[]
🔄 Return
🌐 Endpoint
/v1/ingest/documents/remote
POST
groundx.documents.list
lookup all documents across all resources which are currently on GroundX
Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
🛠️ Usage
const listResponse = await groundx.documents.list({
sort: "name",
sortOrder: "asc",
status: "queued",
});
⚙️ Parameters
n: number
The maximum number of returned documents. Accepts 1-100 with a default of 20.
filter: string
Only documents with names that contain the filter string will be returned in the results.
sort: Sort
The document attribute that will be used to sort the results.
sortOrder: SortOrder
The order in which to sort the results. A value for sort must also be set.
status: ProcessingStatus
A status filter on the get documents query. If this value is set, then only documents with this status will be returned in the results.
nextToken: string
A token for pagination. If the number of documents for a given query is larger than n, the response will include a "nextToken" value. That token can be included in this field to retrieve the next batch of n documents.
🔄 Return
🌐 Endpoint
/v1/ingest/documents
GET
groundx.documents.lookup
lookup the document(s) associated with a processId, bucketId, groupId, or projectId.
Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
🛠️ Usage
const lookupResponse = await groundx.documents.lookup({
id: 1,
sort: "name",
sortOrder: "asc",
status: "queued",
});
⚙️ Parameters
id: number
a processId, bucketId, groupId, or projectId
n: number
The maximum number of returned documents. Accepts 1-100 with a default of 20.
filter: string
Only documents with names that contain the filter string will be returned in the results.
sort: Sort
The document attribute that will be used to sort the results.
sortOrder: SortOrder
The order in which to sort the results. A value for sort must also be set.
status: ProcessingStatus
A status filter on the get documents query. If this value is set, then only documents with this status will be returned in the results.
nextToken: string
A token for pagination. If the number of documents for a given query is larger than n, the response will include a "nextToken" value. That token can be included in this field to retrieve the next batch of n documents.
🔄 Return
🌐 Endpoint
/v1/ingest/documents/{id}
GET
groundx.groups.addBucket
Add an existing bucket to an existing group. Buckets and groups can be associated many to many.
Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
🛠️ Usage
const addBucketResponse = await groundx.groups.addBucket({
groupId: 1,
bucketId: 1,
});
⚙️ Parameters
groupId: number
The groupId of the group which the bucket will be added to.
bucketId: number
The bucketId of the bucket being added to the group.
🔄 Return
🌐 Endpoint
/v1/group/{groupId}/bucket/{bucketId}
POST
groundx.groups.create
create a new group, a group being a collection of buckets which can be searched.
Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
🛠️ Usage
const createResponse = await groundx.groups.create({
name: "your_group_name",
bucketName: "your_new_bucket_name",
});
⚙️ Parameters
name: string
The name of the group being created.
bucketName: string
Specify bucketName to automatically create a bucket, by the name specified, and add it to the created group.
🔄 Return
🌐 Endpoint
/v1/group
POST
groundx.groups.delete
Delete a group.
Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
🛠️ Usage
const deleteResponse = await groundx.groups.delete({
groupId: 1,
});
⚙️ Parameters
groupId: number
The groupId of the group to be deleted.
🔄 Return
🌐 Endpoint
/v1/group/{groupId}
DELETE
groundx.groups.get
look up a specific group by its groupId.
Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
🛠️ Usage
const getResponse = await groundx.groups.get({
groupId: 1,
});
⚙️ Parameters
groupId: number
The groupId of the group to look up.
🔄 Return
🌐 Endpoint
/v1/group/{groupId}
GET
groundx.groups.list
list all groups within your GroundX account.
Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
🛠️ Usage
const listResponse = await groundx.groups.list({});
⚙️ Parameters
n: number
The maximum number of returned groups. Accepts 1-100 with a default of 20.
nextToken: string
A token for pagination. If the number of groups for a given query is larger than n, the response will include a "nextToken" value. That token can be included in this field to retrieve the next batch of n groups.
🔄 Return
🌐 Endpoint
/v1/group
GET
groundx.groups.removeBucket
remove a bucket from a group. Buckets and groups can be associated many to many, this removes one bucket to group association without disturbing others.
Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
🛠️ Usage
const removeBucketResponse = await groundx.groups.removeBucket({
groupId: 1,
bucketId: 1,
});
⚙️ Parameters
groupId: number
The groupId of the group which the bucket will be removed from.
bucketId: number
The bucketId of the bucket which will be removed from the group.
🔄 Return
🌐 Endpoint
/v1/group/{groupId}/bucket/{bucketId}
DELETE
groundx.groups.update
Rename a group
Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
🛠️ Usage
const updateResponse = await groundx.groups.update({
groupId: 1,
newName: "your_group_name",
});
⚙️ Parameters
newName: string
The new name of the group being renamed.
groupId: number
The groupId of the group to update.
🔄 Return
🌐 Endpoint
/v1/group/{groupId}
PUT
groundx.health.get
Look up the current health status of a specific service. Statuses update every 5 minutes.
🛠️ Usage
const getResponse = await groundx.health.get({
service: "service_example",
});
⚙️ Parameters
service: string
The name of the service to look up.
🔄 Return
🌐 Endpoint
/v1/health/{service}
GET
groundx.health.list
List the current health status of all services. Statuses update every 5 minutes.
🛠️ Usage
const listResponse = await groundx.health.list();
🔄 Return
🌐 Endpoint
/v1/health
GET
groundx.search.content
Search documents on GroundX for the most relevant information to a given query.
The result of this query is typically used in one of two ways; result['search']['text'] can be used to provide context to a language model, facilitating RAG, or result['search']['results'] can be used to observe chunks of text which are relevant to the query, facilitating citation.
Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
🛠️ Usage
const contentResponse = await groundx.search.content({
id: null,
n: 20,
nextToken: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9",
query: "my search query",
relevance: 10,
});
⚙️ Parameters
query: string
The search query to be used to find relevant documentation.
id: SearchContentIdParameter
The bucketId, groupId, projectId, or documentId to be searched. The document or documents within the specified container will be compared to the query, and relevant information will be extracted.
relevance: number
The minimum search relevance score required to include the result. By default, this is 10.0.
n: number
The maximum number of returned search results. Accepts 1-100 with a default of 20.
nextToken: string
A token for pagination. If the number of search results for a given query is larger than n, the response will include a "nextToken" value. That token can be included in this field to retrieve the next batch of n search results.
verbosity: number
The amount of data returned with each search result. 0 == no search results, only the recommended context. 1 == search results but no searchData. 2 == search results and searchData.
🔄 Return
🌐 Endpoint
/v1/search/{id}
POST
groundx.search.documents
Search documents on GroundX for the most relevant information to a given query by documentId(s).
The result of this query is typically used in one of two ways; result['search']['text'] can be used to provide context to a language model, facilitating RAG, or result['search']['results'] can be used to observe chunks of text which are relevant to the query, facilitating citation.
Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
🛠️ Usage
const documentsResponse = await groundx.search.documents({
n: 20,
nextToken: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9",
query: "my search query",
documentIds: ["docUUID1", "docUUID2"],
relevance: 10,
});
⚙️ Parameters
query: string
The search query to be used to find relevant documentation.
documentIds: string
[]
An array of unique documentIds to be searched.
relevance: number
The minimum search relevance score required to include the result. By default, this is 10.0.
n: number
The maximum number of returned search results. Accepts 1-100 with a default of 20.
nextToken: string
A token for pagination. If the number of search results for a given query is larger than n, the response will include a "nextToken" value. That token can be included in this field to retrieve the next batch of n search results.
verbosity: number
The amount of data returned with each search result. 0 == no search results, only the recommended context. 1 == search results but no searchData. 2 == search results and searchData.
🔄 Return
🌐 Endpoint
/v1/search/documents
POST
Author
This TypeScript package is automatically generated by Konfig