# Retriever

[**`gllm-retrieval`**](https://github.com/GDP-ADMIN/gl-sdk/tree/main/libs/gllm-retrieval/gllm_retrieval/retriever) | <mark style="color:green;background-color:green;">Involves EM</mark> |  **Tutorial**: [retriever](https://gdplabs.gitbook.io/sdk/~/revisions/w6A7tUKJGDYFXuci5HcW/tutorials/retrieval/retriever "mention") | **Use Case:** [#create-the-retriever](https://gdplabs.gitbook.io/sdk/~/revisions/w6A7tUKJGDYFXuci5HcW/how-to-guides/build-end-to-end-rag-pipeline/your-first-rag-pipeline#create-the-retriever "mention") | [API Reference](https://api.python.docs.gdplabs.id/gen-ai/library/gllm_retrieval/api/retriever.html)

### What is a Retriever?

A **Retriever** is a fundamental component in Gen AI applications that is responsible for finding and retrieving relevant information from various data sources based on user queries.

#### How Retrievers Work:

1. **Query Input**: Receives a user query (text, structured query, or natural language)
2. **Query Processing**: Transforms the query into a format suitable for the target data source
3. **Data Retrieval**: Searches the connected data store(s) for relevant information
4. **Output**: Returns structured results (typically as `Chunk` objects) with metadata

### What You Can Do with a Retriever

GL SDK provides several retriever types, each designed for specific use cases and data storage requirements:

1. [Vector Retriever](https://gdplabs.gitbook.io/sdk/~/revisions/w6A7tUKJGDYFXuci5HcW/tutorials/retrieval/retriever/vector-retriever): For semantic search over vector embeddings.
2. [SQL Retriever](https://gdplabs.gitbook.io/sdk/~/revisions/w6A7tUKJGDYFXuci5HcW/tutorials/retrieval/retriever/sql-retriever): For relational database queries (natural language or SQL).
3. [Graph Retriever](https://gdplabs.gitbook.io/sdk/~/revisions/w6A7tUKJGDYFXuci5HcW/tutorials/knowledge-graph/graph-retriever): For traversing and querying graph-structured knowledge.

GL SDK makes it easy to perform common data operations regardless of which retriever type you choose. One of the most powerful features of the GL SDK is its unified approach to data storage. All datastores support storing data in a structured format using the `Chunk` schema.&#x20;

Think of chunks as standardized containers for your data - they provide a consistent way to represent information across different storage types, making it easy to switch between datastores or combine them in your application.

```python
from gllm_core.schema import Chunk

# Create chunks with structured content
chunks = [
    Chunk(content="AI is the future of technology."),
    Chunk(content="Machine learning enables pattern recognition."),
    Chunk(content="Deep learning powers modern AI applications.")
]
```
