NAME

WebService::Chroma - chromadb client

VERSION

Version 0.06

SYNOPSIS

use WebService::Chroma;

my $chroma = WebService::Chroma->new(
	embeddings_class => 'OpenAI', # you will need OPENAI_API_KEY env variable set
);

my $version = $chroma->version();

my $tenant = $chroma->create_tenant(
	name => 'testing-tenant'
);

my $db = $tenant->create_database(
	name => 'testing-db'
);

my $collection = $db->create_collection(
	name => 'testing'
);

...

my $db = $chroma->get_tenant(
	name => 'testing-tenant'
)->get_database(
	name => 'testing-db'
);

my $collection = $db->get_collection(
	name => 'testing'
);

$collection->add(
	documents => [
		'a blue scarf, a red hat, a woolly jumper, black gloves',
		'a pink scarf, a blue hat, a woolly jumper, green gloves'
	],
	ids => [
		"1",
		"2"
	]
);

$collection->query(
	query_texts => [
		'a pink scarf, a blue hat, green gloves'
	],
	n_results => 1
);

Description

Chroma is the AI-native open-source vector database. Chroma makes it easy to build LLM apps by making knowledge, facts, and skills pluggable for LLMs.

https://docs.trychroma.com/getting-started https://docs.trychroma.com/deployment/client-server-mode

chroma run --path /db_path

http://localhost:8000/docs

Methods

new

Instantiate a new WebService::Chroma object.

my $chroma = WebService::Chroma->new(
	base_url => 'http://localhost:8000',
	embeddings_class => 'Ollama',
	embeddings_model => 'nomic-embed-text',
	embeddings_base_url => 'http://localhost:11434'
);

base_url

The base url for chroma default is http://localhost:8000.

embeddings_class

The embeddings class used to generate embeddings current built in options are Ollama or OpenAI.

embeddings_model

The embeddings class model the default for Ollama is nomic-embed-text and the default for OpenAI is text-embedding-3-large.

embeddings_base_url

The embeddings class base url, this defaults to http://localhost:11434 for Ollama.

version

Retrieve chroma version.

$chroma->version();

reset

Reset chroma instance.

$chroma->reset();

heartbeat

Heartbeat of chroma.

$chroma->heartbeat();

pre_flight_checks

Check status of pre flight checks.

$chroma->pre_flight_checks();

auth_identity

Get user identity.

$chroma->auth_identity();

create_tenant

Create a new tenant. This returns a WebService::Chroma::Tenant object.

$chroma->create_tenant(
	name => 'test-tenant'
);

get_tenant

Retrieve an existing tenant. This returns a WebService::Chroma::Tenant object.

$chroma->get_tenant(
	name => 'test-tenant'
);

get_database

Retrieve an existing database. This returns a WebService::Chroma::DB object.

$chroma->get_database(
	tenant => 'test-tenant',
	name => 'test-database',
);

get_collection

Retrieve an existing collection. This return a WebService::Chroma::Collection object.

$chroma->get_collection(
	tenant => 'test-tenant',
	db => 'test-database',
	name => 'test-collection'
);

AUTHOR

LNATION, <email at lnation.org>

BUGS

Please report any bugs or feature requests to bug-webservice-chroma at rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=WebService-Chroma. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc WebService::Chroma

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

This software is Copyright (c) 2024 by LNATION.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)