A Python SDK for interacting with the Dabarqus REST API
Project description
Dabarqus SDK Documentation
Table of Contents
What is Dabarqus?
Dabarqus: Community Edition – Zero to RAG in minutes. Chat with your PDFs, summarize emails and messaging, and digest a vast range of facts, figures, and reports. A dash of genius for your LLM. This is the Python SDK for Dabarqus. For more info on Dabarqus, visit the github.
Installation
1. Install the Dabarqus SDK
First, install the Dabarqus Python SDK using pip:
pip install dabarqus
This command installs the SDK and all its dependencies, including the service installation script.
2. Install the Dabarqus Service
After installing the SDK, you need to install and run the Dabarqus service:
Option 1: Manual Installation (Recommended)
-
Download the latest Dabarqus release from the official GitHub repository.
-
Extract the downloaded zip file.
-
Navigate to the extracted folder.
-
Install the Dabarqus service (requires elevated privileges):
- On Windows: Open an elevated Command Prompt or PowerShell and run:
barq.exe service install
- On macOS/Linux: Use sudo to run the installation:
sudo ./barq service install
- On Windows: Open an elevated Command Prompt or PowerShell and run:
-
Start the Dabarqus service:
- On Windows:
barq.exe service start
- On macOS/Linux:
sudo ./barq service start
- On Windows:
Option 2: Automatic Installation (Experimental)
Use the provided installation script. Note: This script must be run with elevated privileges (admin rights).
- On Windows: Open an elevated Command Prompt or PowerShell and run:
dabarqus-install-service
- On macOS/Linux: Use sudo to run the script:
sudo dabarqus-install-service
This script will download the appropriate Dabarqus executable for your system, install it, and set up the service.
3. Starting the Dabarqus Service
The Dabarqus service should start automatically after installation. You can verify this by running:
barq
If it doesn't work, you can start the service manually (requires elevated privileges):
- On Windows: Run
sc start Dabarqus
in an elevated command prompt. - On macOS/Linux: Run
sudo systemctl start dabarqus
orsudo launchctl start com.dabarqus.service
depending on your system.
Getting Started
To start using the Dabarqus SDK, import it and create an instance:
from dabarqus import barq
# Create an instance of the SDK
sdk = barq("http://localhost:6568") # Replace with your Dabarqus server URL
API Reference
Health and Admin
check_health()
Check the health status of the Dabarqus service.
health_status = sdk.check_health()
print(health_status)
Models and Downloads
get_models()
Retrieve available AI models.
models = sdk.get_models()
print(models)
get_model_metadata(model_repo: str, file_path: Optional[str] = None)
Get metadata for a specific model.
metadata = sdk.get_model_metadata("model_repo_name", "path/to/model")
print(metadata)
get_downloads(model_repo: Optional[str] = None, file_path: Optional[str] = None)
Get information about downloaded items.
downloads = sdk.get_downloads("model_repo_name")
print(downloads)
enqueue_download(model_repo: str, file_path: str)
Enqueue a new download.
result = sdk.enqueue_download("model_repo_name", "path/to/model")
print(result)
cancel_download(model_repo: str, file_path: str)
Cancel a download.
result = sdk.cancel_download("model_repo_name", "path/to/model")
print(result)
remove_download(model_repo: str, file_path: str)
Remove a downloaded item.
result = sdk.remove_download("model_repo_name", "path/to/model")
print(result)
Inference
get_inference_info(alias: Optional[str] = None)
Get information about inference items.
info = sdk.get_inference_info("my_inference")
print(info)
start_inference(alias: str, model_repo: str, file_path: str, ...)
Start an inference.
result = sdk.start_inference("my_inference", "model_repo", "path/to/model")
print(result)
stop_inference(alias: str)
Stop an inference.
result = sdk.stop_inference("my_inference")
print(result)
get_inference_status(alias: Optional[str] = None)
Get the status of an inference.
status = sdk.get_inference_status("my_inference")
print(status)
reset_inference(alias: str)
Reset an inference.
result = sdk.reset_inference("my_inference")
print(result)
restart_inference()
Restart the current inference.
result = sdk.restart_inference()
print(result)
Hardware
get_hardware_info()
Get hardware information.
hardware_info = sdk.get_hardware_info()
print(hardware_info)
Silk (Memory) Operations
get_memory_status()
Get memory status.
status = sdk.get_memory_status()
print(status)
enable_memories()
Enable memories.
result = sdk.enable_memories()
print(result)
disable_memories()
Disable memories.
result = sdk.disable_memories()
print(result)
get_memory_banks()
Get memory banks information.
banks = sdk.get_memory_banks()
print(banks)
activate_memory_bank(bank: str)
Activate a memory bank.
result = sdk.activate_memory_bank("my_bank")
print(result)
deactivate_memory_bank(bank: str)
Deactivate a memory bank.
result = sdk.deactivate_memory_bank("my_bank")
print(result)
query_semantic_search(query: str, limit: Optional[int] = None, memory_bank: Optional[str] = None)
Perform a semantic query.
results = sdk.query_semantic_search("What is Dabarqus?", limit=5, memory_bank="my_bank")
print(results)
check_silk_health()
Check the health of the Silk retriever.
health = sdk.check_silk_health()
print(health)
get_silk_model_metadata()
Get model metadata from the Silk retriever.
metadata = sdk.get_silk_model_metadata()
print(metadata)
check_silk_store_health()
Check the health of the Silk store.
health = sdk.check_silk_store_health()
print(health)
enqueue_ingestion(memory_bank_name: str, input_path: str, ...)
Enqueue a new ingestion item.
result = sdk.enqueue_ingestion("my_bank", "/path/to/documents")
print(result)
cancel_ingestion(bank: str)
Cancel an ingestion.
result = sdk.cancel_ingestion("my_bank")
print(result)
get_ingestions(bank: Optional[str] = None)
Get information about ingestion items.
ingestions = sdk.get_ingestions("my_bank")
print(ingestions)
Shutdown
shutdown_server()
Initiate server shutdown.
result = sdk.shutdown_server()
print(result)
Logging
write_to_log(log_data: Dict[str, Any])
Write to log.
log_result = sdk.write_to_log({"message": "Test log entry", "level": "INFO"})
print(log_result)
Embedding
get_embedding(input_text: str)
Get an embedding from the Silk retriever.
embedding = sdk.get_embedding("Hello, world!")
print(embedding)
Examples
Here's a more comprehensive example that demonstrates using multiple SDK functions:
from dabarqus import barq
# Initialize the SDK
sdk = barq("http://localhost:6568")
# Check the health of the service
health = sdk.check_health()
print(f"Service health: {health}")
# Get available memory banks
banks = sdk.get_memory_banks()
print(f"Available memory banks: {banks}")
# Activate a memory bank
sdk.activate_memory_bank("my_documents")
# Enqueue an ingestion
ingestion_result = sdk.enqueue_ingestion("my_documents", "/path/to/documents")
print(f"Ingestion result: {ingestion_result}")
# Perform a semantic search
search_results = sdk.query_semantic_search("What is Dabarqus?", limit=5, memory_bank="my_documents")
print("Search results:")
for result in search_results:
print(f"- {result}")
# Get an embedding
embedding = sdk.get_embedding("Dabarqus is a powerful RAG solution")
print(f"Embedding (first 5 elements): {embedding[:5]}")
# Get hardware info
hardware_info = sdk.get_hardware_info()
print(f"Hardware info: {hardware_info}")
This documentation provides a comprehensive guide to using the Dabarqus SDK. Users can refer to this documentation to understand how to use each method in the SDK, along with examples of how to use them in their code.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file dabarqus-1.1.2.tar.gz
.
File metadata
- Download URL: dabarqus-1.1.2.tar.gz
- Upload date:
- Size: 11.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b3d42fc0a4b1fef7221e0e766d66912281fc56961d91a0bb7213e44b22254b10 |
|
MD5 | 5879daa4029262097a7fc9613a97c180 |
|
BLAKE2b-256 | 287fd532d14a4813a3313f1d7e42e709c12641a00c52ad95b2bdb3fc0b9fd2f5 |
File details
Details for the file dabarqus-1.1.2-py3-none-any.whl
.
File metadata
- Download URL: dabarqus-1.1.2-py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 18831ecac6fa6ac6c253e6735179fe7c6d56667860a02258c5d5fc45a4207e77 |
|
MD5 | 22df711e3639512fc626f91b1b89369b |
|
BLAKE2b-256 | 5baa712d49db82ef3366e8c1f47e0591c6387007e816073f1865d3e73543ad97 |