Download the PHP package helgesverre/chromadb without Composer
On this page you can find all versions of the php package helgesverre/chromadb. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download helgesverre/chromadb
More information about helgesverre/chromadb
Files in helgesverre/chromadb
Package chromadb
Short Description PHP Client for the Chromadb Rest API
License MIT
Homepage https://github.com/helgesverre/chromadb
Informations about the package chromadb
ChromaDB PHP API Client
ChromaDB is an open-source vector database that allows you to store and query vector embeddings. This package provides a PHP client for the ChromaDB API.
Installation
You can install the package via composer:
You can publish the config file with:
This is the contents of the published config/chromadb.php
file:
Usage
Example: Semantic Search with ChromaDB and OpenAI Embeddings
This example demonstrates how to perform a semantic search in ChromaDB using embeddings generated from OpenAI.
Full code available in SemanticSearchTest.php.
Prepare Your Data
First, create an array of data you wish to index. In this example, we'll use blog posts with titles, summaries, and tags.
Generate Embeddings
Use OpenAI's embeddings API to convert the summaries of your blog posts into vector embeddings.
Create ChromaDB Collection
Create a collection in ChromaDB to store your blog post embeddings.
Insert into ChromaDB
Insert these embeddings, along with other blog post data, into your ChromaDB collection.
Creating a Search Vector with OpenAI
Generate a search vector for your query, akin to how you processed the blog posts.
Searching using the Embedding in ChromaDB
Use the ChromaDB client to perform a search with the generated embedding.
Running ChromaDB in Docker
To quickly get started with ChromaDB, you can run it in Docker
The auth token is set to test-token-chroma-local-dev
by default.
You can change this in the docker-compose.yml
file by changing the CHROMA_SERVER_AUTH_CREDENTIALS
environment
variable
To stop ChromaDB, run docker compose down
, to wipe all the data, run docker compose down -v
.
NOTE
The
docker-compose.yml
file in this repo is provided only as an example and should not be used in production.Go to the ChromaDB deployment documentation for more information on deploying Chroma in production.
Testing
License
The MIT License (MIT). Please see License File for more information.
All versions of chromadb with dependencies
saloonphp/saloon Version ^3.0
saloonphp/laravel-plugin Version ^v3.0.0
spatie/laravel-data Version ^3.10
spatie/laravel-package-tools Version ^1.14.0