quickstart.mdx 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. ---
  2. title: '🚀 Quickstart'
  3. description: '💡 Start building LLM powered apps under 30 seconds'
  4. ---
  5. Embedchain is a Data Platform for LLMs - load, index, retrieve, and sync any unstructured data. Using embedchain, you can easily create LLM powered apps over any data.
  6. Install embedchain python package:
  7. ```bash
  8. pip install embedchain
  9. ```
  10. Creating an app involves 3 steps:
  11. <Steps>
  12. <Step title="⚙️ Import app instance">
  13. ```python
  14. from embedchain import App
  15. app = App()
  16. ```
  17. </Step>
  18. <Step title="🗃️ Add data sources">
  19. ```python
  20. # Add different data sources
  21. elon_bot.add("https://en.wikipedia.org/wiki/Elon_Musk")
  22. elon_bot.add("https://www.forbes.com/profile/elon-musk")
  23. # You can also add local data sources such as pdf, csv files etc.
  24. # elon_bot.add("/path/to/file.pdf")
  25. ```
  26. </Step>
  27. <Step title="💬 Query or chat on your data and get answers">
  28. ```python
  29. elon_bot.query("What is the net worth of Elon Musk today?")
  30. # Answer: The net worth of Elon Musk today is $258.7 billion.
  31. ```
  32. </Step>
  33. </Steps>
  34. Putting it together, you can run your first app using the following code. Make sure to set the `OPENAI_API_KEY` 🔑 environment variable in the code.
  35. ```python
  36. import os
  37. from embedchain import App
  38. os.environ["OPENAI_API_KEY"] = "xxx"
  39. elon_bot = App()
  40. # Add different data sources
  41. elon_bot.add("https://en.wikipedia.org/wiki/Elon_Musk")
  42. elon_bot.add("https://www.forbes.com/profile/elon-musk")
  43. # You can also add local data sources such as pdf, csv files etc.
  44. # elon_bot.add("/path/to/file.pdf")
  45. response = elon_bot.query("What is the net worth of Elon Musk today?")
  46. print(response)
  47. # Answer: The net worth of Elon Musk today is $258.7 billion.
  48. ```