fix: handle long text in embedding requests properly#90
Merged
yingapple merged 1 commit intomindverse:masterfrom Mar 28, 2025
Merged
fix: handle long text in embedding requests properly#90yingapple merged 1 commit intomindverse:masterfrom
yingapple merged 1 commit intomindverse:masterfrom
Conversation
…hen requesting embeddings, which led to loss of information.
This fix:
- Add text chunking in LLMClient to handle long texts
- Remove truncation in document_service.py
- Add EMBEDDING_MAX_TEXT_LENGTH config to control chunk size
- Average embeddings of chunks to maintain semantic representation
The fix ensures that:
1. No content is lost for long texts
2. API requests don't fail due to text length
3. Complete semantic information is preserved
yingapple
approved these changes
Mar 28, 2025
Contributor
yingapple
left a comment
There was a problem hiding this comment.
Thanks for contribution.
Very useful fix.
kevin-mindverse
approved these changes
Mar 28, 2025
Heterohabilis
pushed a commit
to Heterohabilis/Second-Me
that referenced
this pull request
May 29, 2025
…hen requesting embeddings, which led to loss of information. (mindverse#90) This fix: - Add text chunking in LLMClient to handle long texts - Remove truncation in document_service.py - Add EMBEDDING_MAX_TEXT_LENGTH config to control chunk size - Average embeddings of chunks to maintain semantic representation The fix ensures that: 1. No content is lost for long texts 2. API requests don't fail due to text length 3. Complete semantic information is preserved
EOMZON
pushed a commit
to EOMZON/Second-Me
that referenced
this pull request
Feb 1, 2026
…hen requesting embeddings, which led to loss of information. (mindverse#90) This fix: - Add text chunking in LLMClient to handle long texts - Remove truncation in document_service.py - Add EMBEDDING_MAX_TEXT_LENGTH config to control chunk size - Average embeddings of chunks to maintain semantic representation The fix ensures that: 1. No content is lost for long texts 2. API requests don't fail due to text length 3. Complete semantic information is preserved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
When processing long documents (>8000 characters), the embedding service truncates the content, resulting in loss of information and potentially inaccurate semantic search results. The issue occurs in
document_service.py:Cause analysis
Fix
Improvements
Complete Content Processing:
Better Configuration:
More Robust: