Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Anthropic API Elevated Error Rate Handling: #314

Open
5 tasks
RazeBerry opened this issue Aug 14, 2024 · 0 comments
Open
5 tasks

Anthropic API Elevated Error Rate Handling: #314

RazeBerry opened this issue Aug 14, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@RazeBerry
Copy link

RazeBerry commented Aug 14, 2024

Feature Request: Robust Error Handling for Anthropic API

Summary

Implement a robust error handling system to manage and mitigate the impact of elevated error rates from the Anthropic API, ensuring better reliability and user experience for Perplexica.

Problem

The current implementation of Perplexica is experiencing unhandled APIConnectionErrors when interacting with the Anthropic API. These errors are causing the application to freeze.

Proposed Solution

Implement a multi-faceted approach to handle API errors gracefully:

  1. Retry Mechanism:

    • Implement an exponential backoff retry strategy for failed API calls.
    • Set a maximum number of retries to prevent infinite loops.
  2. Error Logging and Monitoring:

    • Enhance error logging to capture detailed information about API failures.
    • Implement real-time monitoring and alerting for API error rates.
  3. Graceful Degradation:

    • Develop fallback mechanisms for when the Anthropic API is unavailable.
    • Implement a circuit breaker pattern to prevent cascading failures.

Acceptance Criteria

  • Perplexica can handle Anthropic API errors without freezing.
  • Retry mechanism successfully recovers from transient errors.
  • Error logs provide actionable information for debugging.
  • Users receive meaningful feedback during API disruptions.
  • Application performance is maintained during periods of elevated API error rates.

Log from backend:

APIConnectionError: Connection error.
at APIError.generate (/home/perplexica/node_modules/@anthropic-ai/sdk/error.js:36:20)
at Stream.iterator (/home/perplexica/node_modules/@anthropic-ai/sdk/streaming.js:55:48)
@RazeBerry RazeBerry added the enhancement New feature or request label Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant