add.mdx 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. ---
  2. title: '📊 add'
  3. ---
  4. `add()` method is used to load the data sources from different data sources to a RAG pipeline. You can find the signature below:
  5. ### Parameters
  6. <ParamField path="source" type="str">
  7. The data to embed, can be a URL, local file or raw content, depending on the data type.. You can find the full list of supported data sources [here](/components/data-sources/overview).
  8. </ParamField>
  9. <ParamField path="data_type" type="str" optional>
  10. Type of data source. It can be automatically detected but user can force what data type to load as.
  11. </ParamField>
  12. <ParamField path="metadata" type="dict" optional>
  13. Any metadata that you want to store with the data source. Metadata is generally really useful for doing metadata filtering on top of semantic search to yield faster search and better results.
  14. </ParamField>
  15. ## Usage
  16. ### Load data from webpage
  17. ```python Code example
  18. from embedchain import App
  19. app = App()
  20. app.add("https://www.forbes.com/profile/elon-musk")
  21. # Inserting batches in chromadb: 100%|███████████████| 1/1 [00:00<00:00, 1.19it/s]
  22. # Successfully saved https://www.forbes.com/profile/elon-musk (DataType.WEB_PAGE). New chunks count: 4
  23. ```
  24. ### Load data from sitemap
  25. ```python Code example
  26. from embedchain import App
  27. app = App()
  28. app.add("https://python.langchain.com/sitemap.xml", data_type="sitemap")
  29. # Loading pages: 100%|█████████████| 1108/1108 [00:47<00:00, 23.17it/s]
  30. # Inserting batches in chromadb: 100%|█████████| 111/111 [04:41<00:00, 2.54s/it]
  31. # Successfully saved https://python.langchain.com/sitemap.xml (DataType.SITEMAP). New chunks count: 11024
  32. ```
  33. You can find complete list of supported data sources [here](/components/data-sources/overview).