This demo repository showcases how to use OpenAI and LangChain to convert natural language queries into GraphQL queries and then query Hasura.
- Docker and docker-compose
- Hasura CLI
- OpenAI API key
-
Clone this repository
-
Start the Hasura server by running the following command:
docker-compose up -d
-
Deploy the Hasura metadata and migrations using the Hasura CLI:
hasura deploy --with-seeds
-
Set up your OpenAI API key by exporting it as an environment variable:
export OPENAI_API_KEY=<your-openai-api-key>
-
Start the application by running the following command:
streamlit run app.py
-
Navigate to the URL provided by Streamlit to use the application.
you may want to use a custom schema that you have defined yourself. Here are the steps to do so:
-
Replace the
schema.json
file with your custom schema with followingappolo-codegen
command:npm install -g apollo apollo schema:download --endpoint http://localhost:8080/v1/graphql
-
Restart the Streamlit application.
- Hasura GraphQL Engine
- spring-petclinic: The database schema and seeds used in this demo