getting-started.mdx 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. ---
  2. title: "🌍 Getting Started"
  3. ---
  4. ## Quickstart
  5. To use Embedchain as a REST API service, run the following command:
  6. ```bash
  7. docker run --name embedchain -p 8080:8080 embedchain/rest-api:latest
  8. ```
  9. Navigate to [http://localhost:8080/docs](http://localhost:8080/docs) to interact with the API. There is a full-fledged Swagger docs playground with all the information about the API endpoints.
  10. ![Swagger Docs Screenshot](https://github.com/embedchain/embedchain/assets/73601258/299d81e5-a0df-407c-afc2-6fa2c4286844)
  11. ## Creating your first App
  12. App requires an `app_id` to be created. The `app_id` is a unique identifier for your app. By default we will use the opensource **gpt4all** model to get started. You can also specify your own config by uploading a config YAML file.
  13. For example, create a `config.yaml` file (adjust according to your requirements):
  14. ```yaml
  15. app:
  16. config:
  17. id: "default-app"
  18. llm:
  19. provider: openai
  20. config:
  21. model: "gpt-3.5-turbo"
  22. temperature: 0.5
  23. max_tokens: 1000
  24. top_p: 1
  25. stream: false
  26. template: |
  27. Use the following pieces of context to answer the query at the end.
  28. If you don't know the answer, just say that you don't know, don't try to make up an answer.
  29. $context
  30. Query: $query
  31. Helpful Answer:
  32. vectordb:
  33. provider: chroma
  34. config:
  35. collection_name: "rest-api-app"
  36. dir: db
  37. allow_reset: true
  38. embedder:
  39. provider: openai
  40. config:
  41. model: "text-embedding-ada-002"
  42. ```
  43. To learn more about custom configurations, check out the [custom configurations docs](https://docs.embedchain.ai/advanced/configuration). To explore more examples of config yamls for embedchain, visit [embedchain/configs](https://github.com/embedchain/embedchain/tree/main/configs).
  44. Now, you can upload this config file in the request body.
  45. **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.
  46. | Keys | Providers |
  47. | -------------------------- | ------------------------------ |
  48. | `OPENAI_API_KEY ` | OpenAI, Azure OpenAI, Jina etc |
  49. | `OPENAI_API_TYPE` | Azure OpenAI |
  50. | `OPENAI_API_BASE` | Azure OpenAI |
  51. | `OPENAI_API_VERSION` | Azure OpenAI |
  52. | `COHERE_API_KEY` | Cohere |
  53. | `ANTHROPIC_API_KEY` | Anthropic |
  54. | `JINACHAT_API_KEY` | Jina |
  55. | `HUGGINGFACE_ACCESS_TOKEN` | Huggingface |
  56. | `REPLICATE_API_TOKEN` | LLAMA2 |
  57. To add env variables, you can simply run the docker command with the `-e` flag.
  58. For example,
  59. ```bash
  60. docker run --name embedchain -p 8080:8080 -e OPENAI_API_KEY=<YOUR_OPENAI_API_KEY> embedchain/rest-api:latest
  61. ```
  62. If you run into issues, please feel free to contact us using below links:
  63. <Snippet file="get-help.mdx" />