oneofftech/librarian-client

OneOffTech Librarian AI service client.

dev-main 2025-04-23 18:25 UTC

This package is auto-updated.

Last update: 2025-04-23 18:30:04 UTC


README

Latest Version on Packagist Tests

Allow to interact with OneOffTech Librarian, an AI-enhanced knowledge search and synthesis agent for your organization's memories.

OneOffTech Librarian provides:

  • Enterprise search, retrieve your organization's knowledge via search or chat
  • Chat-based question and answer over multiple documents
  • Summarization of documents in different languages
  • Classification using existing machine learning models
  • Extract information in a structured manner using LLMs, usefull for comparative analysis.

Important

The Librarian client package is a work in progress. Expect API changes between releases.

Installation

You can install the package via Composer:

composer require oneofftech/librarian-client

Requirements

  • PHP 8.2+

Usage

The LibrarianConnector is the main entry point for interacting with the OneOffTech Librarian AI service.

To create an instance of the LibrarianConnector, you need to provide an authentication token and the base URL of the API. OneOffTech Librarian acts on a library, all or a subset of your organization's documents. Some of the features require a library identifier to perform actions on a specific set of documents. The library identifier is provided by OneOffTech during the configuration phase.

use OneOffTech\LibrarianClient\Connectors\LibrarianConnector;

$token = 'your-authentication-token';
$baseUrl = 'your-instance-url';

$connector = new LibrarianConnector($token, $baseUrl);

Managing Documents

List All Documents in a Library

$documents = $connector->documents('library-id')->all();

foreach ($documents->items as $document) {
    echo $document->id . ': ' . $document->title . PHP_EOL;
}

Get a Specific Document

$document = $connector->documents('library-id')->get('document-id');
echo $document->title;

Create a New Document

use OneOffTech\LibrarianClient\Dto\Document;
use OneOffTech\Parse\Client\DocumentFormat\DocumentNode;

$document = new Document(
    id: 'new-document-id',
    title: 'New Document',
    data: DocumentNode::fromString('Document content')->toArray(),
);

$response = $connector->documents('library-id')->create($document);

echo $response->status();

Use our Parxy service to get the document content.

Delete a Document

$response = $connector->documents('library-id')->delete('document-id');
echo $response->status();

Text and Document Classification

to be documented

Summaries

to be documented

Questions

to be documented

Structured extraction

to be documented

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Thank you for considering contributing to the Librarian client! The contribution guide can be found in the CONTRIBUTING.md file.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Supporters

The project is provided and supported by OneOff-Tech (UG).

Credits

License

The MIT License (MIT). Please see License File for more information.