Open marissaposner opened 1 year ago
To have BitBuilder create a Pull Request with the implementation, the user who created the issue (@marissaposner) can comment below with "LGTM".
Generated with :heart: by www.bitbuilder.ai. Questions? Check out our the documentation.
LGTM
Create a new flow for pulling data from Solana instead of a subgraph. In backend/backend/services/openAI/service.py, create a different logic structure for the Solana Blockchain data source. Instead of calling GraphService or parsing the documents in a SimpleDirectoryReader, take in an example document from backend/backend/services/openAI/prompts called SolanaExamples.py that is a list of examples with a structure of [question, query].
Instead of calling GraphService, use the logic in backend/backend.services/graph/service.py under GraphService to parse the data. However, instead of querying from a subgraph you will query the Bitquery API. Use the following structure to call the GraphQL API for bitquery: import requests def run_query(query): # A simple function to use requests.post to make the API call. headers = {'X-API-KEY': 'YOUR API KEY'} request = requests.post('https://graphql.bitquery.io/', json={'query': query}, headers=headers) if request.status_code == 200: return request.json() else: raise Exception('Query failed and return code is {}. {}'.format(request.status_code, query))
The GraphQL query
query = """ query{ bitcoin{ blocks{ count } } } """ result = run_query(query) # Execute the query print 'Result - {}'.format(result)
Do not call the SubgraphService function and instead call the API above.