Skip to main content

Visit Groundx

Groundx

Ground Your RAG Apps in Fact not Fiction

PyPI GitHub last commit README.md More Info

Table of Contents

Requirements

Python >=3.7

Installing

pip install groundx-python-sdk==1.3.8

Getting Started

from pprint import pprint
from groundx import Groundx, ApiException

groundx = Groundx(
    api_key="YOUR_API_KEY",
)

try:
    # buckets.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:
        # buckets.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.

๐Ÿ› ๏ธ Usage

create_response = groundx.buckets.create(
    name="your_bucket_name",
)

โš™๏ธ Parameters

name: str

โš™๏ธ Request Body

BucketCreateRequest

๐Ÿ”„ Return

BucketResponse

๐ŸŒ Endpoint

/v1/bucket post

๐Ÿ”™ Back to Table of Contents


groundx.buckets.delete

delete a bucket.

๐Ÿ› ๏ธ Usage

delete_response = groundx.buckets.delete(
    bucket_id=1,
)

โš™๏ธ Parameters

bucket_id: int

The bucketId of the bucket being deleted.

๐Ÿ”„ Return

MessageResponse

๐ŸŒ Endpoint

/v1/bucket/{bucketId} delete

๐Ÿ”™ Back to Table of Contents


groundx.buckets.get

look up a specific bucket by its bucketId.

๐Ÿ› ๏ธ Usage

get_response = groundx.buckets.get(
    bucket_id=1,
)

โš™๏ธ Parameters

bucket_id: int

The bucketId of the bucket to look up.

๐Ÿ”„ Return

BucketResponse

๐ŸŒ Endpoint

/v1/bucket/{bucketId} get

๐Ÿ”™ Back to Table of Contents


groundx.buckets.list

List all buckets within your GroundX account

๐Ÿ› ๏ธ 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

BucketListResponse

๐ŸŒ Endpoint

/v1/bucket get

๐Ÿ”™ Back to Table of Contents


groundx.buckets.update

Rename a bucket

๐Ÿ› ๏ธ Usage

update_response = groundx.buckets.update(
    new_name="your_bucket_name",
    bucket_id=1,
)

โš™๏ธ Parameters

new_name: str
bucket_id: int

The bucketId of the bucket being updated.

โš™๏ธ Request Body

BucketUpdateRequest

๐Ÿ”„ Return

BucketUpdateResponse

๐ŸŒ 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.

๐Ÿ› ๏ธ 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

WebsiteCrawlRequest

๐Ÿ”„ Return

IngestResponse

๐ŸŒ Endpoint

/v1/ingest/documents/website post

๐Ÿ”™ Back to Table of Contents


groundx.documents.delete

Delete multiple documents hosted on GroundX

๐Ÿ› ๏ธ 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

IngestResponse

๐ŸŒ Endpoint

/v1/ingest/documents delete

๐Ÿ”™ Back to Table of Contents


groundx.documents.delete_0

Delete a single document hosted on GroundX

๐Ÿ› ๏ธ Usage

delete_0_response = groundx.documents.delete_0(
    document_id="documentId_example",
)

โš™๏ธ Parameters

document_id: str

A documentId which correspond to a document uploaded to GroundX

๐Ÿ”„ Return

IngestResponse

๐ŸŒ Endpoint

/v1/ingest/document/{documentId} delete

๐Ÿ”™ Back to Table of Contents


groundx.documents.get

Look up an existing document by its ID

๐Ÿ› ๏ธ Usage

get_response = groundx.documents.get(
    document_id="documentId_example",
)

โš™๏ธ Parameters

document_id: str

๐Ÿ”„ Return

DocumentResponse

๐ŸŒ 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 (which is included in the response of the upload functions).

๐Ÿ› ๏ธ Usage

get_processing_status_by_id_response = groundx.documents.get_processing_status_by_id(
    process_id="processId_example",
)

โš™๏ธ Parameters

process_id: str

๐Ÿ”„ Return

ProcessStatusResponse

๐ŸŒ Endpoint

/v1/ingest/{processId} get

๐Ÿ”™ Back to Table of Contents


groundx.documents.list

lookup all documents across all resources which are currently on GroundX

๐Ÿ› ๏ธ Usage

list_response = groundx.documents.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

DocumentListResponse

๐ŸŒ Endpoint

/v1/ingest/documents get

๐Ÿ”™ Back to Table of Contents


groundx.documents.lookup

lookup the document(s) associated with a processId, bucketId, or projectId.

๐Ÿ› ๏ธ Usage

lookup_response = groundx.documents.lookup(
    id=1,
    n=1,
    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.

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

DocumentLookupResponse

๐ŸŒ 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

๐Ÿ› ๏ธ 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

DocumentLocalUploadRequest

๐Ÿ”„ Return

IngestResponse

๐ŸŒ Endpoint

/v1/ingest/documents/local post

๐Ÿ”™ Back to Table of Contents


groundx.documents.upload_remote

Upload documents which are hosted on public URLs to a GroundX bucket

๐Ÿ› ๏ธ 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

DocumentRemoteUploadRequest

๐Ÿ”„ Return

IngestResponse

๐ŸŒ Endpoint

/v1/ingest/documents/remote post

๐Ÿ”™ 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.

๐Ÿ› ๏ธ 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

MessageResponse

๐ŸŒ Endpoint

/v1/project/{projectId}/bucket/{bucketId} post

๐Ÿ”™ Back to Table of Contents


groundx.projects.create

create a new project.

๐Ÿ› ๏ธ Usage

create_response = groundx.projects.create(
    name="your_project_name",
    bucket_name="your_new_bucket_name",
)

โš™๏ธ Parameters

name: str
bucket_name: str

Include a bucket name to automatically create a bucket and add it to this project

โš™๏ธ Request Body

ProjectCreateRequest

๐Ÿ”„ Return

ProjectResponse

๐ŸŒ Endpoint

/v1/project post

๐Ÿ”™ Back to Table of Contents


groundx.projects.delete

delete a project.

๐Ÿ› ๏ธ Usage

delete_response = groundx.projects.delete(
    project_id=1,
)

โš™๏ธ Parameters

project_id: int

The projectId of the project to be deleted.

๐Ÿ”„ Return

MessageResponse

๐ŸŒ Endpoint

/v1/project/{projectId} delete

๐Ÿ”™ Back to Table of Contents


groundx.projects.get

look up a specific project by its projectId.

๐Ÿ› ๏ธ Usage

get_response = groundx.projects.get(
    project_id=1,
)

โš™๏ธ Parameters

project_id: int

The projectId of the project to look up.

๐Ÿ”„ Return

ProjectResponse

๐ŸŒ Endpoint

/v1/project/{projectId} get

๐Ÿ”™ Back to Table of Contents


groundx.projects.list

list all projects within your GroundX account.

๐Ÿ› ๏ธ 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

ProjectListResponse

๐ŸŒ 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.

๐Ÿ› ๏ธ 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

MessageResponse

๐ŸŒ Endpoint

/v1/project/{projectId}/bucket/{bucketId} delete

๐Ÿ”™ Back to Table of Contents


groundx.projects.update

Rename a project

๐Ÿ› ๏ธ Usage

update_response = groundx.projects.update(
    new_name="your_project_name",
    project_id=1,
)

โš™๏ธ Parameters

new_name: str
project_id: int

The projectId of the project to update.

โš™๏ธ Request Body

ProjectUpdateRequest

๐Ÿ”„ Return

ProjectResponse

๐ŸŒ 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.

๐Ÿ› ๏ธ Usage

content_response = groundx.search.content(
    search={
        "query": "my search query",
        "next_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9",
    },
    id=1,
    n=20,
)

โš™๏ธ Parameters

search: SearchRequestSearch
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.

โš™๏ธ Request Body

SearchRequest

๐Ÿ”„ Return

SearchResponse

๐ŸŒ Endpoint

/v1/search/{id} post

๐Ÿ”™ Back to Table of Contents


Author

This Python package is automatically generated by Konfig

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

groundx_python_sdk-1.3.8.tar.gz (86.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

groundx_python_sdk-1.3.8-py3-none-any.whl (295.0 kB view details)

Uploaded Python 3

File details

Details for the file groundx_python_sdk-1.3.8.tar.gz.

File metadata

  • Download URL: groundx_python_sdk-1.3.8.tar.gz
  • Upload date:
  • Size: 86.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for groundx_python_sdk-1.3.8.tar.gz
Algorithm Hash digest
SHA256 12622a499b6b73667d92f5208bea334b0d787b319d831b611ae84e8492e76810
MD5 c11c975aa27a67e0d3e91d9dcaa5dcf7
BLAKE2b-256 197d9e85a567c4b6db828a2c702cd5b9641c2f2bd20c1385eeb06ebc8c356132

See more details on using hashes here.

File details

Details for the file groundx_python_sdk-1.3.8-py3-none-any.whl.

File metadata

File hashes

Hashes for groundx_python_sdk-1.3.8-py3-none-any.whl
Algorithm Hash digest
SHA256 1cd224b5bd7c1118a24a3e75172dc03f020bb920b89f1dc7c2dac303db90d18e
MD5 9919ca6be5cb32b48210de48a646fd5d
BLAKE2b-256 e2fb0305f20cc6b1efd99e15e9bd5d5f4e76cfc2c9b84d0081dd11a78862fbef

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page