# Peslac API Client
A Python package to interact with the Peslac API for document management and AI-powered tools.
## Installation
Install the Peslac API Client using pip:
```bash
pip install peslac
```
## Usage
### Initializing the Client
First, import the Peslac class and create an instance with your API key:
```python
from peslac import Peslac
client = Peslac(api_key="your-api-key-here")
```
### Examples
#### Using a Local File
```python
# Use a tool with a local file
file_path = "path/to/your/document.pdf"
tool_id = "your-tool-id"
response = client.use_tool(file_path, tool_id)
print("Tool Response:", response)
```
#### Using a Remote File URL
```python
# Use a tool with a remote file URL
file_url = "https://example.com/document.pdf"
tool_id = "your-tool-id"
response = client.use_tool_with_file_url(file_url, tool_id)
print("Response:", response)
```
#### Retrieving a Document
```python
# Retrieve a document
document_id = "your-document-id"
response = client.retrieve_document(document_id)
print("Document Response:", response)
```
#### Submitting and Retrieving a Bank Statement
```python
# Submit a bank statement
file_path = "path/to/bank_statement.pdf"
type_of_account = "savings"
currency = "USD"
response = client.submit_bank_statement(file_path, type_of_account, currency)
print("Bank Statement Submission Response:", response)
# Retrieve the bank statement
document_id = "your-document-id"
response = client.retrieve_bank_statement(document_id)
print("Bank Statement Response:", response)
```
## API Reference
### `Peslac(api_key)`
Creates a new instance of the Peslac client.
- `api_key` (string): Your Peslac API key.
### `retrieve_document(document_id)`
Retrieves a document by its ID.
- `document_id` (string): The ID of the document you want to retrieve.
- **Returns**: A dictionary with the document details.
### `use_tool(file_path, tool_id)`
Uses an AI-powered tool on a document.
- `file_path` (string): Path to the file you want to process.
- `tool_id` (string): ID of the tool you want to use.
- **Returns**: A dictionary with the tool usage result.
### `use_tool_with_file_url(file_url, tool_id)`
Uses an AI-powered tool with a remote file URL.
- `file_url` (string): URL of the file you want to process.
- `tool_id` (string): ID of the tool you want to use.
- **Returns**: A dictionary with the tool usage result.
### `submit_bank_statement(file_path, type_of_account, currency)`
Submits a bank statement with additional metadata.
- `file_path` (string): Path to the bank statement file.
- `type_of_account` (string): Type of account (e.g., savings, checking).
- `currency` (string): The currency of the account (e.g., USD, EUR).
- **Returns**: A dictionary with the submission result.
### `retrieve_bank_statement(document_id)`
Retrieves a bank statement by its ID.
- `document_id` (string): The ID of the bank statement you want to retrieve.
- **Returns**: A dictionary with the bank statement details.
## Error Handling
All methods raise exceptions if operations fail. It's recommended to use try-except blocks when calling these functions:
```python
try:
response = client.retrieve_document("invalid-document-id")
print("Document Response:", response)
except Exception as e:
print("Error:", e)
```
## License
This project is licensed under the MIT License. See the LICENSE file for more details.
## Support
For support or questions, please contact:
- Email: support@peslac.com
- GitHub: Open an issue in the repository
Raw data
{
"_id": null,
"home_page": "https://github.com/peslacai/peslac-python",
"name": "peslac",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "peslac, api, documents, tools, nodejs, rag, ai, llm, remote-file, remote-file-processing, document-processing, file-processing, ocr, image-processing, pdf-processing, document-ocr, image-ocr, pdf-ocr, pdf-splitter, pdf-merger",
"author": "Jibril Kala",
"author_email": "support@peslac.com",
"download_url": "https://files.pythonhosted.org/packages/f7/f8/2ee33c24ccbf96822804444f62d6137da493f16365ec6c6b7e6dbc485b39/peslac-0.1.4.tar.gz",
"platform": null,
"description": "# Peslac API Client\n\nA Python package to interact with the Peslac API for document management and AI-powered tools.\n\n## Installation\n\nInstall the Peslac API Client using pip:\n\n```bash\npip install peslac\n```\n\n## Usage\n\n### Initializing the Client\n\nFirst, import the Peslac class and create an instance with your API key:\n\n```python\nfrom peslac import Peslac\n\nclient = Peslac(api_key=\"your-api-key-here\")\n```\n\n### Examples\n\n#### Using a Local File\n\n```python\n# Use a tool with a local file\nfile_path = \"path/to/your/document.pdf\"\ntool_id = \"your-tool-id\"\nresponse = client.use_tool(file_path, tool_id)\nprint(\"Tool Response:\", response)\n```\n\n#### Using a Remote File URL\n\n```python\n# Use a tool with a remote file URL\nfile_url = \"https://example.com/document.pdf\"\ntool_id = \"your-tool-id\"\nresponse = client.use_tool_with_file_url(file_url, tool_id)\nprint(\"Response:\", response)\n```\n\n#### Retrieving a Document\n\n```python\n# Retrieve a document\ndocument_id = \"your-document-id\"\nresponse = client.retrieve_document(document_id)\nprint(\"Document Response:\", response)\n```\n\n#### Submitting and Retrieving a Bank Statement\n\n```python\n# Submit a bank statement\nfile_path = \"path/to/bank_statement.pdf\"\ntype_of_account = \"savings\"\ncurrency = \"USD\"\nresponse = client.submit_bank_statement(file_path, type_of_account, currency)\nprint(\"Bank Statement Submission Response:\", response)\n\n# Retrieve the bank statement\ndocument_id = \"your-document-id\"\nresponse = client.retrieve_bank_statement(document_id)\nprint(\"Bank Statement Response:\", response)\n```\n\n## API Reference\n\n### `Peslac(api_key)`\n\nCreates a new instance of the Peslac client.\n\n- `api_key` (string): Your Peslac API key.\n\n### `retrieve_document(document_id)`\n\nRetrieves a document by its ID.\n\n- `document_id` (string): The ID of the document you want to retrieve.\n- **Returns**: A dictionary with the document details.\n\n### `use_tool(file_path, tool_id)`\n\nUses an AI-powered tool on a document.\n\n- `file_path` (string): Path to the file you want to process.\n- `tool_id` (string): ID of the tool you want to use.\n- **Returns**: A dictionary with the tool usage result.\n\n### `use_tool_with_file_url(file_url, tool_id)`\n\nUses an AI-powered tool with a remote file URL.\n\n- `file_url` (string): URL of the file you want to process.\n- `tool_id` (string): ID of the tool you want to use.\n- **Returns**: A dictionary with the tool usage result.\n\n### `submit_bank_statement(file_path, type_of_account, currency)`\n\nSubmits a bank statement with additional metadata.\n\n- `file_path` (string): Path to the bank statement file.\n- `type_of_account` (string): Type of account (e.g., savings, checking).\n- `currency` (string): The currency of the account (e.g., USD, EUR).\n- **Returns**: A dictionary with the submission result.\n\n### `retrieve_bank_statement(document_id)`\n\nRetrieves a bank statement by its ID.\n\n- `document_id` (string): The ID of the bank statement you want to retrieve.\n- **Returns**: A dictionary with the bank statement details.\n\n## Error Handling\n\nAll methods raise exceptions if operations fail. It's recommended to use try-except blocks when calling these functions:\n\n```python\ntry:\n response = client.retrieve_document(\"invalid-document-id\")\n print(\"Document Response:\", response)\nexcept Exception as e:\n print(\"Error:\", e)\n```\n\n## License\n\nThis project is licensed under the MIT License. See the LICENSE file for more details.\n\n## Support\n\nFor support or questions, please contact:\n\n- Email: support@peslac.com\n- GitHub: Open an issue in the repository\n",
"bugtrack_url": null,
"license": null,
"summary": "A Python package for the Peslac API",
"version": "0.1.4",
"project_urls": {
"Bug Tracker": "https://github.com/peslacai/peslac-python/issues",
"Documentation": "https://github.com/peslacai/peslac-python#readme",
"Homepage": "https://github.com/peslacai/peslac-python",
"Source Code": "https://github.com/peslacai/peslac-python"
},
"split_keywords": [
"peslac",
" api",
" documents",
" tools",
" nodejs",
" rag",
" ai",
" llm",
" remote-file",
" remote-file-processing",
" document-processing",
" file-processing",
" ocr",
" image-processing",
" pdf-processing",
" document-ocr",
" image-ocr",
" pdf-ocr",
" pdf-splitter",
" pdf-merger"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a02b6c7a9ea9dd0181498d067b82e6210d30a0a46469c3d40f97367c48c53d04",
"md5": "ca45f5381d68edf2ea8a29c3417f0e98",
"sha256": "ee0f136d0d2f16c8da5e2ed93b8a9fa1b6b2c0aa5ba7a0b11cdb0af04dc86bd2"
},
"downloads": -1,
"filename": "peslac-0.1.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ca45f5381d68edf2ea8a29c3417f0e98",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 4416,
"upload_time": "2025-01-25T06:54:18",
"upload_time_iso_8601": "2025-01-25T06:54:18.319250Z",
"url": "https://files.pythonhosted.org/packages/a0/2b/6c7a9ea9dd0181498d067b82e6210d30a0a46469c3d40f97367c48c53d04/peslac-0.1.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f7f82ee33c24ccbf96822804444f62d6137da493f16365ec6c6b7e6dbc485b39",
"md5": "808b6939b5e04b8edda11dba1cc25d2d",
"sha256": "6416a918bd3a549091d78756041afb4f7fdb957ba8d303ffe86f9d55468b3da6"
},
"downloads": -1,
"filename": "peslac-0.1.4.tar.gz",
"has_sig": false,
"md5_digest": "808b6939b5e04b8edda11dba1cc25d2d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 4295,
"upload_time": "2025-01-25T06:54:20",
"upload_time_iso_8601": "2025-01-25T06:54:20.245571Z",
"url": "https://files.pythonhosted.org/packages/f7/f8/2ee33c24ccbf96822804444f62d6137da493f16365ec6c6b7e6dbc485b39/peslac-0.1.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-25 06:54:20",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "peslacai",
"github_project": "peslac-python",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "peslac"
}