> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ag2.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# autogen.agents.experimental.VectorChromaQueryEngine

<h2 id="autogen.agents.experimental.VectorChromaQueryEngine" class="doc doc-heading">
  <code class="doc-symbol doc-symbol-heading doc-symbol-class" />

  <span class="doc doc-object-name doc-class-name">VectorChromaQueryEngine</span>
</h2>

```python theme={null}
VectorChromaQueryEngine(
    db_path: str | None = None,
    embedding_function: Optional[EmbeddingFunction[Any]] = None,
    metadata: dict[str, Any] | None = None,
    llm: ForwardRef('LLM') | None = None,
    collection_name: str | None = None
)
```

This engine leverages Chromadb to persist document embeddings in a named collection
and LlamaIndex's VectorStoreIndex to efficiently index and retrieve documents, and generate an answer in response
to natural language queries. The Chromadb collection serves as the storage layer, while
the collection name uniquely identifies the set of documents within the persistent database.<br />This implements the autogen.agentchat.contrib.rag.RAGQueryEngine protocol.<br />Initializes the VectorChromaQueryEngine with db\_path, metadata, and embedding function and llm.<br />

<b>Parameters:</b>

| Name                 | Description                                                               |
| -------------------- | ------------------------------------------------------------------------- |
| `db_path`            | **Type:** str \| None<br /><br />**Default:** None                        |
| `embedding_function` | **Type:** Optional\[EmbeddingFunction\[Any]]<br /><br />**Default:** None |
| `metadata`           | **Type:** dict\[str, typing.Any] \| None<br /><br />**Default:** None     |
| `llm`                | **Type:** ForwardRef('LLM') \| None<br /><br />**Default:** None          |
| `collection_name`    | **Type:** str \| None<br /><br />**Default:** None                        |

### Instance Methods

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### add\_docs

```python theme={null}
add_docs(
    self,
    new_doc_dir: Path | str | None = None,
    new_doc_paths_or_urls: Sequence[Path | str] | None = None
) -> None
```

Add additional documents to the existing vector index.<br />Loads new Docling-parsed Markdown files from a specified directory or a list of file paths
and inserts them into the current index for future queries.<br />

<b>Parameters:</b>

| Name                    | Description                                                                                                                                                                                                           |
| ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `new_doc_dir`           | The directory path from which to load additional documents.<br /><br />If provided, all eligible files in this directory are loaded.<br /><br />**Type:** pathlib.Path \| str \| None<br /><br />**Default:** None    |
| `new_doc_paths_or_urls` | A list of file paths specifying additional documents to load.<br /><br />Each file should be a Docling-parsed Markdown file.<br /><br />**Type:** Sequence\[pathlib.Path \| str] \| None<br /><br />**Default:** None |

<br />

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### connect\_db

```python theme={null}
connect_db(
    self,
    *args: Any,
    **kwargs: Any
) -> bool
```

Establish a connection to the Chromadb database and initialize the collection.

<b>Parameters:</b>

| Name       | Description   |
| ---------- | ------------- |
| `*args`    | **Type:** Any |
| `**kwargs` | **Type:** Any |

<br />

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### get\_collection\_name

```python theme={null}
get_collection_name(self) -> str
```

Get the name of the collection used by the query engine.<br />Returns: <br />    The name of the collection.

<b>Returns:</b>

| Type | Description                 |
| ---- | --------------------------- |
| str  | The name of the collection. |

<br />

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### init\_db

```python theme={null}
init_db(
    self,
    new_doc_dir: Path | str | None = None,
    new_doc_paths_or_urls: Sequence[Path | str] | None = None,
    *args: Any,
    **kwargs: Any
) -> bool
```

Not required nor implemented for VectorChromaQueryEngine

<b>Parameters:</b>

| Name                    | Description                                                                   |
| ----------------------- | ----------------------------------------------------------------------------- |
| `new_doc_dir`           | **Type:** pathlib.Path \| str \| None<br /><br />**Default:** None            |
| `new_doc_paths_or_urls` | **Type:** Sequence\[pathlib.Path \| str] \| None<br /><br />**Default:** None |
| `*args`                 | **Type:** Any                                                                 |
| `**kwargs`              | **Type:** Any                                                                 |

<br />

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### query

```python theme={null}
query(self, question: str) -> str
```

Retrieve information from indexed documents by processing a natural language query.<br />

<b>Parameters:</b>

| Name       | Description                                                                                    |
| ---------- | ---------------------------------------------------------------------------------------------- |
| `question` | A natural language query string used to search the indexed documents.<br /><br />**Type:** str |

<b>Returns:</b>

| Type | Description                                        |
| ---- | -------------------------------------------------- |
| str  | A string containing the response generated by LLM. |

<br />

<code class="doc-symbol doc-symbol-heading doc-symbol-method" />

#### validate\_query\_index

```python theme={null}
validate_query_index(self) -> None
```

Ensures an index exists

<br />
