getting-started.mdx 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. ---
  2. title: "🌍 Getting Started"
  3. ---
  4. ## Quickstart
  5. To run Embedchain as a REST API server use,
  6. ```bash
  7. docker run -d --name embedchain -p 8080:8080 embedchain/rest-api:latest
  8. ```
  9. Open up your browser and navigate to http://0.0.0.0:8080/docs to interact with the API. There is a full-fledged Swagger docs playground with all the information
  10. about the API endpoints.
  11. ![Swagger Docs Screenshot](https://github.com/embedchain/embedchain/assets/73601258/299d81e5-a0df-407c-afc2-6fa2c4286844)
  12. ## Creating your first App
  13. App requires an `app_id` to be created. The `app_id` is a unique identifier for your app.
  14. By default we will use the opensource **gpt4all** model to perform operations. You can also specify your own config by uploading a config YAML file.
  15. For example, create a `config.yaml` file (adjust according to your requirements):
  16. ```yaml
  17. app:
  18. config:
  19. id: "default-app"
  20. llm:
  21. provider: openai
  22. config:
  23. model: "gpt-3.5-turbo"
  24. temperature: 0.5
  25. max_tokens: 1000
  26. top_p: 1
  27. stream: false
  28. template: |
  29. Use the following pieces of context to answer the query at the end.
  30. If you don't know the answer, just say that you don't know, don't try to make up an answer.
  31. $context
  32. Query: $query
  33. Helpful Answer:
  34. vectordb:
  35. provider: chroma
  36. config:
  37. collection_name: "rest-api-app"
  38. dir: db
  39. allow_reset: true
  40. embedder:
  41. provider: openai
  42. config:
  43. model: "text-embedding-ada-002"
  44. ```
  45. To learn more about custom configurations, check out the [Custom configurations](https://docs.embedchain.ai/advanced/configuration).
  46. To explore more examples of config YAMLs for Embedchain, visit [embedchain/configs](https://github.com/embedchain/embedchain/tree/main/configs).
  47. Now, you can upload this config file in the request body.
  48. **Note:** To use custom models, an **API key** might be required. Refer to the table below to determine the necessary API key for your provider.
  49. | Keys | Providers |
  50. | -------------------------- | ------------------------------ |
  51. | `OPENAI_API_KEY ` | OpenAI, Azure OpenAI, Jina etc |
  52. | `OPENAI_API_TYPE` | Azure OpenAI |
  53. | `OPENAI_API_BASE` | Azure OpenAI |
  54. | `OPENAI_API_VERSION` | Azure OpenAI |
  55. | `COHERE_API_KEY` | Cohere |
  56. | `ANTHROPIC_API_KEY` | Anthropic |
  57. | `JINACHAT_API_KEY` | Jina |
  58. | `HUGGINGFACE_ACCESS_TOKEN` | Huggingface |
  59. | `REPLICATE_API_TOKEN` | LLAMA2 |
  60. To provide them, you can simply run the docker command with the `-e` flag.
  61. For example,
  62. ```bash
  63. docker run -d --name embedchain -p 8080:8080 -e OPENAI_API_KEY=YOUR_API_KEY embedchain/rest-api:latest
  64. ```
  65. Cool! This will create a new Embedchain App with the given `app_id`.
  66. ## Deploying your App to Embedchain Platform
  67. This feature is very powerful as it allows the creation of a public API endpoint for your app, enabling queries from anywhere. This creates a _pipeline_
  68. for your app that can sync the data time to time and provide you with the best results.
  69. ![My first Pipeline](https://github.com/embedchain/embedchain/assets/73601258/266a66e0-330e-4bb9-aa97-687d826cd3fa)
  70. To utilize this functionality, visit [app.embedchain.ai](app.embedchain.ai) and create an account. Subsequently, generate a new [API KEY](https://app.embedchain.ai/settings/keys/).
  71. ![Create Embedchain API Key](https://github.com/embedchain/embedchain/assets/73601258/791e92cc-4a6f-4740-94c2-f11cce13e93b)
  72. Using this API key, you can deploy your app to the platform.