Skip to content

[BUG] robust context size handling #126

Closed

Description

@amirfz

Describe the bug
sherpa sometimes fails to answer questions because of context size issues. currently prompts are handled on an adhoc basis and their size can vary without control

To Reproduce
Steps to reproduce the behavior:

  1. Go to sherpa-dev channel
  2. Ask a question about a link and then ask follow up questions
  3. At some point, either in the first attempt or subsequent ones, Sherpa will run out of context size
  4. It currently doesn't display an error so it just stops responding

Expected behavior
Relying on adhoc prompts will not be robust, so we need to provide more strict instructions for how to handle size issues so that the system can behave robustly regardless of how the prompt is dynamically constructed. Throwing an error is also not a good UX because there are no concrete action items for the user to do when encountered with that since the prompt is mainly written by the system anyway.

Screenshots
n/a

Environment
production

Additional context
my suggestion is to create a function called prompt_crafter that is either a wrapper for the LLM calls or used in other context. but this function will be the only way prompts will be created and used.
this function will take in strings like "instruction" and "context" and objects like json data as input and puts them all together as the prompt. additionally it will take strategies for size control as flags with default but changeable values. some examples could be:

  • False: when the arg should not be changed for size control (example: user question)
  • Paraphrase with size limit: most useful for context information or converation history
  • Summarize with size limit: most useful for long retrieved context
  • Limit rows: useful for structure data like json (ex conversation history, sql respose, etc)

Activity

  1. added
    bug
    on Aug 25, 2023
  2. amirfz commented on Nov 22, 2023

    @amirfz
    ContributorAuthor

    @oshoma @20001LastOrder @bharatji30 this too: I'm checking this out and I had written more details than I thought. could you let me know what other details are useful to make this more concrete?

  3. locked and limited conversation to collaborators on Apr 4, 2024
  4. converted this issue into a discussion #325 on Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions