mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-17 17:02:01 -05:00
[PR #4698] [CLOSED] FEAT: Implement batch processing for OpenAI embeddings #21538
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/4698
Author: @c0sogi
Created: 8/18/2024
Status: ❌ Closed
Base:
dev← Head:dev📝 Commits (5)
2002989feat: added batch api for openai embedding484c48dMerge branch 'open-webui:dev' into dev6d5b511Merge branch 'open-webui:dev' into deve59c018refac: remove hardcoded parameters in batch_utilsabbd606test: batch_utils📊 Changes
3 files changed (+470 additions, -23 deletions)
View changed files
➕
backend/apps/rag/batch_utils.py(+258 -0)📝
backend/apps/rag/utils.py(+1 -23)➕
backend/test/apps/rag/test_batch_utils.py(+211 -0)📄 Description
Description
This pull request introduces batch processing functionality for OpenAI embeddings, significantly improving the handling of large text inputs. The new implementation allows for more efficient processing of text data exceeding 500,000 characters.
Changelog Entry
Added
backend/apps/rag/batch_utils.pyimplementing batch processing for OpenAI embeddingsChanged
backend/apps/rag/utils.pyto incorporate the new batch processing functionalitygenerate_openai_batch_embeddingsfunction to use either sync or async processing based on input sizeFixed
Pull Request Checklist
devbranch.openaiandtenacitypackages.test_openai_batch_api_embeddinghas been included inbackend/test/apps/rag/test_batch_utils.py.Additional Information
This implementation significantly enhances our ability to process large volumes of text for embedding generation. It automatically switches between synchronous and asynchronous processing based on the input size, optimizing for both small and large text inputs. Currently, switching threshold is set to
500,000chars.Screenshots or Videos
N/A for this backend implementation.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.