ChainBrainApp / ChainBrain

No-code, blockchain data analytics platform
https://ethdenver-buidlathon-2023.vercel.app
MIT License
8 stars 0 forks source link

Cache results of User natural language input and GraphQL successful query and store in a Google Cloud Postgres Database #3

Open marissaposner opened 1 year ago

marissaposner commented 1 year ago

Requirements:

  1. Store results of Natural language query, the successful GraphQL query, and the results from the Graph in a Google Cloud Postgres Database if the query that GPT generated returned a result from the Graph's API Columns: User_input, graphql_query, datetime the query was sent to openAI, and the returned_data

  2. Insert logic to check before sending the data to:

    • OpenAI: Has this lowercased natural language query been sent before? If so, use cached results from the database and display the returned_data for that natural language query. Ideally we can use a semantic model to check if the intent behind the query is the same even if it was worded differently.
    • The Graph: Did this query even if different return the same GraphQL query that another query did? If so, do not call out to the Graph's API and instead display the returned_data

The goal: To reduce the number of times we send queries to the Graph or OpenAI API's.