quickstart.mdx 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. ---
  2. title: '⚡ Quickstart'
  3. description: '💡 Create a RAG app on your own data in a minute'
  4. ---
  5. ## Installation
  6. First install the python package.
  7. ```bash
  8. pip install embedchain
  9. ```
  10. Once you have installed the package, depending upon your preference you can either use:
  11. <CardGroup cols={2}>
  12. <Card title="Open Source Models" icon="osi" href="#open-source-models">
  13. This includes Open source LLMs like Mistral, Llama, etc.<br/>
  14. Free to use, and runs locally on your machine.
  15. </Card>
  16. <Card title="Paid Models" icon="dollar-sign" href="#paid-models" color="#4A154B">
  17. This includes paid LLMs like GPT 4, Claude, etc.<br/>
  18. Cost money and are accessible via an API.
  19. </Card>
  20. </CardGroup>
  21. ## Open Source Models
  22. This section gives a quickstart example of using Mistral as the Open source LLM and Sentence transformers as the Open source embedding model. These models are free and run mostly on your local machine.
  23. We are using Mistral hosted at Hugging Face, so will you need a Hugging Face token to run this example. Its *free* and you can create one [here](https://huggingface.co/docs/hub/security-tokens).
  24. <CodeGroup>
  25. ```python quickstart.py
  26. import os
  27. # replace this with your HF key
  28. os.environ["HUGGINGFACE_ACCESS_TOKEN"] = "hf_xxxx"
  29. from embedchain import App
  30. app = App.from_config("mistral.yaml")
  31. app.add("https://www.forbes.com/profile/elon-musk")
  32. app.add("https://en.wikipedia.org/wiki/Elon_Musk")
  33. app.query("What is the net worth of Elon Musk today?")
  34. # Answer: The net worth of Elon Musk today is $258.7 billion.
  35. ```
  36. ```yaml mistral.yaml
  37. llm:
  38. provider: huggingface
  39. config:
  40. model: 'mistralai/Mistral-7B-v0.1'
  41. top_p: 0.5
  42. embedder:
  43. provider: huggingface
  44. config:
  45. model: 'sentence-transformers/all-mpnet-base-v2'
  46. ```
  47. </CodeGroup>
  48. ## Paid Models
  49. In this section, we will use both LLM and embedding model from OpenAI.
  50. ```python quickstart.py
  51. import os
  52. # replace this with your OpenAI key
  53. os.environ["OPENAI_API_KEY"] = "sk-xxxx"
  54. from embedchain import App
  55. app = App()
  56. app.add("https://www.forbes.com/profile/elon-musk")
  57. app.add("https://en.wikipedia.org/wiki/Elon_Musk")
  58. app.query("What is the net worth of Elon Musk today?")
  59. # Answer: The net worth of Elon Musk today is $258.7 billion.
  60. ```
  61. # Next Steps
  62. Now that you have created your first app, you can follow any of the links:
  63. * [Introduction](/get-started/introduction)
  64. * [Customization](/components/introduction)
  65. * [Use cases](/use-cases/introduction)
  66. * [Deployment](/get-started/deployment)