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

# Camel.retrievers.auto retriever

<a id="camel.retrievers.auto_retriever" />

<a id="camel.retrievers.auto_retriever.AutoRetriever" />

## AutoRetriever

```python theme={"system"}
class AutoRetriever:
```

Facilitates the automatic retrieval of information using a
query-based approach with pre-defined elements.

**Parameters:**

* **url\_and\_api\_key** (Optional\[Tuple\[str, str]]): URL and API key for accessing the vector storage remotely.
* **vector\_storage\_local\_path** (Optional\[str]): Local path for vector storage, if applicable.
* **storage\_type** (Optional\[StorageType]): The type of vector storage to use. Defaults to `StorageType.QDRANT`.
* **embedding\_model** (Optional\[BaseEmbedding]): Model used for embedding queries and documents. Defaults to `OpenAIEmbedding()`.

<a id="camel.retrievers.auto_retriever.AutoRetriever.__init__" />

### **init**

```python theme={"system"}
def __init__(
    self,
    url_and_api_key: Optional[Tuple[str, str]] = None,
    vector_storage_local_path: Optional[str] = None,
    storage_type: Optional[StorageType] = None,
    embedding_model: Optional[BaseEmbedding] = None
):
```

<a id="camel.retrievers.auto_retriever.AutoRetriever._initialize_vector_storage" />

### \_initialize\_vector\_storage

```python theme={"system"}
def _initialize_vector_storage(self, collection_name: Optional[str] = None):
```

Sets up and returns a vector storage instance with specified
parameters.

**Parameters:**

* **collection\_name** (Optional\[str]): Name of the collection in the vector storage.

**Returns:**

BaseVectorStorage: Configured vector storage instance.

<a id="camel.retrievers.auto_retriever.AutoRetriever._collection_name_generator" />

### \_collection\_name\_generator

```python theme={"system"}
def _collection_name_generator(self, content: Union[str, 'Element']):
```

Generates a valid collection name from a given file path or URL.

**Parameters:**

* **content** (Union\[str, Element]): Local file path, remote URL, string content or Element object.

**Returns:**

str: A sanitized, valid collection name suitable for use.

<a id="camel.retrievers.auto_retriever.AutoRetriever.run_vector_retriever" />

### run\_vector\_retriever

```python theme={"system"}
def run_vector_retriever(
    self,
    query: str,
    contents: Union[str, List[str], 'Element', List['Element']],
    top_k: int = Constants.DEFAULT_TOP_K_RESULTS,
    similarity_threshold: float = Constants.DEFAULT_SIMILARITY_THRESHOLD,
    return_detailed_info: bool = False,
    max_characters: int = 500
):
```

Executes the automatic vector retriever process using vector
storage.

**Parameters:**

* **query** (str): Query string for information retriever.
* **contents** (Union\[str, List\[str], Element, List\[Element]]): Local file paths, remote URLs, string contents or Element objects.
* **top\_k** (int, optional): The number of top results to return during retrieve. Must be a positive integer. Defaults to `DEFAULT_TOP_K_RESULTS`.
* **similarity\_threshold** (float, optional): The similarity threshold for filtering results. Defaults to `DEFAULT_SIMILARITY_THRESHOLD`.
* **return\_detailed\_info** (bool, optional): Whether to return detailed information including similarity score, content path and metadata. Defaults to `False`.
* **max\_characters** (int): Max number of characters in each chunk. Defaults to `500`.

**Returns:**

dict\[str, Sequence\[Collection\[str]]]: By default, returns
only the text information. If `return_detailed_info` is
`True`, return detailed information including similarity
score, content path and metadata.
