Skip to main content

A Python SDK for interacting with the Dabarqus REST API

Project description

Dabarqus SDK Documentation

Table of Contents

  1. Installation
  2. Getting Started
  3. API Reference
  4. Examples

Installation

To install the Dabarqus SDK, you can use pip:

pip install dabarqus

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

dabarqus-0.1.3.tar.gz (6.0 kB view hashes)

Uploaded Source

Built Distribution

dabarqus-0.1.3-py3-none-any.whl (7.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page