- How do I install and connect this ChromaDB PHP package in Laravel?
- Run `composer require codewithkyrian/chromadb-php` to install. Use `ChromaDB::local()->connect()` for self-hosted instances or `ChromaDB::cloud('your-api-key')->connect()` for Chroma Cloud. Configure the host, port, and tenant via fluent methods like `withHost()` or `withTenant()`.
- Does this package support Laravel’s HTTP client (symfony/http-client) instead of Guzzle?
- Yes, the package is PSR-18 compliant and auto-discovers Laravel’s HTTP client. If needed, it falls back to Guzzle. No manual Guzzle installation is required unless explicitly configured.
- Can I use this SDK with Chroma Cloud’s forking collections feature?
- Absolutely. The package fully supports Chroma Cloud’s forking collections via `ChromaDB::cloud()` and methods like `forkCollection()`. This is useful for A/B testing embeddings or canary deployments in Laravel applications.
- How do I handle partial or mixed embeddings (some null, some non-null) in Laravel?
- The SDK validates data before ingestion and supports partial embeddings natively. Use `Record::make()` with mixed arrays, and the package will handle validation automatically. This is ideal for incremental data pipelines.
- Will this package work with Laravel 10 and PHP 8.1+?
- Yes, the package is fully compatible with Laravel 10 and PHP 8.1+. It leverages PHP 8.1 features like named arguments and enums, ensuring seamless integration with modern Laravel applications.
- How can I integrate ChromaDB with Laravel Eloquent models?
- Use the `toRecord()` method or trait to convert Eloquent models into ChromaDB `Record` objects. For example, `Model::toRecord()` simplifies interactions, allowing you to sync Laravel data with ChromaDB collections effortlessly.
- What are the alternatives if Chroma Cloud goes down or has rate limits?
- Configure fallback strategies like caching responses with Laravel’s cache system or degrading to keyword search. Monitor Chroma Cloud usage via `collection->usage()` and set Laravel rate limits to manage costs.
- How do I handle schema changes in ChromaDB collections when using Laravel migrations?
- Track ChromaDB schemas using Laravel migrations by defining schema fields in your migration files. The package provides structured `Record` validation to prevent malformed data ingestion, ensuring consistency.
- Can I use this SDK for async operations, like background embedding generation?
- Yes, leverage Laravel Queues to dispatch embedding generation tasks. Use `Record::make()->dispatch()` to process embeddings asynchronously, integrating with Chroma Cloud’s async APIs via Laravel Promises.
- How do I monitor ChromaDB API usage and costs in a Laravel application?
- Use Chroma’s built-in `collection->usage()` method to track API calls and costs. Integrate this with Laravel Debugbar or custom metrics to log ChromaDB usage, helping you optimize performance and budget.