bitcoinsearch / chat-btc

A conversational AI based on technical bitcoin sources
https://chat.bitcoinsearch.xyz/
MIT License
14 stars 13 forks source link

External API access Proposal #86

Open Emmanuel-Develops opened 1 month ago

Emmanuel-Develops commented 1 month ago

Continuation with GPT tools in issue #67

Problem

Context passed to chat is limited to data in the ES Index. These data albeit useful may not be helpful for recent state of the blockchain. e.g current block height, current difficulty, sat/vbyte, coinbase reward etc.

Proposal

Leveraging function calling tools, we can add some tools to chatbtc. In cases where GPT needs to access external realtime data, we can fetch those data from external apis: blockstream, mempool.space, blockchain explorer helping chatbtc stay up to date with the state of the blockchain.

Note: function calling returns that a function can be called mid-query and the parameters necessary to make that function call. We then call the function in the pipeline and pass the result to gpt while the main gpt API call is still ongoing

next steps: We can go further and include the ability to query specific block height, block hash, tx hash etc. This although becomes an overheard of writing individual functions for each query. BitQuery can help with that as it exposes a graphql query that we can construct dynamically. I won't go into more details here as this is beyond the scope of this proposal.

This proposal focuses on the current state of the blockchain and bitcoin network but this isn't comprehensive and tools can be expanded beyond that.

We can build a library of external API tools useful for chatBTC. E.g tool to interact with the github bitcoin repo itself (maybe bitcoin repo as a vector store) that can be utilized if users ask questions regarding functions that are present in bitcoin core. and so much more.

How do we start?

Our current pipeline using chat history understands the conversation and then the keywords necessary to answer the question, fetch data from the index, parse the data, then feed to gpt. We can streamline this approach in one-shot. How?, Let the search pipeline be a tool that gpt can use