# Laive Python SDK
[](https://badge.fury.io/py/laive-sdk)
[](https://pypi.org/project/laive-sdk/)
[](https://beta.laive.ai)
The Laive Python SDK provides a simple and convenient way to interact with the Laive RAG (Retrieval-Augmented Generation) API. This library allows you to easily upload documents, create vaults, and perform intelligent queries on your document collections.
## Ressources
- [laive Platform](https://beta.laive.ai)
- [laive Python SDK](https://github.com/laiveai/Python-SDK)
- [laive Python SDK Cookbooks](https://github.com/laiveai/Python-SDK/tree/main/notebooks)
- [laive API Documentation](https://docs.laive.ai)
- [laive API Reference](https://docs.laive.ai/api)
> This SDK is still in beta. Please report any issues or feedback to [contact@laive.ai](mailto:contact@laive.ai) or open an issue on [GitHub](https://github.com/laiveai/Python-SDK/issues)
## Installation
```bash
# Install via pip
pip install laive-sdk
# Or install from source
git clone https://github.com/laive/Python-SDK.git
cd Python-SDK
pip install -e .
```
## Quick Start
```python
import os
from laive import LaiveClient
# Initialize the client with your API key
client = LaiveClient(api_key=os.getenv("LAIVE_API_KEY"))
# Query a vault
results = client.query(
query="What is the best way to implement RAG?",
vault_id=123,
top_k=5
)
print(f"Found {len(results.sources)} relevant documents")
```
## Authentication
Set your API key as an environment variable:
```bash
export LAIVE_API_KEY="your_api_key_here"
```
Or pass it directly when creating the client:
```python
client = LaiveClient(api_key="your_api_key_here")
```
## API Reference
### Client Initialization
```python
from laive import LaiveClient
client = LaiveClient(
api_key="your_api_key",
)
```
### Query Documents
Retrieve relevant documents from a vault based on a search query.
```python
response = client.query(
query="What is retrieval augmented generation?",
vault_id=123, # Optional, if not provided searches across all accessible vaults
top_k=4 # Optional, defaults to 4
)
# Access results
for source in response.sources:
print(f"Document: {source['source_name']}")
print(f"Content: {source['page_content'][:100]}...")
print(f"Relevance score: {source['score']}")
```
### Upload Files
Upload one or more files to a vault.
```python
response = client.upload_files(
files=["path/to/document1.pdf", "path/to/document2.docx"],
source_names=["Document 1", "Document 2"],
vault_id=123,
source_urls=["https://example.com/doc1", "https://example.com/doc2"] # Optional
)
print(f"Started processing {response.files_processed} files")
print(f"Task IDs: {response.task_ids}")
```
### Check Task Status
Check the status of a file processing task.
```python
task_status = client.get_task_status(task_id="task_id_from_upload_response")
print(f"Task state: {task_status['state']}")
print(f"Status: {task_status['status']}")
```
## Jupyter Notebooks
Check out the [`notebooks/`](notebooks/) directory for interactive Jupyter notebooks:
- **📓 `notebooks/simple_query_example.ipynb`** - Simple querying example in notebook format
- **📚 `notebooks/vault_management_workflow.ipynb`** - Complete vault management workflow
## Development
### Installing from Source
```bash
git clone https://github.com/laive/Python-SDK.git
cd Python-SDK
pip install -e .
```
### Running Notebooks
```bash
# Copy environment template
cp .env.example .env
# Edit .env with your API key
# Install Jupyter and run notebooks
pip install jupyter
export LAIVE_API_KEY="your_api_key_here"
cd notebooks
jupyter notebook
```
Raw data
{
"_id": null,
"home_page": "https://github.com/laiveai/Python-SDK",
"name": "laive-sdk",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "laive, rag, retrieval, augmented, generation, ai, nlp, sdk",
"author": "Laive",
"author_email": "Laive <contact@laive.ai>",
"download_url": "https://files.pythonhosted.org/packages/0b/f2/0860876db26e0e0493a98d43728a444eb77430c1889dc13e17d439ef6c4f/laive_sdk-0.1.0.tar.gz",
"platform": null,
"description": "# Laive Python SDK\n\n[](https://badge.fury.io/py/laive-sdk)\n[](https://pypi.org/project/laive-sdk/)\n[](https://beta.laive.ai)\n\nThe Laive Python SDK provides a simple and convenient way to interact with the Laive RAG (Retrieval-Augmented Generation) API. This library allows you to easily upload documents, create vaults, and perform intelligent queries on your document collections.\n\n\n## Ressources \n\n- [laive Platform](https://beta.laive.ai)\n- [laive Python SDK](https://github.com/laiveai/Python-SDK)\n- [laive Python SDK Cookbooks](https://github.com/laiveai/Python-SDK/tree/main/notebooks)\n- [laive API Documentation](https://docs.laive.ai)\n- [laive API Reference](https://docs.laive.ai/api)\n\n> This SDK is still in beta. Please report any issues or feedback to [contact@laive.ai](mailto:contact@laive.ai) or open an issue on [GitHub](https://github.com/laiveai/Python-SDK/issues)\n\n\n## Installation\n\n```bash\n# Install via pip\npip install laive-sdk\n\n# Or install from source\ngit clone https://github.com/laive/Python-SDK.git\ncd Python-SDK\npip install -e .\n```\n\n## Quick Start\n\n```python\nimport os\nfrom laive import LaiveClient\n\n# Initialize the client with your API key\nclient = LaiveClient(api_key=os.getenv(\"LAIVE_API_KEY\"))\n\n# Query a vault\nresults = client.query(\n query=\"What is the best way to implement RAG?\",\n vault_id=123,\n top_k=5\n)\n\nprint(f\"Found {len(results.sources)} relevant documents\")\n```\n\n## Authentication\n\nSet your API key as an environment variable:\n\n```bash\nexport LAIVE_API_KEY=\"your_api_key_here\"\n```\n\nOr pass it directly when creating the client:\n\n```python\nclient = LaiveClient(api_key=\"your_api_key_here\")\n```\n\n## API Reference\n\n### Client Initialization\n\n```python\nfrom laive import LaiveClient\n\nclient = LaiveClient(\n api_key=\"your_api_key\",\n)\n```\n\n### Query Documents\n\nRetrieve relevant documents from a vault based on a search query.\n\n```python\nresponse = client.query(\n query=\"What is retrieval augmented generation?\",\n vault_id=123, # Optional, if not provided searches across all accessible vaults\n top_k=4 # Optional, defaults to 4\n)\n\n# Access results\nfor source in response.sources:\n print(f\"Document: {source['source_name']}\")\n print(f\"Content: {source['page_content'][:100]}...\")\n print(f\"Relevance score: {source['score']}\")\n```\n\n### Upload Files\n\nUpload one or more files to a vault.\n\n```python\nresponse = client.upload_files(\n files=[\"path/to/document1.pdf\", \"path/to/document2.docx\"],\n source_names=[\"Document 1\", \"Document 2\"],\n vault_id=123,\n source_urls=[\"https://example.com/doc1\", \"https://example.com/doc2\"] # Optional\n)\n\nprint(f\"Started processing {response.files_processed} files\")\nprint(f\"Task IDs: {response.task_ids}\")\n```\n\n### Check Task Status\n\nCheck the status of a file processing task.\n\n```python\ntask_status = client.get_task_status(task_id=\"task_id_from_upload_response\")\nprint(f\"Task state: {task_status['state']}\")\nprint(f\"Status: {task_status['status']}\")\n```\n\n## Jupyter Notebooks\n\nCheck out the [`notebooks/`](notebooks/) directory for interactive Jupyter notebooks:\n\n- **\ud83d\udcd3 `notebooks/simple_query_example.ipynb`** - Simple querying example in notebook format\n- **\ud83d\udcda `notebooks/vault_management_workflow.ipynb`** - Complete vault management workflow\n\n## Development\n\n### Installing from Source\n\n```bash\ngit clone https://github.com/laive/Python-SDK.git\ncd Python-SDK\npip install -e .\n```\n\n### Running Notebooks\n\n```bash\n# Copy environment template\ncp .env.example .env\n# Edit .env with your API key\n\n# Install Jupyter and run notebooks\npip install jupyter\nexport LAIVE_API_KEY=\"your_api_key_here\"\ncd notebooks\njupyter notebook\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python SDK for the Laive RAG API",
"version": "0.1.0",
"project_urls": {
"Bug Reports": "https://github.com/laive/Python-SDK/issues",
"Documentation": "https://github.com/laive/Python-SDK#readme",
"Homepage": "https://github.com/laive/Python-SDK",
"Repository": "https://github.com/laive/Python-SDK.git"
},
"split_keywords": [
"laive",
" rag",
" retrieval",
" augmented",
" generation",
" ai",
" nlp",
" sdk"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "9b9fcb9aa44ec076b1124ef9919877b334b94f8b1c40db3a76d7828aa75d7d0d",
"md5": "51739887a4f9107b8228311ec48e1ec3",
"sha256": "08c5c253ad8f001cb537db08260984d94cb0cdb7e4f93c20e678c07b97905f61"
},
"downloads": -1,
"filename": "laive_sdk-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "51739887a4f9107b8228311ec48e1ec3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 6929,
"upload_time": "2025-07-16T01:23:24",
"upload_time_iso_8601": "2025-07-16T01:23:24.709247Z",
"url": "https://files.pythonhosted.org/packages/9b/9f/cb9aa44ec076b1124ef9919877b334b94f8b1c40db3a76d7828aa75d7d0d/laive_sdk-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "0bf20860876db26e0e0493a98d43728a444eb77430c1889dc13e17d439ef6c4f",
"md5": "0fc3ba4a5148231aef94c8b630f76508",
"sha256": "50fa776459f5f2f153cf9216c79d09ab315f2ba3ed0e5e0954384df65aa6d0d1"
},
"downloads": -1,
"filename": "laive_sdk-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "0fc3ba4a5148231aef94c8b630f76508",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 17453,
"upload_time": "2025-07-16T01:23:26",
"upload_time_iso_8601": "2025-07-16T01:23:26.074168Z",
"url": "https://files.pythonhosted.org/packages/0b/f2/0860876db26e0e0493a98d43728a444eb77430c1889dc13e17d439ef6c4f/laive_sdk-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-16 01:23:26",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "laiveai",
"github_project": "Python-SDK",
"github_not_found": true,
"lcname": "laive-sdk"
}