llamabot icon indicating copy to clipboard operation
llamabot copied to clipboard

QueryBot: Text retrieval is incomplete

Open reka opened this issue 7 months ago • 2 comments

Some responses from QueryBot sound like it hasn't retrieved all the relevant chunks for answering the prompt. According to debugging, it retrieved only 4 RetrievedMessage instances instead of the configured 20.

Test Case: What is the relation between the classes SimpleBot, ChatBot, and QueryBot?

Steps to reproduce:

  1. Create the QueryBot instance.
from llamabot import QueryBot
from pathlib import Path

bot = QueryBot(
  system_prompt="You are an expert Python developer explaining the llamabot repository to an expert Python dev, who isn't familiar with the codebase.", 
  collection_name="llamabot_bot_classes",
  document_paths=[
    Path("/home/user/llamabot/llamabot/bot/simplebot.py"),
    Path("/home/user/llamabot/llamabot/bot/chatbot.py"),
    Path("/home/user/llamabot/llamabot/bot/querybot.py"),
  ],
  model_name="ollama/mistral"
) # This creates a new embedding
  1. Ask a question about the relationship between the Bot classes.
q1 = """
What is the relation between the classes SimpleBot, ChatBot, and QueryBot?
"""
r1 = bot(q1)
r1

The responses in 2 test runs both sounded like QueryBot didn't retrieve some relevant parts of the text:

  • Response 1: "SimpleBot is not explicitly defined in this code snippet,"
  • Response 2: "Although there are no classes named ChatBot or QueryBot in this code snippet,"

reka avatar Jul 14 '24 00:07 reka