quickstart.mdx 2.7 KB

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