Client for GroundX API
Project description
Table of Contents
- Requirements
- Installation
- Getting Started
- Async
- Reference
groundx.buckets.create
groundx.buckets.delete
groundx.buckets.get
groundx.buckets.list
groundx.buckets.update
groundx.documents.crawl_website
groundx.documents.delete
groundx.documents.delete1
groundx.documents.get
groundx.documents.get_processing_status_by_id
groundx.documents.list
groundx.documents.lookup
groundx.documents.upload_local
groundx.documents.upload_remote
groundx.health.get
groundx.health.list
groundx.projects.add_bucket
groundx.projects.create
groundx.projects.delete
groundx.projects.get
groundx.projects.list
groundx.projects.remove_bucket
groundx.projects.update
groundx.search.content
Requirements
Python >=3.7
Installation
pip install groundx-python-sdk==1.3.18
Getting Started
from pprint import pprint
from groundx import Groundx, ApiException
groundx = Groundx(
api_key="YOUR_API_KEY",
)
try:
# create
create_response = groundx.buckets.create(
name="your_bucket_name",
)
pprint(create_response.body)
pprint(create_response.body["bucket"])
pprint(create_response.headers)
pprint(create_response.status)
pprint(create_response.round_trip_time)
except ApiException as e:
print("Exception when calling BucketsApi.create: %s\n" % e)
pprint(e.body)
pprint(e.headers)
pprint(e.status)
pprint(e.reason)
pprint(e.round_trip_time)
Async
async
support is available by prepending a
to any method.
import asyncio
from pprint import pprint
from groundx import Groundx, ApiException
groundx = Groundx(
api_key="YOUR_API_KEY",
)
async def main():
try:
# create
create_response = await groundx.buckets.acreate(
name="your_bucket_name",
)
pprint(create_response.body)
pprint(create_response.body["bucket"])
pprint(create_response.headers)
pprint(create_response.status)
pprint(create_response.round_trip_time)
except ApiException as e:
print("Exception when calling BucketsApi.create: %s\n" % e)
pprint(e.body)
pprint(e.headers)
pprint(e.status)
pprint(e.reason)
pprint(e.round_trip_time)
asyncio.run(main())
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
create_response = groundx.buckets.create(
name="your_bucket_name",
)
โ๏ธ Parameters
name: str
โ๏ธ Request Body
๐ Return
๐ Endpoint
/v1/bucket
post
๐ Back to Table of Contents
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
delete_response = groundx.buckets.delete(
bucket_id=1,
)
โ๏ธ Parameters
bucket_id: int
The bucketId of the bucket being deleted.
๐ Return
๐ Endpoint
/v1/bucket/{bucketId}
delete
๐ Back to Table of Contents
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
get_response = groundx.buckets.get(
bucket_id=1,
)
โ๏ธ Parameters
bucket_id: int
The bucketId of the bucket to look up.
๐ Return
๐ Endpoint
/v1/bucket/{bucketId}
get
๐ Back to Table of Contents
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
list_response = groundx.buckets.list(
n=1,
next_token="string_example",
)
โ๏ธ Parameters
n: int
The maximum number of returned documents. Accepts 1-100 with a default of 20.
next_token: str
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/bucket
get
๐ Back to Table of Contents
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
update_response = groundx.buckets.update(
new_name="your_bucket_name",
bucket_id=1,
)
โ๏ธ Parameters
new_name: str
The new name of the bucket being renamed.
bucket_id: int
The bucketId of the bucket being updated.
โ๏ธ Request Body
๐ Return
๐ Endpoint
/v1/bucket/{bucketId}
put
๐ Back to Table of Contents
groundx.documents.crawl_website
Upload the content of a publicly accessible website to 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
crawl_website_response = groundx.documents.crawl_website(
websites=[
{
"bucket_id": 123,
"cap": 100,
"depth": 3,
"source_url": "https://my.website.com",
}
],
)
โ๏ธ Parameters
websites: WebsiteCrawlRequestWebsites
โ๏ธ Request Body
๐ Return
๐ Endpoint
/v1/ingest/documents/website
post
๐ Back to Table of Contents
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
delete_response = groundx.documents.delete(
document_ids=["documentIds_example"],
)
โ๏ธ Parameters
document_ids: List[str
]
A list of documentIds which correspond to documents uploaded to GroundX
๐ Return
๐ Endpoint
/v1/ingest/documents
delete
๐ Back to Table of Contents
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
delete1_response = groundx.documents.delete1(
document_id="documentId_example",
)
โ๏ธ Parameters
document_id: str
A documentId which correspond to a document uploaded to GroundX
๐ Return
๐ Endpoint
/v1/ingest/document/{documentId}
delete
๐ Back to Table of Contents
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
get_response = groundx.documents.get(
document_id="documentId_example",
)
โ๏ธ Parameters
document_id: str
The documentId of the document for which GroundX information will be provided.
๐ Return
๐ Endpoint
/v1/ingest/document/{documentId}
get
๐ Back to Table of Contents
groundx.documents.get_processing_status_by_id
Get the current status of an upload, initiated with documents.upload_remote, documents.upload_local, or documents.crawl_website, by specifying the processId (the processId is included in the response of the documents.upload 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
get_processing_status_by_id_response = groundx.documents.get_processing_status_by_id(
process_id="processId_example",
)
โ๏ธ Parameters
process_id: str
the processId for the upload process being checked
๐ Return
๐ Endpoint
/v1/ingest/{processId}
get
๐ Back to Table of Contents
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
list_response = groundx.documents.list(
n=1,
filter="string_example",
sort="name",
sort_order="asc",
status="queued",
next_token="string_example",
)
โ๏ธ Parameters
n: int
The maximum number of returned documents. Accepts 1-100 with a default of 20.
filter: str
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.
sort_order: 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.
next_token: str
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
๐ Back to Table of Contents
groundx.documents.lookup
lookup the document(s) associated with a processId, bucketId, 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
lookup_response = groundx.documents.lookup(
id=1,
n=1,
filter="string_example",
sort="name",
sort_order="asc",
status="queued",
next_token="string_example",
)
โ๏ธ Parameters
id: int
a processId, bucketId, or projectId
n: int
The maximum number of returned documents. Accepts 1-100 with a default of 20.
filter: str
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.
sort_order: 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.
next_token: str
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
๐ Back to Table of Contents
groundx.documents.upload_local
Upload documents hosted on a local file system 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
upload_local_response = groundx.documents.upload_local(
body=[
{
"blob": open("/path/to/file", "rb"),
"metadata": {
"bucket_id": 1234,
"file_name": "my_file.txt",
"file_type": "txt",
},
}
],
)
โ๏ธ Request Body
๐ Return
๐ Endpoint
/v1/ingest/documents/local
post
๐ Back to Table of Contents
groundx.documents.upload_remote
Upload 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
upload_remote_response = groundx.documents.upload_remote(
documents=[
{
"bucket_id": 1234,
"file_name": "my_file.txt",
"file_type": "txt",
"source_url": "https://my.source.url.com/file.txt",
}
],
)
โ๏ธ Parameters
documents: DocumentRemoteUploadRequestDocuments
โ๏ธ Request Body
๐ Return
๐ Endpoint
/v1/ingest/documents/remote
post
๐ Back to Table of Contents
groundx.health.get
Look up the current health status of a specific service. Statuses update every 5 minutes.
๐ ๏ธ Usage
get_response = groundx.health.get(
service="search",
)
โ๏ธ Parameters
service: str
The name of the service to look up.
๐ Return
๐ Endpoint
/v1/health/{service}
get
๐ Back to Table of Contents
groundx.health.list
List the current health status of all services. Statuses update every 5 minutes.
๐ ๏ธ Usage
list_response = groundx.health.list()
๐ Return
๐ Endpoint
/v1/health
get
๐ Back to Table of Contents
groundx.projects.add_bucket
Add an existing bucket to an existing project. Buckets and projects 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
add_bucket_response = groundx.projects.add_bucket(
project_id=1,
bucket_id=1,
)
โ๏ธ Parameters
project_id: int
The projectId of the project which the bucket will be added to.
bucket_id: int
The bucketId of the bucket being added to the project.
๐ Return
๐ Endpoint
/v1/project/{projectId}/bucket/{bucketId}
post
๐ Back to Table of Contents
groundx.projects.create
create a new project, a project 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
create_response = groundx.projects.create(
name="your_project_name",
bucket_name="your_new_bucket_name",
)
โ๏ธ Parameters
name: str
The name of the project being created.
bucket_name: str
Specify bucketName to automatically create a bucket, by the name specified, and add it to the created project.
โ๏ธ Request Body
๐ Return
๐ Endpoint
/v1/project
post
๐ Back to Table of Contents
groundx.projects.delete
Delete a project.
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
delete_response = groundx.projects.delete(
project_id=1,
)
โ๏ธ Parameters
project_id: int
The projectId of the project to be deleted.
๐ Return
๐ Endpoint
/v1/project/{projectId}
delete
๐ Back to Table of Contents
groundx.projects.get
look up a specific project by its 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
get_response = groundx.projects.get(
project_id=1,
)
โ๏ธ Parameters
project_id: int
The projectId of the project to look up.
๐ Return
๐ Endpoint
/v1/project/{projectId}
get
๐ Back to Table of Contents
groundx.projects.list
list all projects 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
list_response = groundx.projects.list(
n=1,
next_token="string_example",
)
โ๏ธ Parameters
n: int
The maximum number of returned documents. Accepts 1-100 with a default of 20.
next_token: str
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/project
get
๐ Back to Table of Contents
groundx.projects.remove_bucket
remove a bucket from a project. Buckets and projects can be associated many to many, this removes one bucket to project 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
remove_bucket_response = groundx.projects.remove_bucket(
project_id=1,
bucket_id=1,
)
โ๏ธ Parameters
project_id: int
The projectId of the project which the bucket will be removed from.
bucket_id: int
The bucketId of the bucket which will be removed from the project.
๐ Return
๐ Endpoint
/v1/project/{projectId}/bucket/{bucketId}
delete
๐ Back to Table of Contents
groundx.projects.update
Rename a project
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
update_response = groundx.projects.update(
new_name="your_project_name",
project_id=1,
)
โ๏ธ Parameters
new_name: str
The new name of the project being renamed.
project_id: int
The projectId of the project to update.
โ๏ธ Request Body
๐ Return
๐ Endpoint
/v1/project/{projectId}
put
๐ Back to Table of Contents
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
content_response = groundx.search.content(
query="my search query",
id=1,
n=20,
next_token="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9",
verbosity=0,
)
โ๏ธ Parameters
query: str
The search query to be used to find relevant documentation.
id: int
The bucketId or projectId of the bucket or project being searched. The documents within the specified container will be compared to the query, and relevant information will be extracted.
n: int
The maximum number of returned documents. Accepts 1-100 with a default of 20.
next_token: str
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: int
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.
โ๏ธ Request Body
๐ Return
๐ Endpoint
/v1/search/{id}
post
๐ Back to Table of Contents
Author
This Python package is automatically generated by Konfig
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for groundx_python_sdk-1.3.18.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 776aeb8c16e2fcb90aa3f0badd691acecc424f1d6d17b977d01600c8fff94e82 |
|
MD5 | 52ee3e89b4c53c83bfc0af9a951f8625 |
|
BLAKE2b-256 | 2b42a41a198fb39460613ee1809d5353916a0c50d8a436f9e47805253a8e94b3 |
Hashes for groundx_python_sdk-1.3.18-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc762396c19c67a954cb86ac6f911f8ed55010537d927ce176113d1b6d78fc26 |
|
MD5 | 4139639d65736a80f5bc2d96744c1e37 |
|
BLAKE2b-256 | 590d03f2719980675b5564b5c89da1c733cb5dedaa54977c3360a040acc902ec |