Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ainoya/graphql-gpt
https://github.com/ainoya/graphql-gpt
gpt-3 graphql hasura langchain openai
Last synced: 10 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/ainoya/graphql-gpt
- Owner: ainoya
- License: mit
- Created: 2023-04-08T10:46:49.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-01-12T18:00:00.000Z (10 months ago)
- Last Synced: 2024-10-17T23:03:38.358Z (20 days ago)
- Topics: gpt-3, graphql, hasura, langchain, openai
- Language: PLpgSQL
- Homepage:
- Size: 207 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# OpenAI GPT + Hasura GraphQL Engine
This demo repository showcases how to use OpenAI and LangChain to convert natural language queries into GraphQL queries and then query Hasura.
![Demo App](images/demo.png)
## Prerequisites
- Docker and docker-compose
- Hasura CLI
- OpenAI API key## Getting Started
1. Clone this repository
2. Start the Hasura server by running the following command:```bash
docker-compose up -d
```3. Deploy the Hasura metadata and migrations using the Hasura CLI:
```bash
hasura deploy --with-seeds
```4. Set up your OpenAI API key by exporting it as an environment variable:
```bash
export OPENAI_API_KEY=
```5. Start the application by running the following command:
```bash
streamlit run app.py
```6. Navigate to the URL provided by Streamlit to use the application.
## Using a different Hasura GraphQL schema
you may want to use a custom schema that you have defined yourself. Here are the steps to do so:
1. Replace the `schema.json` file with your custom schema with following `appolo-codegen` command:
```bash
npm install -g apollo
apollo schema:download --endpoint http://localhost:8080/v1/graphql
```2. Restart the Streamlit application.
## References
- [Hasura GraphQL Engine](https://hasura.io)
- [spring-petclinic](https://github.com/spring-projects/spring-petclinic/blob/main/src/main/resources/db/postgres/schema.sql): The database schema and seeds used in this demo