1.1.2 • Published 9 months ago

dabarqus v1.1.2

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago

Dabarqus JavaScript SDK

The Dabarqus JavaScript SDK provides a convenient way to interact with the Dabarqus API in both Node.js and browser environments.

Table of Contents

  1. What is Dabarqus?
  2. Installation
  3. Usage
  4. API Reference

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 Javascript SDK for Dabarqus. For more info on Dabarqus, visit the github.

Installation

1. Install the Dabarqus package:

First, install the npm package:
npm install dabarqus

2. Install the Dabarqus Service

After installing the SDK, you need to install and run the Dabarqus service:

Option 1: Manual Installation (Recommended)

  1. Download the latest Dabarqus release from the official GitHub repository.

  2. Extract the downloaded zip file.

  3. Navigate to the extracted folder.

  4. 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
  5. Start the Dabarqus service:

    • On Windows:
      barq.exe service start
    • On macOS/Linux:
      sudo ./barq service start

Option 2: Automatic Installation (Experimental)

Note: If you already have Dabarqus installed, you can skip the service installation step.

  • On Windows: Open an elevated Command Prompt or PowerShell and run:
    npx dabarqus-install-service -s
  • On macOS/Linux: Use sudo to run the script:
    sudo npx dabarqus-install-service -s

You can specify an installation directory:

npx dabarqus-install-service --dir /path/to/install

(OPTIONAL) Start the Dabarqus service:

The dabarqus service should be running after installation. You can test this with the following command:
barq
If this does not work , you can follow the below steps to start hthe service manually.
Note: Administrative privileges are required to install and manage system services.

  • On Windows: The service should start automatically if installed with the --service option. If not, run sc start Dabarqus in an elevated command prompt.
  • On macOS/Linux: If installed with the --service option, run sudo systemctl start dabarqus or sudo launchctl start com.dabarqus.service depending on your system.

Usage

Here's a basic example of how to use the Dabarqus SDK:

const Dabarqus = require('dabarqus');

// Create a new instance of the SDK
const barq = new Dabarqus('http://localhost:6568');

// Check the health of the Dabarqus service
barq.checkHealth()
  .then(response => console.log('Health status:', response))
  .catch(error => console.error('Error:', error));

// Perform a semantic search query
barq.query('What is Dabarqus?', 5, 'my-memory-bank')
  .then(results => console.log('Search results:', results))
  .catch(error => console.error('Error:', error));

API Reference

new Dabarqus(baseUrl)

Creates a new instance of the Dabarqus SDK.

Health Check

checkHealth()

Checks the health status of the Dabarqus service.

Silk (Semantic) Operations

getSilkStatus()

Gets the current status of the Silk (memory) system.

enableMemories()

Enables the memories in the Silk system.

disableMemories()

Disables the memories in the Silk system.

getMemoryBanks()

Retrieves information about all memory banks.

activateMemoryBank(bank)

Activates a specific memory bank.

  • bank (string): The name of the memory bank to activate.

deactivateMemoryBank(bank)

Deactivates a specific memory bank.

  • bank (string): The name of the memory bank to deactivate.

query(query, limit, memoryBank)

Performs a semantic search query.

  • query (string): The search query.
  • limit (number, optional): The maximum number of results to return. Defaults to 10.
  • memoryBank (string, optional): The memory bank to search in.

getEmbedding(input)

Generates an embedding for the given input.

  • input (string): The text to generate an embedding for.

Ingestion Operations

enqueueIngestion(params)

Enqueues a new ingestion job.

  • params (object): Parameters for the ingestion job.

cancelIngestion(bank)

Cancels an ongoing ingestion job.

  • bank (string): The name of the memory bank for which to cancel ingestion.

getIngestions(bank)

Retrieves information about ingestion jobs.

  • bank (string, optional): The name of the memory bank to get ingestions for.

Inference Operations

getInferenceInfo(alias)

Retrieves information about inference jobs.

  • alias (string, optional): The alias of the inference job to get information for.

startInference(params)

Starts a new inference job.

  • params (object): Parameters for the inference job.

stopInference(params)

Stops an ongoing inference job.

  • params (object): Parameters for stopping the inference job.

getInferenceStatus(alias)

Gets the status of an inference job.

  • alias (string, optional): The alias of the inference job to get status for.

resetInference(alias)

Resets an inference job.

  • alias (string): The alias of the inference job to reset.

restartInference()

Restarts the current inference job.

Hardware Information

getHardwareInfo()

Retrieves hardware information from the Dabarqus server.

Server Operations

shutdownServer()

Initiates a shutdown of the Dabarqus server.

Logging

writeToLog(logData)

Writes a log entry to the Dabarqus server.

  • logData (object): The log data to write.
1.1.1

9 months ago

1.1.2

9 months ago

1.1.0

9 months ago

1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago