# Chroma Self Query Retriever

This example shows how to use a self query retriever with a Chroma vector store.

## Usage

import CodeBlock from "@theme/CodeBlock";
import Example from "@examples/retrievers/chroma_self_query.ts";

<CodeBlock language="typescript">{Example}</CodeBlock>

You can also initialize the retriever with default search parameters that apply in
addition to the generated query:

```typescript
const selfQueryRetriever = await SelfQueryRetriever.fromLLM({
  llm,
  vectorStore,
  documentContents,
  attributeInfo,
  /**
   * We need to create a basic translator that translates the queries into a
   * filter format that the vector store can understand. We provide a basic translator
   * translator here, but you can create your own translator by extending BaseTranslator
   * abstract class. Note that the vector store needs to support filtering on the metadata
   * attributes you want to query on.
   */
  structuredQueryTranslator: new ChromaTranslator(),
  searchParams: {
    filter: {
      rating: {
        $gt: 8.5
      }
    },
    mergeFiltersOperator: "and",
  }
});
```

See [the official docs](https://docs.trychroma.com/usage-guide#using-where-filters) for a full list of filters.