quickstart.mdx 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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 Pipeline as App
  15. app = App()
  16. ```
  17. </Step>
  18. <Step title="🗃️ Add data sources">
  19. ```python
  20. # Add different data sources
  21. app.add("https://en.wikipedia.org/wiki/Elon_Musk")
  22. app.add("https://www.forbes.com/profile/elon-musk")
  23. # You can also add local data sources such as pdf, csv files etc.
  24. # app.add("/path/to/file.pdf")
  25. ```
  26. </Step>
  27. <Step title="💬 Query or chat or search context on your data">
  28. ```python
  29. app.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. <Step title="🚀 (Optional) Deploy your pipeline to Embedchain Platform">
  34. ```python
  35. app.deploy()
  36. # 🔑 Enter your Embedchain API key. You can find the API key at https://app.embedchain.ai/settings/keys/
  37. # ec-xxxxxx
  38. # 🛠️ Creating pipeline on the platform...
  39. # 🎉🎉🎉 Pipeline created successfully! View your pipeline: https://app.embedchain.ai/pipelines/xxxxx
  40. # 🛠️ Adding data to your pipeline...
  41. # ✅ Data of type: web_page, value: https://www.forbes.com/profile/elon-musk added successfully.
  42. ```
  43. </Step>
  44. </Steps>
  45. 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.
  46. ```python
  47. import os
  48. from embedchain import Pipeline as App
  49. os.environ["OPENAI_API_KEY"] = "xxx"
  50. app = App()
  51. # Add different data sources
  52. app.add("https://en.wikipedia.org/wiki/Elon_Musk")
  53. app.add("https://www.forbes.com/profile/elon-musk")
  54. # You can also add local data sources such as pdf, csv files etc.
  55. # app.add("/path/to/file.pdf")
  56. response = app.query("What is the net worth of Elon Musk today?")
  57. print(response)
  58. # Answer: The net worth of Elon Musk today is $258.7 billion.
  59. app.deploy()
  60. # 🔑 Enter your Embedchain API key. You can find the API key at https://app.embedchain.ai/settings/keys/
  61. # ec-xxxxxx
  62. # 🛠️ Creating pipeline on the platform...
  63. # 🎉🎉🎉 Pipeline created successfully! View your pipeline: https://app.embedchain.ai/pipelines/xxxxx
  64. # 🛠️ Adding data to your pipeline...
  65. # ✅ Data of type: web_page, value: https://www.forbes.com/profile/elon-musk added successfully.
  66. ```