@@ -100,23 +100,12 @@ Or if you prefer using a docker-compose file, you can use the following:
100100version : ' 3.9'
101101
102102services :
103- server :
103+ chroma :
104104 image : ' chromadb/chroma'
105- command : uvicorn chromadb.app:app --reload --workers 1 --host 0.0.0.0 --port 8000 --log-config chromadb/log_config.yml --timeout-keep-alive 30
106105 ports :
107106 - ' 8000:8000'
108107 volumes :
109108 - chroma-data:/chroma/chroma
110- environment :
111- - IS_PERSISTENT=TRUE
112- - CHROMA_SERVER_NOFILE=65535
113- - ALLOW_RESET=true
114- networks :
115- - net
116-
117- networks :
118- net :
119- driver : bridge
120109
121110volumes :
122111 chroma-data :
@@ -202,9 +191,8 @@ $collection->add($ids, $embeddings, $metadatas);
202191To insert documents into a collection, you need to provide the following:
203192
204193- ` ids ` : An array of document ids. The ids must be unique and must be strings.
205- - ` embeddings ` : An array of document embeddings. The embeddings must be a 1D array of floats with a length of 10. You
206- can
207- compute the embeddings using any embedding model of your choice (just make sure that's what you use when querying as
194+ - ` embeddings ` : An array of document embeddings. The embeddings must be a 1D array of floats with a consistent length. You
195+ can compute the embeddings using any embedding model of your choice (just make sure that's what you use when querying as
208196 well).
209197- ` metadatas ` : An array of document metadatas. The metadatas must be an array of key-value pairs.
210198
@@ -436,55 +424,54 @@ To query a collection, you need to provide the following:
436424 ]
437425 );
438426 ```
439- - `whereDocument` (optional): The where clause to use to filter items based on their document. Here's an example:
440- ```php
441- $queryResponse = $collection->query(
442- queryEmbeddings: [
443- [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0]
444- ],
445- nResults: 2,
446- whereDocument: [
447- 'text' => 'This is a test document'
448- ]
449- );
427+ - `whereDocument` (optional): The where clause to use to filter items based on their document. Here's an example:
428+ ```php
429+ $queryResponse = $collection->query(
430+ queryEmbeddings: [
431+ [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0]
432+ ],
433+ nResults: 2,
434+ whereDocument: [
435+ 'text' => 'This is a test document'
436+ ]
437+ );
450438
451- echo $queryResponse->ids[0][0]; // test1
452- ```
453- The where clause must be an array of key-value pairs. The key must be a string, and the value can be a string or
454- an array of valid filter values. In this case, only two filtering keys are supported - `$contains`
455- and `$not_contains`.
456-
457- Here's an example:
458- ```php
459- $queryResponse = $collection->query(
460- queryEmbeddings: [
461- [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0]
462- ],
463- nResults: 2,
464- whereDocument: [
465- 'text' => [
466- '$contains' => 'test document'
467- ]
439+ echo $queryResponse->ids[0][0]; // test1
440+ ```
441+ The where clause must be an array of key-value pairs. The key must be a string, and the value can be a string or
442+ an array of valid filter values. In this case, only two filtering keys are supported - ` $contains `
443+ and ` $not_contains ` .
444+
445+ Here's an example:
446+ ``` php
447+ $queryResponse = $collection->query(
448+ queryEmbeddings: [
449+ [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0]
450+ ],
451+ nResults: 2,
452+ whereDocument: [
453+ 'text' => [
454+ '$contains' => 'test document'
468455 ]
469- );
470- ```
471- - `include` (optional): An array of fields to include in the response. Possible values
472- are `embeddings`, `documents`, `metadatas` and `distances`. It defaults to `embeddings`
473- and `metadatas` ( `documents` are not included by default because they can be large).
474- ```php
475- $queryResponse = $collection->query(
476- queryEmbeddings: [
477- [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0]
478- ],
479- nResults: 2 ,
480- include: ['embeddings']
481- );
482- ```
483- `distances` is only valid for querying and not for getting. It returns the distances between the query embeddings
484- and the embeddings of the results.
485-
486- Other relevant information about querying and retrieving a collection can be found in
487- the [ChromaDB Documentation](https://docs.trychroma.com/usage-guide).
456+ ]
457+ );
458+ ```
459+ - ` include ` (optional): An array of fields to include in the response. Possible values
460+ are ` embeddings ` , ` documents ` , ` metadatas ` and ` distances ` . It defaults to ` embeddings `
461+ and ` metadatas ` ( ` documents ` are not included by default because they can be large).
462+ ``` php
463+ $queryResponse = $collection->query(
464+ queryEmbeddings: [
465+ [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0]
466+ ] ,
467+ nResults: 2,
468+ include: ['embeddings']
469+ );
470+ ```
471+ ` distances ` is only valid for querying and not for getting. It returns the distances between the query embeddings
472+ and the embeddings of the results.
473+
474+ Other relevant information about querying and retrieving a collection can be found in the [ ChromaDB Documentation] ( https://docs.trychroma.com/usage-guide ) .
488475
489476### Deleting items in a collection
490477
0 commit comments