neurobagel / query-tool-ai

MIT License
2 stars 0 forks source link

Query tool AI

Neurobagel is a federated data ecosystem that allows researchers and other data users to find and consume research data that has to remain at their original institute for data governance reasons.

Currently, the researcher or the data user has to answer a number of queries to get the desired results and it often requires iteration.

The aim of query-tool-ai would be to make this search process more user-friendly by adding an LLM style chatbot interface. This is to be done by utilizing large language models that will be able to interpret the user prompts and initiate the API calls accurately giving the user the desired results.

Local installation -

Clone the repository :

  git clone https://github.com/neurobagel/query-tool-ai.git
  cd query-tool-ai

After cloning the repository, you can choose to either use the Dockerized version or run the application locally using Python but before proceeding with either you need to set the environment variables.

Set the environment variables -

Environment Variable Type Required Default Value if Not Set Example
NB_API_QUERY_URL string Yes - https://api.neurobagel.org/query/?
HOST string No 0.0.0.0 127.0.0.1
PORT integer No 8000 8080

Option 1 : Docker :

Option 2 : Python

Interacting with the Query Tool AI

After the local installation is complete, you can ask your query in the following 2 ways.

API Interaction -

You can interact with the FastAPI application by sending a POST request to the generate_url endpoint. Here’s how you can do it using curl (assuming the the query tool ai is listening on port 8000):

  curl -X POST "http://localhost:8000/generate_url/" -H "Content-Type: application/json" -d '{"query": "your query here"}'

Replace "your query here" with the actual query you want to test.

Python Script Interaction (Optional) -

Testing

Neurobagel API utilizes Pytest framework for testing.

To run the tests first make sure you're in repository's main directory.

You can then run the tests by executing the following command in your terminal:

pytest tests

License

Neurobagel API is released under the terms of the MIT License