configuration.mdx 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. ---
  2. title: '⚙️ Custom configurations'
  3. ---
  4. Embedchain is made to work out of the box. However, for advanced users we're also offering configuration options. All of these configuration options are optional and have sane defaults.
  5. 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:
  6. ```yaml
  7. app:
  8. config:
  9. id: 'full-stack-app'
  10. chunker:
  11. chunk_size: 100
  12. chunk_overlap: 20
  13. length_function: 'len'
  14. llm:
  15. provider: openai
  16. config:
  17. model: 'gpt-3.5-turbo'
  18. temperature: 0.5
  19. max_tokens: 1000
  20. top_p: 1
  21. stream: false
  22. template: |
  23. Use the following pieces of context to answer the query at the end.
  24. If you don't know the answer, just say that you don't know, don't try to make up an answer.
  25. $context
  26. Query: $query
  27. Helpful Answer:
  28. system_prompt: |
  29. Act as William Shakespeare. Answer the following questions in the style of William Shakespeare.
  30. vectordb:
  31. provider: chroma
  32. config:
  33. collection_name: 'full-stack-app'
  34. dir: db
  35. allow_reset: true
  36. embedder:
  37. provider: openai
  38. config:
  39. model: 'text-embedding-ada-002'
  40. ```
  41. Alright, let's dive into what each key means in the yaml config above:
  42. 1. `app` Section:
  43. - `config`:
  44. - `id` (String): The ID or name of your full-stack application.
  45. 2. `chunker` Section:
  46. - `chunk_size` (Integer): The size of each chunk of text that is sent to the language model.
  47. - `chunk_overlap` (Integer): The amount of overlap between each chunk of text.
  48. - `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.
  49. 3. `llm` Section:
  50. - `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).
  51. - `model` (String): The specific model being used, 'gpt-3.5-turbo'.
  52. - `config`:
  53. - `temperature` (Float): Controls the randomness of the model's output. A higher value (closer to 1) makes the output more random.
  54. - `max_tokens` (Integer): Controls how many tokens are used in the response.
  55. - `top_p` (Float): Controls the diversity of word selection. A higher value (closer to 1) makes word selection more diverse.
  56. - `stream` (Boolean): Controls if the response is streamed back to the user (set to false).
  57. - `template` (String): A custom template for the prompt that the model uses to generate responses.
  58. - `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.
  59. 4. `vectordb` Section:
  60. - `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).
  61. - `config`:
  62. - `collection_name` (String): The initial collection name for the database, set to 'full-stack-app'.
  63. - `dir` (String): The directory for the database, set to 'db'.
  64. - `allow_reset` (Boolean): Indicates whether resetting the database is allowed, set to true.
  65. 5. `embedder` Section:
  66. - `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).
  67. - `config`:
  68. - `model` (String): The specific model used for text embedding, 'text-embedding-ada-002'.
  69. If you have questions about the configuration above, please feel free to reach out to us using one of the following methods:
  70. <Snippet file="get-help.mdx" />