### Installing GroundX Python Library Source: https://github.com/eyelevelai/groundx-python/blob/main/README.md Install the GroundX Python library using pip to access the GroundX API from your Python projects. ```sh pip install groundx ``` -------------------------------- ### Retrieve GroundX Customer Account Info - Python Source: https://github.com/eyelevelai/groundx-python/blob/main/reference.md Get the account information associated with the API key used to initialize the GroundX Python SDK client. This provides details about the customer account. ```python from groundx import GroundX client = GroundX( api_key="YOUR_API_KEY", ) client.customer.get() ``` -------------------------------- ### Project Dependencies - Python Source: https://github.com/eyelevelai/groundx-python/blob/main/requirements.txt This snippet lists the necessary Python packages and their minimum or exact version requirements for the project to function correctly. These dependencies are typically installed using pip. ```Python aiohttp>=3.8.0 httpx>=0.21.2 pydantic>= 1.9.2 pydantic-core==^2.18.2 requests>=2.4.0 tqdm>=4.60.0 types-tqdm>=4.60.0 typing_extensions>= 4.0.0 ``` -------------------------------- ### Looking Up Documents - GroundX Python Source: https://github.com/eyelevelai/groundx-python/blob/main/reference.md This snippet illustrates how to use the GroundX Python SDK to look up documents associated with a specific process ID, bucket ID, or group ID. The example uses a numerical ID. ```python from groundx import GroundX client = GroundX( api_key="YOUR_API_KEY", ) client.documents.lookup( id=1, ) ``` -------------------------------- ### Getting Specific GroundX Service Health Status (Python) Source: https://github.com/eyelevelai/groundx-python/blob/main/reference.md Shows how to initialize the GroundX client and use the `client.health.get()` method to look up the health status of a specific service by name. Statuses are updated every 5 minutes. Requires the `service` parameter. ```python from groundx import GroundX client = GroundX( api_key="YOUR_API_KEY", ) client.health.get( service="search", ) ``` -------------------------------- ### Handling GroundX API Errors in Python Source: https://github.com/eyelevelai/groundx-python/blob/main/README.md Provides an example of catching `ApiError` exceptions thrown by the GroundX client when the API returns a non-success status code (4xx or 5xx), allowing access to the status code and response body. ```python from groundx.core.api_error import ApiError try: client.ingest(...) except ApiError as e: print(e.status_code) print(e.body) ``` -------------------------------- ### Getting Document Ingest Processes using GroundX Python Client Source: https://github.com/eyelevelai/groundx-python/blob/main/reference.md Retrieve a list of recent document ingest process requests from GroundX. The results are sorted from the most recent process to the least recent, providing insight into ingestion history. ```python from groundx import GroundX client = GroundX( api_key="YOUR_API_KEY", ) client.documents.get_processes() ``` -------------------------------- ### Getting a Bucket by ID using GroundX Python Client Source: https://github.com/eyelevelai/groundx-python/blob/main/reference.md Look up a specific bucket by its unique integer bucketId using the GroundX Python client. This retrieves details for the specified bucket. ```python from groundx import GroundX client = GroundX( api_key="YOUR_API_KEY", ) client.buckets.get( bucket_id=1, ) ``` -------------------------------- ### Getting a Document by ID using GroundX Python Client Source: https://github.com/eyelevelai/groundx-python/blob/main/reference.md Look up an existing document by its unique documentId using the GroundX Python client. This method retrieves detailed information about a specific document previously ingested into GroundX. ```python from groundx import GroundX client = GroundX( api_key="YOUR_API_KEY", ) client.documents.get( document_id="documentId", ) ``` -------------------------------- ### Getting Document Processing Status - GroundX Python Source: https://github.com/eyelevelai/groundx-python/blob/main/reference.md This snippet shows how to retrieve the processing status of a document ingest operation using its process ID. The process ID is obtained from the response of ingest functions like ingest_remote, ingest_local, or crawl_website. ```python from groundx import GroundX client = GroundX( api_key="YOUR_API_KEY", ) client.documents.get_processing_status_by_id( process_id="processId", ) ``` -------------------------------- ### Listing Buckets using GroundX Python Client Source: https://github.com/eyelevelai/groundx-python/blob/main/reference.md List all buckets within your GroundX account using the GroundX Python client. ```python from groundx import GroundX client = GroundX( api_key="YOUR_API_KEY", ) client.buckets.list() ``` -------------------------------- ### Using GroundX Sync Client for Ingestion Source: https://github.com/eyelevelai/groundx-python/blob/main/README.md Demonstrates how to instantiate the synchronous GroundX client with an API key and perform a document ingestion operation with a list of Document objects. ```python from groundx import Document, GroundX client = GroundX( api_key="YOUR_API_KEY", ) client.ingest( documents=[ Document( bucket_id=1234, file_name="my_file1.txt", file_type="txt", source_url="https://my.source.url.com/file1.txt", ) ], ) ``` -------------------------------- ### Listing GroundX Service Health Status (Python) Source: https://github.com/eyelevelai/groundx-python/blob/main/reference.md Demonstrates how to initialize the GroundX client and call the `client.health.list()` method to retrieve the current health status of all services. Statuses are updated every 5 minutes. ```python from groundx import GroundX client = GroundX( api_key="YOUR_API_KEY", ) client.health.list() ``` -------------------------------- ### Creating a Bucket using GroundX Python Client Source: https://github.com/eyelevelai/groundx-python/blob/main/reference.md Create a new bucket using the GroundX Python client. This operation requires providing a unique name for the new bucket. ```python from groundx import GroundX client = GroundX( api_key="YOUR_API_KEY", ) client.buckets.create( name="your_bucket_name", ) ``` -------------------------------- ### Creating a Group using GroundX Python Client Source: https://github.com/eyelevelai/groundx-python/blob/main/reference.md Create a new group, which serves as a collection of buckets, using the GroundX Python client. A name is required for the new group. ```python from groundx import GroundX client = GroundX( api_key="YOUR_API_KEY", ) client.groups.create( name="your_group_name", ) ``` -------------------------------- ### Using a Custom httpx Client with GroundX Source: https://github.com/eyelevelai/groundx-python/blob/main/README.md Explains how to provide a custom configured `httpx.Client` instance to the GroundX client constructor, enabling advanced configurations like proxies or custom transports. ```python import httpx from groundx import GroundX client = GroundX( ..., httpx_client=httpx.Client( proxies="http://my.test.proxy.example.com", transport=httpx.HTTPTransport(local_address="0.0.0.0"), ), ) ``` -------------------------------- ### Listing Groups using GroundX Python Client Source: https://github.com/eyelevelai/groundx-python/blob/main/reference.md List all groups within your GroundX account using the Python client. This method supports pagination to retrieve results in batches. ```python from groundx import GroundX client = GroundX( api_key="YOUR_API_KEY", ) client.groups.list() ``` -------------------------------- ### Using GroundX Async Client for Ingestion Source: https://github.com/eyelevelai/groundx-python/blob/main/README.md Shows how to use the asynchronous GroundX client for non-blocking API calls, including instantiating the client and performing an asynchronous document ingestion within an asyncio event loop. ```python import asyncio from groundx import AsyncGroundX, Document client = AsyncGroundX( api_key="YOUR_API_KEY", ) async def main() -> None: await client.ingest( documents=[ Document( bucket_id=1234, file_name="my_file1.txt", file_type="txt", source_url="https://my.source.url.com/file1.txt", ) ], ) asyncio.run(main()) ``` -------------------------------- ### Crawl Website using GroundX Python SDK Source: https://github.com/eyelevelai/groundx-python/blob/main/reference.md Upload the content of a publicly accessible website for ingestion into a GroundX bucket by recursively following links up to a specified depth or number of pages. Note that the source_url must include the protocol (http:// or https://). ```python from groundx import GroundX, WebsiteSource client = GroundX( api_key="YOUR_API_KEY", ) client.documents.crawl_website( websites=[ WebsiteSource( bucket_id=1234, cap=10, depth=2, search_data={"key": "value"}, source_url="https://my.website.com", ) ], ) ``` -------------------------------- ### Configuring Timeouts for GroundX Client and Requests Source: https://github.com/eyelevelai/groundx-python/blob/main/README.md Shows how to set a default timeout for the entire GroundX client instance and how to override this timeout for individual API calls using the `timeout_in_seconds` option in `request_options`. ```python from groundx import GroundX client = GroundX( ..., timeout=20.0, ) # Override timeout for a specific method client.ingest(..., request_options={ "timeout_in_seconds": 1 }) ``` -------------------------------- ### Ingest Local Documents using GroundX Python SDK Source: https://github.com/eyelevelai/groundx-python/blob/main/reference.md Upload documents hosted on a local file system into a GroundX bucket. This function requires providing the document content as a blob and metadata including bucket ID, file name, and file type. ```python from groundx import GroundX, IngestLocalDocument, IngestLocalDocumentMetadata client = GroundX( api_key="YOUR_API_KEY", ) client.documents.ingest_local( request=[ IngestLocalDocument( blob="blob", metadata=IngestLocalDocumentMetadata( bucket_id=1234, file_name="my_file1.txt", file_type="txt", ), ) ], ) ``` -------------------------------- ### Searching Document Content using GroundX Python Client Source: https://github.com/eyelevelai/groundx-python/blob/main/reference.md Perform a search across documents on GroundX to find information relevant to a given query. The results can be used for RAG via "result.search.text" or for citation via "result.search.results". ```python from groundx import GroundX client = GroundX( api_key="YOUR_API_KEY", ) client.search.content( id=1, next_token="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9", query="my search query", ) ``` -------------------------------- ### Ingest Remote Documents using GroundX Python SDK Source: https://github.com/eyelevelai/groundx-python/blob/main/reference.md Ingest documents hosted on public URLs into a GroundX bucket. This function takes a list of IngestRemoteDocument objects, each specifying the bucket ID, file name, file type, and source URL. ```python from groundx import GroundX, IngestRemoteDocument client = GroundX( api_key="YOUR_API_KEY", ) client.documents.ingest_remote( documents=[ IngestRemoteDocument( bucket_id=1234, file_name="my_file1.txt", file_type="txt", source_url="https://my.source.url.com/file1.txt", ) ], ) ``` -------------------------------- ### Searching Documents using GroundX Python Client Source: https://github.com/eyelevelai/groundx-python/blob/main/reference.md Search documents on GroundX for the most relevant information to a given query by documentId(s). The result can be used for RAG via `result.search.text` or citation via `result.search.results`. ```python from groundx import GroundX client = GroundX( api_key="YOUR_API_KEY", ) client.search.documents( next_token="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9", query="my search query", document_ids=["docUUID1", "docUUID2"], ) ``` -------------------------------- ### List Documents using GroundX Python SDK Source: https://github.com/eyelevelai/groundx-python/blob/main/reference.md Lookup all documents across all resources currently on GroundX. This function retrieves a list of documents that have been ingested. ```python from groundx import GroundX client = GroundX( api_key="YOUR_API_KEY", ) client.documents.list() ``` -------------------------------- ### Deleting Documents - GroundX Python Source: https://github.com/eyelevelai/groundx-python/blob/main/reference.md This snippet demonstrates how to use the GroundX Python SDK to delete multiple documents by their IDs. It requires initializing the client with an API key and providing a comma-separated string or a list of document IDs. ```python from groundx import GroundX client = GroundX( api_key="YOUR_API_KEY", ) client.documents.delete( document_ids="123e4567-e89b-12d3-a456-426614174000,9f7c11a6-24b8-4d52-a9f3-90a7e70a9e49", ) ``` -------------------------------- ### Add Bucket to GroundX Group - Python Source: https://github.com/eyelevelai/groundx-python/blob/main/reference.md Associate an existing bucket with an existing group using their respective IDs via the GroundX Python SDK. Buckets and groups support many-to-many relationships. ```python from groundx import GroundX client = GroundX( api_key="YOUR_API_KEY", ) client.groups.add_bucket( group_id=1, bucket_id=1, ) ``` -------------------------------- ### Retrieve a GroundX Group by ID - Python Source: https://github.com/eyelevelai/groundx-python/blob/main/reference.md Look up a specific group by its groupId using the GroundX Python SDK. This requires initializing the client with your API key. ```python from groundx import GroundX client = GroundX( api_key="YOUR_API_KEY", ) client.groups.get( group_id=1, ) ``` -------------------------------- ### Configuring Retries for GroundX Requests Source: https://github.com/eyelevelai/groundx-python/blob/main/README.md Illustrates how to override the default automatic retry behavior for a specific request by setting the `max_retries` option within the `request_options` dictionary. ```python client.ingest(..., request_options={ "max_retries": 1 }) ``` -------------------------------- ### Updating a Bucket Name using GroundX Python Client Source: https://github.com/eyelevelai/groundx-python/blob/main/reference.md Rename an existing bucket using the GroundX Python client. This requires specifying the bucketId of the bucket to update and providing the new name. ```python from groundx import GroundX client = GroundX( api_key="YOUR_API_KEY", ) client.buckets.update( bucket_id=1, new_name="your_bucket_name", ) ``` -------------------------------- ### Update a GroundX Group Name - Python Source: https://github.com/eyelevelai/groundx-python/blob/main/reference.md Rename an existing GroundX group using its groupId and providing a new name via the GroundX Python SDK. Ensure the client is initialized with your API key. ```python from groundx import GroundX client = GroundX( api_key="YOUR_API_KEY", ) client.groups.update( group_id=1, new_name="your_group_name", ) ``` -------------------------------- ### Deleting a Document by ID using GroundX Python Client Source: https://github.com/eyelevelai/groundx-python/blob/main/reference.md Delete a single document that is currently hosted on GroundX by providing its unique documentId. This action permanently removes the document from the GroundX platform. ```python from groundx import GroundX client = GroundX( api_key="YOUR_API_KEY", ) client.documents.delete_by_id( document_id="documentId", ) ``` -------------------------------- ### Deleting a Bucket by ID using GroundX Python Client Source: https://github.com/eyelevelai/groundx-python/blob/main/reference.md Delete a specific bucket by its unique integer bucketId using the GroundX Python client. This permanently removes the bucket and its contents. ```python from groundx import GroundX client = GroundX( api_key="YOUR_API_KEY", ) client.buckets.delete( bucket_id=1, ) ``` -------------------------------- ### Delete a GroundX Group by ID - Python Source: https://github.com/eyelevelai/groundx-python/blob/main/reference.md Delete a specific GroundX group using its groupId via the GroundX Python SDK. Initialize the client with your API key before making the call. ```python from groundx import GroundX client = GroundX( api_key="YOUR_API_KEY", ) client.groups.delete( group_id=1, ) ``` -------------------------------- ### Remove Bucket from GroundX Group - Python Source: https://github.com/eyelevelai/groundx-python/blob/main/reference.md Remove the association between a specific bucket and a group using their IDs via the GroundX Python SDK. This action only removes the link, not the bucket or group themselves. ```python from groundx import GroundX client = GroundX( api_key="YOUR_API_KEY", ) client.groups.remove_bucket( group_id=1, bucket_id=1, ) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.