---
title: 'Custom configurations'
---

Embedchain offers several configuration options for your LLM, vector database, and embedding model. All of these configuration options are optional and have sane defaults.

You can configure different components of your app (`llm`, `embedding model`, or `vector database`) through a simple yaml configuration that Embedchain offers. Here is a generic full-stack example of the yaml config:


<Tip>
Embedchain applications are configurable using YAML file, JSON file or by directly passing the config dictionary. Checkout the [docs here](/api-reference/pipeline/overview#usage) on how to use other formats.
</Tip>

<CodeGroup>
```yaml config.yaml
app:
  config:
    name: 'full-stack-app'

llm:
  provider: openai
  config:
    model: 'gpt-3.5-turbo'
    temperature: 0.5
    max_tokens: 1000
    top_p: 1
    stream: false
    template: |
      Use the following pieces of context to answer the query at the end.
      If you don't know the answer, just say that you don't know, don't try to make up an answer.

      $context

      Query: $query

      Helpful Answer:
    system_prompt: |
      Act as William Shakespeare. Answer the following questions in the style of William Shakespeare.

vectordb:
  provider: chroma
  config:
    collection_name: 'full-stack-app'
    dir: db
    allow_reset: true

embedder:
  provider: openai
  config:
    model: 'text-embedding-ada-002'

chunker:
  chunk_size: 2000
  chunk_overlap: 100
  length_function: 'len'
  min_chunk_size: 0
```

```json config.json
{
  "app": {
    "config": {
      "name": "full-stack-app"
    }
  },
  "llm": {
    "provider": "openai",
    "config": {
      "model": "gpt-3.5-turbo",
      "temperature": 0.5,
      "max_tokens": 1000,
      "top_p": 1,
      "stream": false,
      "template": "Use the following pieces of context to answer the query at the end.\nIf you don't know the answer, just say that you don't know, don't try to make up an answer.\n$context\n\nQuery: $query\n\nHelpful Answer:",
      "system_prompt": "Act as William Shakespeare. Answer the following questions in the style of William Shakespeare."
    }
  },
  "vectordb": {
    "provider": "chroma",
    "config": {
      "collection_name": "full-stack-app",
      "dir": "db",
      "allow_reset": true
    }
  },
  "embedder": {
    "provider": "openai",
    "config": {
      "model": "text-embedding-ada-002"
    }
  },
  "chunker": {
    "chunk_size": 2000,
    "chunk_overlap": 100,
    "length_function": "len",
    "min_chunk_size": 0
  }
}
```

```python config.py
config = {
    'app': {
        'config': {
            'name': 'full-stack-app'
        }
    },
    'llm': {
        'provider': 'openai',
        'config': {
            'model': 'gpt-3.5-turbo',
            'temperature': 0.5,
            'max_tokens': 1000,
            'top_p': 1,
            'stream': False,
            'template': (
                "Use the following pieces of context to answer the query at the end.\n"
                "If you don't know the answer, just say that you don't know, don't try to make up an answer.\n"
                "$context\n\nQuery: $query\n\nHelpful Answer:"
            ),
            'system_prompt': (
                "Act as William Shakespeare. Answer the following questions in the style of William Shakespeare."
            )
        }
    },
    'vectordb': {
        'provider': 'chroma',
        'config': {
            'collection_name': 'full-stack-app',
            'dir': 'db',
            'allow_reset': True
        }
    },
    'embedder': {
        'provider': 'openai',
        'config': {
            'model': 'text-embedding-ada-002'
        }
    },
    'chunker': {
        'chunk_size': 2000,
        'chunk_overlap': 100,
        'length_function': 'len',
        'min_chunk_size': 0
    }
}
```
</CodeGroup>

Alright, let's dive into what each key means in the yaml config above:

1. `app` Section:
    - `config`:
        - `name` (String): The name of your full-stack application.
        - `id` (String): The id of your full-stack application.
        <Note>Only use this to reload already created apps. We recommend users to not create their own ids.</Note>
        - `collect_metrics` (Boolean): Indicates whether metrics should be collected for the app, defaults to `True`
        - `log_level` (String): The log level for the app, defaults to `WARNING`
2. `llm` Section:
    - `provider` (String): The provider for the language model, which is set to 'openai'. You can find the full list of llm providers in [our docs](/components/llms).
    - `config`:
        - `model` (String): The specific model being used, 'gpt-3.5-turbo'.
        - `temperature` (Float): Controls the randomness of the model's output. A higher value (closer to 1) makes the output more random.
        - `max_tokens` (Integer): Controls how many tokens are used in the response.
        - `top_p` (Float): Controls the diversity of word selection. A higher value (closer to 1) makes word selection more diverse.
        - `stream` (Boolean): Controls if the response is streamed back to the user (set to false).
        - `template` (String): A custom template for the prompt that the model uses to generate responses.
        - `system_prompt` (String): A system prompt for the model to follow when generating responses, in this case, it's set to the style of William Shakespeare.
        -  `stream` (Boolean): Controls if the response is streamed back to the user (set to false).
        - `number_documents` (Integer): Number of documents to pull from the vectordb as context, defaults to 1
3. `vectordb` Section:
    - `provider` (String): The provider for the vector database, set to 'chroma'. You can find the full list of vector database providers in [our docs](/components/vector-databases).
    - `config`:
        - `collection_name` (String): The initial collection name for the vectordb, set to 'full-stack-app'.
        - `dir` (String): The directory for the local database, set to 'db'.
        - `allow_reset` (Boolean): Indicates whether resetting the vectordb is allowed, set to true.
    <Note>We recommend you to checkout vectordb specific config [here](https://docs.embedchain.ai/components/vector-databases)</Note>
4. `embedder` Section:
    - `provider` (String): The provider for the embedder, set to 'openai'. You can find the full list of embedding model providers in [our docs](/components/embedding-models).
    - `config`:
        - `model` (String): The specific model used for text embedding, 'text-embedding-ada-002'.
5. `chunker` Section:
    - `chunk_size` (Integer): The size of each chunk of text that is sent to the language model.
    - `chunk_overlap` (Integer): The amount of overlap between each chunk of text.
    - `length_function` (String): The function used to calculate the length of each chunk of text. In this case, it's set to 'len'. You can also use any function import directly as a string here.
    - `min_chunk_size` (Integer): The minimum size of each chunk of text that is sent to the language model. Must be less than `chunk_size`, and greater than `chunk_overlap`.

If you have questions about the configuration above, please feel free to reach out to us using one of the following methods:

<Snippet file="get-help.mdx" />