Skip to content

Improve handling of empty retrieval results and API failures in chat responses #15

@aryarathoree

Description

@aryarathoree

Description

When the knowledge-space agent processes a query, there are cases where the retrieval step returns no relevant documents or the LLM / external API call fails or times out. In such situations, the agent currently returns a generic or unclear response, which can be confusing for users.

Expected behavior

  • If no relevant documents are retrieved, return a clear, user-friendly message suggesting the user refine or rephrase the query.
  • If an LLM or external API call fails, handle the error gracefully and return a meaningful fallback response.
  • Log errors internally to aid debugging, without exposing sensitive details to the user.

Proposed improvement

  • Add a check for empty retrieval results before invoking the LLM.
  • Wrap LLM / API calls in proper error handling.
  • Return consistent, descriptive responses for empty results, timeouts, or API failures.

Additional context

This would improve user experience and debuggability, especially for new users unfamiliar with the dataset scope.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions