# 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/9b/58/2332cf27f3b07a950ac3b0a17a02f6ba8ccf496ac0558ebb624d052aad85/peslac-0.1.3.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.3",
"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": "49ce79d23d92a9970202713f4f4afac1e9289b7bc87341cf62892f00667b81dc",
"md5": "fd0d5d3f4eff70b55c87a82b8044ec90",
"sha256": "d954d3ab270106d3cd1e2036c77e74f9b509cdaff9b3f2c41216611eb92242a9"
},
"downloads": -1,
"filename": "peslac-0.1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "fd0d5d3f4eff70b55c87a82b8044ec90",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 4349,
"upload_time": "2024-12-12T20:07:04",
"upload_time_iso_8601": "2024-12-12T20:07:04.653219Z",
"url": "https://files.pythonhosted.org/packages/49/ce/79d23d92a9970202713f4f4afac1e9289b7bc87341cf62892f00667b81dc/peslac-0.1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9b582332cf27f3b07a950ac3b0a17a02f6ba8ccf496ac0558ebb624d052aad85",
"md5": "41fe00023cb344cb61a7baed36267fef",
"sha256": "8366cdb59e2e124a6ce03d3d92a65e822a92665cb68fbbac9e9d177cfca8e9dc"
},
"downloads": -1,
"filename": "peslac-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "41fe00023cb344cb61a7baed36267fef",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 4236,
"upload_time": "2024-12-12T20:07:05",
"upload_time_iso_8601": "2024-12-12T20:07:05.896663Z",
"url": "https://files.pythonhosted.org/packages/9b/58/2332cf27f3b07a950ac3b0a17a02f6ba8ccf496ac0558ebb624d052aad85/peslac-0.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-12 20:07:05",
"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"
}