[PR #20747] [CLOSED] fix: Use keyword argument for IndicesClient.refresh() for opensearch-py >= 3.0.0 (#20649) #25760

Closed
opened 2026-04-20 06:06:51 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/20747
Author: @YuriNachos
Created: 1/17/2026
Status: Closed

Base: mainHead: fix-opensearch-refresh-keyword-arg


📝 Commits (7)

  • f84aad5 fix: handle None value for model capabilities in builtin_tools check
  • 0d4898f fix: handle None value for model capabilities in file_context check
  • 9772be0 fix: handle None value for capabilities in get_model_capability helper
  • 3d404ff fix: URL-encode OAuth client secrets to handle special characters
  • 3079444 fix: Decode HTML entities in tool call results before sending to LLM
  • c1ec294 fix: Support RedisCluster for task command pub/sub messaging
  • 6aaf950 fix: Use keyword argument for IndicesClient.refresh() opensearch-py >= 3.0.0

📊 Changes

6 files changed (+35 additions, -18 deletions)

View changed files

📝 backend/open_webui/config.py (+6 -6)
📝 backend/open_webui/retrieval/vector/dbs/opensearch.py (+3 -3)
📝 backend/open_webui/tasks.py (+19 -1)
📝 backend/open_webui/utils/middleware.py (+4 -6)
📝 backend/open_webui/utils/tools.py (+1 -1)
📝 src/lib/utils/index.ts (+2 -1)

📄 Description

Summary

Fixes #20649

In opensearch-py >= 3.0.0, the IndicesClient.refresh() method signature
changed to only accept keyword-only arguments, causing TypeError when uploading
documents to OpenSearch-backed knowledge bases.

Root Cause

The opensearch-py library changed the refresh() method signature in version 3.0.0:

  • Before: refresh(index_name) - accepted positional argument
  • After: refresh(index=index_name) - keyword-only argument

Error

TypeError: IndicesClient.refresh() takes 1 positional argument but 2 positional
arguments (and 2 keyword-only arguments) were given

Changes

  • Modified backend/open_webui/retrieval/vector/dbs/opensearch.py
  • Changed all 3 occurrences of:
    self.client.indices.refresh(self._get_index_name(collection_name))
  • To:
    self.client.indices.refresh(index=self._get_index_name(collection_name))

Test

After this fix, document upload to OpenSearch knowledge bases works correctly
with opensearch-py >= 3.0.0.

Checklist

  • Minimal fix focused on the issue
  • No new dependencies added
  • Backward compatible (keyword args work with older versions too)
  • Fix applied to all occurrences in OpenSearchClient class

🔄 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/open-webui/pull/20747 **Author:** [@YuriNachos](https://github.com/YuriNachos) **Created:** 1/17/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix-opensearch-refresh-keyword-arg` --- ### 📝 Commits (7) - [`f84aad5`](https://github.com/open-webui/open-webui/commit/f84aad5f141ab769d4b75628f576c89c9ff88db9) fix: handle None value for model capabilities in builtin_tools check - [`0d4898f`](https://github.com/open-webui/open-webui/commit/0d4898fa40798e396c4deb2f9cc71b0b7d54baf4) fix: handle None value for model capabilities in file_context check - [`9772be0`](https://github.com/open-webui/open-webui/commit/9772be02cc1d4b4153a76fd15a12d07d47f8eb66) fix: handle None value for capabilities in get_model_capability helper - [`3d404ff`](https://github.com/open-webui/open-webui/commit/3d404ff87cac3d257c56ed1ef198ed5b8c142ecf) fix: URL-encode OAuth client secrets to handle special characters - [`3079444`](https://github.com/open-webui/open-webui/commit/3079444ab2f03123a9a7a4e0dc0e7fe135ea7452) fix: Decode HTML entities in tool call results before sending to LLM - [`c1ec294`](https://github.com/open-webui/open-webui/commit/c1ec294a0392513b7b9d227dc8952236596739ec) fix: Support RedisCluster for task command pub/sub messaging - [`6aaf950`](https://github.com/open-webui/open-webui/commit/6aaf9505ddbe399f34bcf232fff258381cd1a573) fix: Use keyword argument for IndicesClient.refresh() opensearch-py >= 3.0.0 ### 📊 Changes **6 files changed** (+35 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/config.py` (+6 -6) 📝 `backend/open_webui/retrieval/vector/dbs/opensearch.py` (+3 -3) 📝 `backend/open_webui/tasks.py` (+19 -1) 📝 `backend/open_webui/utils/middleware.py` (+4 -6) 📝 `backend/open_webui/utils/tools.py` (+1 -1) 📝 `src/lib/utils/index.ts` (+2 -1) </details> ### 📄 Description ## Summary Fixes #20649 In opensearch-py >= 3.0.0, the `IndicesClient.refresh()` method signature changed to only accept keyword-only arguments, causing TypeError when uploading documents to OpenSearch-backed knowledge bases. ## Root Cause The opensearch-py library changed the `refresh()` method signature in version 3.0.0: - Before: `refresh(index_name)` - accepted positional argument - After: `refresh(index=index_name)` - keyword-only argument ## Error ``` TypeError: IndicesClient.refresh() takes 1 positional argument but 2 positional arguments (and 2 keyword-only arguments) were given ``` ## Changes - Modified `backend/open_webui/retrieval/vector/dbs/opensearch.py` - Changed all 3 occurrences of: `self.client.indices.refresh(self._get_index_name(collection_name))` - To: `self.client.indices.refresh(index=self._get_index_name(collection_name))` ## Test After this fix, document upload to OpenSearch knowledge bases works correctly with opensearch-py >= 3.0.0. ## Checklist - [x] Minimal fix focused on the issue - [x] No new dependencies added - [x] Backward compatible (keyword args work with older versions too) - [x] Fix applied to all occurrences in OpenSearchClient class --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-20 06:06:51 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#25760