api_server.mdx 981 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. ---
  2. title: '🌍 API Server'
  3. ---
  4. ### 🐳 Docker Setup
  5. - Open variables.env, and edit it to add your 🔑 `OPENAI_API_KEY`.
  6. - To setup your api server using docker, run the following command inside this folder using your terminal.
  7. ```bash
  8. docker-compose up --build
  9. ```
  10. 📝 Note: The build command might take a while to install all the packages depending on your system resources.
  11. ### 🚀 Usage Instructions
  12. - Your api server is running on [http://localhost:5000/](http://localhost:5000/)
  13. - To use the api server, make an api call to the endpoints `/add` and `/query` using the json formats discussed below.
  14. - To add data sources to the bot:
  15. ```json
  16. // Request
  17. {
  18. "data_type": "your_data_type_here",
  19. "url_or_text": "your_url_or_text_here"
  20. }
  21. // Response
  22. {
  23. "data": "Added data_type: url_or_text"
  24. }
  25. ```
  26. - To ask questions from the bot:
  27. ```json
  28. // Request
  29. {
  30. "question": "your_question_here"
  31. }
  32. // Response
  33. {
  34. "data": "your_answer_here"
  35. }
  36. ```
  37. 🎉 Happy Chatting! 🎉