This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
- Build project:
mvn clean compile - Run all tests:
mvn test - Run specific test class:
mvn test -Dtest=TestClassName - Run specific test method:
mvn test -Dtest=TestClassName#testMethodName - Package JAR:
mvn clean package - Install to local Maven repository:
mvn clean install - Skip tests during build:
mvn clean install -DskipTests
- Set Chroma version for tests:
export CHROMA_VERSION=1.0.0 && mvn test - Target: ChromaDB
>=1.0.0
OPENAI_API_KEY- Required for OpenAI embedding testsCOHERE_API_KEY- Required for Cohere embedding testsHF_API_KEY- Required for HuggingFace embedding testsCHROMA_VERSION- Specifies ChromaDB version for integration testsTEI_VERSION- Override HuggingFace TEI image version (default: 1.8.3)TEI_IMAGE- Override HuggingFace TEI image registry
The client is being migrated to a v2 API with an interface-first design:
-
Client Interface (
tech.amikos.chromadb.v2.Client)- Top-level interface for all ChromaDB operations (health, tenant/database CRUD, collection lifecycle)
- Extends
AutoCloseable - Instances created via
ChromaClient.builder()(self-hosted) orChromaClient.cloud()(Chroma Cloud)
-
Collection Interface (
tech.amikos.chromadb.v2.Collection)- Fluent builder pattern for record operations (add, query, get, update, upsert, delete)
- Type-safe filter DSL via
WhereandWhereDocumentclasses
-
Exception Hierarchy (
tech.amikos.chromadb.v2.ChromaException)- Unchecked (RuntimeException-based) for fluent API ergonomics
ChromaClientException(4xx) with specific subclasses: BadRequest (400), Unauthorized (401), Forbidden (403), NotFound (404), Conflict (409)ChromaServerException(5xx)ChromaConnectionExceptionfor network/timeout errors- Factory method:
ChromaExceptions.fromHttpResponse(statusCode, message, errorCode)
-
Auth Providers (
AuthProviderinterface)BasicAuth— HTTP Basic authenticationTokenAuth— Bearer token authenticationChromaTokenAuth— X-Chroma-Token header authentication
-
Value Objects
Tenant,Database— immutable identifiers with equals/hashCodeDistanceFunction,Include— enums for query configurationCollectionConfiguration— immutable HNSW parameters via builder
- Multiple provider implementations (OpenAI, Cohere, HuggingFace, Ollama, Default)
- Each implements
EmbeddingFunctioninterface - Default embedding uses ONNX Runtime for local inference
-
Authentication Handling
- Supports multiple auth methods: Basic Auth, Bearer Token, X-Chroma-Token
- Auth providers implement
AuthProviderinterface and apply headers viaapplyAuth()
-
Collection Management
- Collections are the primary abstraction for vector storage
- Record operations use fluent builders terminated by
execute() - Metadata and documents are stored alongside embeddings
-
Sync Operations
- Primary operations are synchronous
- HTTP client uses OkHttp with configurable timeouts
- Unit Tests: Test v2 value objects, auth providers, exception hierarchy, and builders
- Integration Tests: Use TestContainers with actual ChromaDB Docker images
- Test Container:
chromadb/chromawith configurable versions - Tests target ChromaDB
>=1.0.0
- Implement
EmbeddingFunctioninterface intech.amikos.chromadb.embeddings - Add corresponding tests in test directory
- Update README.md with usage examples
- Update or add interfaces/classes in
tech.amikos.chromadb.v2 - Add corresponding unit tests
- Ensure Java 8 compatibility is maintained
- Target Java 8 for maximum compatibility
- ChromaDB versions:
>=1.0.0 - Maintain backward compatibility when possible
- Artifacts published to Maven Central under
io.github.amikos-tech:chromadb-java-client - Release process triggered via GitHub Actions on tag push
- Signing required for Maven Central deployment