Skip to content

Create initial Tanuki bot api endpoint

Terri Chu requested to merge tchu-bot-create-new-api into master

What does this MR do and why?


Creates an API endpoint that receives and responds with json:

  • POST /-/llm/tanuki_bot/ask
  • { "q": "What is advanced search?" }

This is part of a series of MRs and should be reviewed and merged in this order

MR status
Add support for the embedding database (!118156 - merged) (db setup) merged
Add the tanuki_bot model (!118195 - merged) (migration) merged
Create initial Tanuki bot api endpoint (!117695 - merged) (api) in review

Screenshots or screen recordings


How to set up and validate locally

  1. Feature.enable(:openai_experimentation)
  2. Feature.enable(:tanuki_bot)
  3. ::Gitlab::CurrentSettings.update!(openai_api_key: '<YOUR_KEY>')
  4. Follow instructions for settings up the MR dependency: Add support for the embedding database (!118156 - merged)
  5. Run migrations:
    rails db:migrate
  6. * Clone the tanuki-bot repository
  7. * cd into the pgvector folder
  8. * use asdf to install python (should be python 3.11.3)
    asdf install python
  9. * install pip
  10. * install requirements
    pip install -r requirements.txt
  11. * run the command to copy the chroma db to the gdk postgres database
    OPENAI_API_KEY=not-an-actual-key PG_USER=<Your user> PG_HOST=<Your gdk install directory>/postgresql python
  12. Make an API request to POST /-/llm/tanuki_bot/ask

* you only need to do this once to have data in the embedding database.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Dmitry Gruzd

Merge request reports