[PR #179] [MERGED] Refactor Anthropic Manifold for improved reliability #348

Closed
opened 2026-10-18 21:05:14 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/pipelines/pull/179
Author: @justinh-rahb
Created: 7/30/2024
Status: ✅ Merged
Merged: 7/31/2024
Merged by: @justinh-rahb

Base: main ← Head: anthropic-fix


📝 Commits (1)

  • dd5e986 refac: anthropic manifold

📊 Changes

1 file changed (+47 additions, -24 deletions)

View changed files

📝 examples/pipelines/providers/anthropic_manifold_pipeline.py (+47 -24)

📄 Description

This pull request addresses issues related to the use of the Anthropic library for interacting with the Anthropic API. The previously implemented pipeline was experiencing authentication errors which were not reproducible using simple cURL commands. To resolve this, the code has been refactored to utilize the requests library coupled with sseclient-py, eliminating dependency on the original Anthropic library.

Key Changes:

  1. Dependency Update:

    • Removed the anthropic library dependency.
    • Added sseclient-py as a requirement to handle server-sent events (SSE).
  2. Initialization:

    • The API key initialization has been updated to directly set headers for API requests, using the environment variable.
  3. API Call Adjustments:

    • The methods stream_response and get_completion have been adapted to function using requests.post() instead of the Anthropic client method.
    • Stream responses from the API are handled using the SSEClient for real-time updates.
  4. Error Handling:

    • Improved error handling within API calls, capturing key errors and providing more informative responses on failure.

Context:

This refactor was driven by user-reported bugs related to API key expiration and authentication issues. The previous implementation using the Anthropic library seemed inherently problematic, while manual cURL calls with the same API keys consistently yielded valid responses.

The transition to using direct HTTP requests has resulted in a more stable and reliable pipeline, reducing potential issues caused by previous library dependencies. This change is expected to enhance user experience, particularly for those deploying the pipeline via Docker with the Open WebUI. Thanks to @sriparashiva for the code, I used some portions of it for this refactored implementation. Thank you also to @dannykorpan and @Digit404 for your patience and assistance.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/pipelines/pull/179 **Author:** [@justinh-rahb](https://github.com/justinh-rahb) **Created:** 7/30/2024 **Status:** ✅ Merged **Merged:** 7/31/2024 **Merged by:** [@justinh-rahb](https://github.com/justinh-rahb) **Base:** `main` ← **Head:** `anthropic-fix` --- ### 📝 Commits (1) - [`dd5e986`](https://github.com/open-webui/pipelines/commit/dd5e986a52be61143dbf4655143cff7901aa3cf4) refac: anthropic manifold ### 📊 Changes **1 file changed** (+47 additions, -24 deletions) <details> <summary>View changed files</summary> 📝 `examples/pipelines/providers/anthropic_manifold_pipeline.py` (+47 -24) </details> ### 📄 Description This pull request addresses issues related to the use of the Anthropic library for interacting with the Anthropic API. The previously implemented pipeline was experiencing authentication errors which were not reproducible using simple cURL commands. To resolve this, the code has been refactored to utilize the `requests` library coupled with `sseclient-py`, eliminating dependency on the original Anthropic library. #### Key Changes: 1. **Dependency Update**: - Removed the `anthropic` library dependency. - Added `sseclient-py` as a requirement to handle server-sent events (SSE). 2. **Initialization**: - The API key initialization has been updated to directly set headers for API requests, using the environment variable. 3. **API Call Adjustments**: - The methods `stream_response` and `get_completion` have been adapted to function using `requests.post()` instead of the Anthropic client method. - Stream responses from the API are handled using the `SSEClient` for real-time updates. 4. **Error Handling**: - Improved error handling within API calls, capturing key errors and providing more informative responses on failure. #### Context: This refactor was driven by user-reported bugs related to API key expiration and authentication issues. The previous implementation using the Anthropic library seemed inherently problematic, while manual cURL calls with the same API keys consistently yielded valid responses. - #166 The transition to using direct HTTP requests has resulted in a more stable and reliable pipeline, reducing potential issues caused by previous library dependencies. This change is expected to enhance user experience, particularly for those deploying the pipeline via Docker with the Open WebUI. Thanks to @sriparashiva for the code, I used some portions of it for this refactored implementation. Thank you also to @dannykorpan and @Digit404 for your patience and assistance. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-18 21:05:14 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
open-webui/pipelines#348
No description provided.