quickstart.mdx 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. ---
  2. title: '⚡ Quickstart'
  3. description: '💡 Create an AI 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 huggingface_demo.py
  26. import os
  27. # Replace this with your HF token
  28. os.environ["HUGGINGFACE_ACCESS_TOKEN"] = "hf_xxxx"
  29. from embedchain import App
  30. config = {
  31. 'llm': {
  32. 'provider': 'huggingface',
  33. 'config': {
  34. 'model': 'mistralai/Mistral-7B-Instruct-v0.2',
  35. 'top_p': 0.5
  36. }
  37. },
  38. 'embedder': {
  39. 'provider': 'huggingface',
  40. 'config': {
  41. 'model': 'sentence-transformers/all-mpnet-base-v2'
  42. }
  43. }
  44. }
  45. app = App.from_config(config=config)
  46. app.add("https://www.forbes.com/profile/elon-musk")
  47. app.add("https://en.wikipedia.org/wiki/Elon_Musk")
  48. app.query("What is the net worth of Elon Musk today?")
  49. # Answer: The net worth of Elon Musk today is $258.7 billion.
  50. ```
  51. </CodeGroup>
  52. ## Paid Models
  53. In this section, we will use both LLM and embedding model from OpenAI.
  54. ```python openai_demo.py
  55. import os
  56. from embedchain import App
  57. # Replace this with your OpenAI key
  58. os.environ["OPENAI_API_KEY"] = "sk-xxxx"
  59. app = App()
  60. app.add("https://www.forbes.com/profile/elon-musk")
  61. app.add("https://en.wikipedia.org/wiki/Elon_Musk")
  62. app.query("What is the net worth of Elon Musk today?")
  63. # Answer: The net worth of Elon Musk today is $258.7 billion.
  64. ```
  65. # Next Steps
  66. Now that you have created your first app, you can follow any of the links:
  67. * [Introduction](/get-started/introduction)
  68. * [Customization](/components/introduction)
  69. * [Use cases](/use-cases/introduction)
  70. * [Deployment](/get-started/deployment)