Skip to content

[FEATURE] Surface specific error message #751

@adrianthedev

Description

@adrianthedev

Scope check

  • This is core LLM communication (not application logic)
  • This benefits most users (not just my use case)
  • This can't be solved in application code with current RubyLLM
  • I read the Contributing Guide

Due diligence

  • I searched existing issues
  • I checked the documentation

What problem does this solve?

I wanted to use Open AI GPT and Anthropic's Haiku. For the same prompt I would get back a proper response from OpenAI but Invalid request - please check your input from Anthropic.

After a bit of digging and turning on debugging, I found this message deeper.

Accumulating error chunk: {"type":"error","error":{"type":"invalid_request_error","message":"Your credit balance is too low to access the Anthropic API. Please go to Plans & Billing to upgrade or purchase credits."},"request_id":"..."}

So the error reason is there but needs to be resurfaced.

Proposed solution

Dig in the specific response and surface the actual error.

Why this belongs in RubyLLM

It's the way RubyLLM handles responses.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions