gptscript-ai / desktop

MIT License
20 stars 13 forks source link

Knowledge - actually inject context based on user input #326

Open cjellick opened 1 month ago

cjellick commented 1 month ago

From a convo with Thorsten:

Right now, it is pretty naive: we have a static context that says something dumb like "you have an ad hoc rag tool..." and then we rely on the LLM deciding to call retreival

I think it's time to do a proper "Retrieval Augmented Generation" wherein we write a context tool that looks at the input from the user, figures out if knowledge has relevant information about that input, and if it does, go ahead and add it as context.

My success criteria is:

  1. That the quality for when there IS a match stays the same as it is now - so to test it ill do question similar to ones ive done in the past and expect results to be as good or better
  2. That the behavior when there IS NOT a match is better - right now i feel you have to coax the assistant to answer from its training data or from the internet tool if the knowledge tool is present
  3. I dont have to coax it into using calling konwledge. its completely transparent
iwilltry42 commented 1 month ago

Ref https://github.com/gptscript-ai/knowledge/issues/93

iwilltry42 commented 1 month ago

Keeping some notes here:

iwilltry42 commented 4 weeks ago

Large changes to how knowledge is integrated: #385

sangee2004 commented 3 weeks ago

Tested with build from b6c00b5330eb

We now see Knowledge Retrieval Context being added when there are queries made relating to knowledge files.

Image

While testing this feature , there were couple of instances were I see the queries made relating to the knowledge file are not being answered from the knowledge file. In these cases , output from knowledgeInstruction is empyt ( No data retrieved from knowledge base.).

Stack Trace shows this: Image

Detailed steps to reproduce the issue is tracked in the following 2 issues: https://github.com/gptscript-ai/desktop/issues/336#issuecomment-2338898813 https://github.com/gptscript-ai/desktop/issues/402#issuecomment-2339237256