bitcoinsearch / chat-btc

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

Message history context #64

Closed Emmanuel-Develops closed 8 months ago

Emmanuel-Develops commented 9 months ago

This PR addresses 2 long-running issue:

History

ChatBTC lacked conversation context and was only replying the last message in the chat window. This PR formats the message history and passes the chat history along when calling openai gpt. closes #39

Extractor

In a long-running conversation, newer questions may omit certain keywords (subject) that have already been established in previous chats e.g Q1: what is segwit, ans:..., Q2: what were the controversies surrounding it. As it stands, even with context for gpt to understand that Q2 is referring to segwit, the extractor can't make the distinction and therefore sources for documents relating to "controversies". Luckily enough, segwit was quite controversial, so generally there should be some documents that help gpt to provide accurate answers. To help with the extractor shortcomings, I switched to the extractor to a gpt extractor, i.e we use gpt (gpt-3.5-turbo; cheap and fast) to pull relevant keywords by giving it only the previous questions context (last 10 user questions). This ensures the documents are relevant to the question being asked. Albeit at a cost of latency (around 1s).

TODOs:

vercel[bot] commented 9 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
chat-btc ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 13, 2024 3:47pm
adamjonas commented 9 months ago

ACK on adding the message context. It makes the follow up questions much better.

I'd be happy to merge now but would also prefer fixing the regression of restoring the follow up questions for all questions beyond the initial query.

Emmanuel-Develops commented 8 months ago

closes #68 Implemented an input token enforcer to limit the input tokens sent to chat to 7000 (with avg of 0.75 token/word which is about 9333 words).

Should be a separate PR but I'd like it if we get it out in this PR due to the refactoring made in passing the chat history

Emmanuel-Develops commented 8 months ago

ACK on adding the message context. It makes the follow up questions much better.

I'd be happy to merge now but would also prefer fixing the regression of restoring the follow up questions for all questions beyond the initial query.

I wasn't able to reproduce this, but I have noticed some failure rate with the regex for follow up questions. It isn't quite peculiar to this PR Wrote a new issue addressing that in #69

github-actions[bot] commented 3 weeks ago

:tada: This PR is included in version 1.0.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: