Repository navigation
Feat: add embedding support - #16769
Feat: add embedding support #16769
Conversation
📝 WalkthroughWalkthroughThis PR adds context- and instance-scoped component factory overrides, replaces tokenizer embedding injection with resolver-based contracts, rewires dataflow embedding resolution and task-scoped pipeline execution, updates ingestion checkpoint handling, loads task context from ingestion foreign keys, standardizes shared SQLite test setup, and removes legacy chunk helpers. ChangesContext-Scoped Embedding & Pipeline Refactor
Ingestion Service Error Handling & Task Context Loading
Unrelated Error Message Updates
Estimated code review effort: 4 (Complex) | ~75 minutes Possibly related issues
Possibly related PRs
Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
1. e2e - execute pipeline to parse pdf file and save chunks to ES 2. chunks can be retrieved for using in chat
7a7e851 to
68ac2cf
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (6)
internal/ingestion/service/ingestion_service.go (1)
227-232: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExtract a
markTaskFailedhelper to eliminate duplicated error-handling blocks.The
UpdateStatus(FAILED)+ log +returnpattern is repeated four times in the changedexecuteTaskcode (lines 229–232, 245–248, 257–260, 265–268). A small helper would reduce duplication and ensure consistent handling if the failure path ever changes.As per coding guidelines for
internal/ingestion/**, prefer collapsing duplicate paths over preserving transitional wrappers.♻️ Proposed helper extraction
+func (e *Ingestor) markTaskFailed(taskID string) { + if uErr := e.ingestionTaskDAO.UpdateStatus(taskID, common.FAILED); uErr != nil { + common.Error(fmt.Sprintf("Failed to set task %s to FAILED", taskID), uErr) + } +} + func (e *Ingestor) executeTask(taskCtx *taskpkg.TaskContext) { ctx := taskCtx.Ctx task := taskCtx.IngestionTask common.Info(fmt.Sprintf("Starting task %s", task.ID)) latestLog, err := e.ingestionTaskLogDAO.LatestLogByTaskID(task.ID) if err != nil { if !errors.Is(err, gorm.ErrRecordNotFound) { common.Error(fmt.Sprintf("Failed to get latest task log for task %s", task.ID), err) - if uErr := e.ingestionTaskDAO.UpdateStatus(task.ID, common.FAILED); uErr != nil { - common.Error(fmt.Sprintf("Failed to set task %s to FAILED", task.ID), uErr) - } + e.markTaskFailed(task.ID) return } // ... err = e.ingestionTaskLogDAO.Create(latestLog) if err != nil { common.Error(fmt.Sprintf("Failed to create task log for task %s", task.ID), err) - if uErr := e.ingestionTaskDAO.UpdateStatus(task.ID, common.FAILED); uErr != nil { - common.Error(fmt.Sprintf("Failed to set task %s to FAILED", task.ID), uErr) - } + e.markTaskFailed(task.ID) return } } // ... currentStep, ok := common.GetInt(checkpointMap["current_step"]) if !ok { common.Error(fmt.Sprintf("Failed to get current step from task log for task %s", task.ID), nil) - if uErr := e.ingestionTaskDAO.UpdateStatus(task.ID, common.FAILED); uErr != nil { - common.Error(fmt.Sprintf("Failed to set task %s to FAILED", task.ID), uErr) - } + e.markTaskFailed(task.ID) return } totalStep, ok := common.GetInt(checkpointMap["total_step"]) if !ok { common.Error(fmt.Sprintf("Failed to get total step from task log for task %s", task.ID), nil) - if uErr := e.ingestionTaskDAO.UpdateStatus(task.ID, common.FAILED); uErr != nil { - common.Error(fmt.Sprintf("Failed to set task %s to FAILED", task.ID), uErr) - } + e.markTaskFailed(task.ID) return }Also applies to: 245-247, 256-267
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/ingestion/service/ingestion_service.go` around lines 227 - 232, Extract a reusable markTaskFailed helper in executeTask to handle the repeated failure path: log the original error, call ingestionTaskDAO.UpdateStatus(task.ID, common.FAILED), log any status-update error, and return. Replace the duplicated blocks in executeTask with calls to this helper at each failure site so the behavior stays consistent and the code is easier to maintain.Source: Coding guidelines
internal/ingestion/task/real_consumer_test.go (1)
62-71: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCollapse duplicated SQLite DSN construction into a shared helper.
Same DSN pattern as
testutil.SetupTestDB— per coding guidelines forinternal/ingestion/**, prefer collapsing duplicate paths. Oncetestutil.SharedMemoryDSNis extracted (see comment ontask_context_test.go), replace the inline construction here.♻️ Proposed refactor
- dsn := fmt.Sprintf("file:%s?mode=memory&cache=shared", strings.NewReplacer("/", "_", " ", "_").Replace(t.Name())) + dsn := testutil.SharedMemoryDSN(t) db, err := gorm.Open(sqlite.Open(dsn), &gorm.Config{TranslateError: true})🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/ingestion/task/real_consumer_test.go` around lines 62 - 71, The SQLite DSN is being built inline in this test, duplicating the same shared-memory pattern used elsewhere. Replace the local `dsn` construction in `real_consumer_test.go` with the shared helper once it exists, ideally `testutil.SharedMemoryDSN`, so `TestRealConsumer` relies on a single source of truth for the in-memory SQLite connection string. Keep the rest of the setup (`gorm.Open`, `db.DB()`, and `SetMaxOpenConns`) unchanged.Source: Coding guidelines
internal/ingestion/task/task_context_test.go (1)
33-42: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCollapse duplicated SQLite DSN construction into a shared helper.
The DSN pattern
fmt.Sprintf("file:%s?mode=memory&cache=shared", strings.NewReplacer("/", "_", " ", "_").Replace(t.Name()))is identical totestutil.SetupTestDBininternal/ingestion/testutil/helpers.go:50. Per the coding guidelines forinternal/ingestion/**, prefer collapsing duplicate paths. Consider extracting a smallSharedMemoryDSN(t *testing.T) stringhelper intotestutiland calling it here, which avoids thegorm.Configdifferences (TranslateErrorvsLogger: Silent) while eliminating the copy.♻️ Proposed refactor: extract DSN helper into testutil
In
internal/ingestion/testutil/helpers.go:func SharedMemoryDSN(t *testing.T) string { t.Helper() return fmt.Sprintf("file:%s?mode=memory&cache=shared", strings.NewReplacer("/", "_", " ", "_").Replace(t.Name())) }Then in
task_context_test.go:func setupTestDB(t *testing.T) *gorm.DB { t.Helper() - dsn := fmt.Sprintf("file:%s?mode=memory&cache=shared", strings.NewReplacer("/", "_", " ", "_").Replace(t.Name())) + dsn := testutil.SharedMemoryDSN(t) db, err := gorm.Open(sqlite.Open(dsn), &gorm.Config{TranslateError: true})🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/ingestion/task/task_context_test.go` around lines 33 - 42, The SQLite DSN construction in task_context_test.go is duplicated from testutil.SetupTestDB, so collapse it into a shared helper in testutil instead of repeating the fmt.Sprintf/strings.NewReplacer logic. Add a small SharedMemoryDSN(t *testing.T) helper in internal/ingestion/testutil/helpers.go and use it from the task context test, keeping the existing gorm.Open and TranslateError settings intact while removing the copy.Source: Coding guidelines
internal/ingestion/pipeline/real_storage_integration_test.go (2)
196-211: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDuplicate bootstrap logic with
dataflow_real_pipeline_integration_test.go.
prepareTokenizerResourceForIntegrationhere is byte-for-byte identical toprepareTokenizerResourceForTaskIntegrationininternal/ingestion/task/dataflow_real_pipeline_integration_test.go(same const path, same skip/setenv/cleanup logic). Consider hoisting this into the sharedinternal/ingestion/testutilhelper package (already used for the SQLite DSN test helper in this cohort) to avoid drift between the two copies.♻️ Suggested consolidation
// internal/ingestion/testutil/helpers.go func PrepareTokenizerResource(t *testing.T) { t.Helper() if os.Getenv("RAGFLOW_DICT_PATH") != "" { return } const systemDictPath = "/usr/share/infinity/resource" if _, err := os.Stat(filepath.Join(systemDictPath, "rag", "huqie.txt")); err != nil { t.Skipf("system tokenizer resource not found at %s: %v", systemDictPath, err) } if err := os.Setenv("RAGFLOW_DICT_PATH", systemDictPath); err != nil { t.Fatalf("set RAGFLOW_DICT_PATH=%s: %v", systemDictPath, err) } t.Cleanup(func() { _ = os.Unsetenv("RAGFLOW_DICT_PATH") }) }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/ingestion/pipeline/real_storage_integration_test.go` around lines 196 - 211, The tokenizer bootstrap logic in prepareTokenizerResourceForIntegration is duplicated elsewhere, so consolidate it into the shared internal/ingestion/testutil helper package used by the SQLite DSN helper. Move the environment setup, systemDictPath check, and cleanup behavior into a single helper (for example, a shared PrepareTokenizerResource function) and update both prepareTokenizerResourceForIntegration and prepareTokenizerResourceForTaskIntegration to call it instead of keeping separate copies.Source: Coding guidelines
196-299: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRemove the unused tokenizer bootstrap helpers
mustWriteTokenizerPOSDef,mustPrepareTokenizerWordNet, andmustPrepareTokenizerOpenCChave no callers anywhere in the repo now;mustSymlinkis only used bymustPrepareTokenizerOpenCC, so it goes with them.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/ingestion/pipeline/real_storage_integration_test.go` around lines 196 - 299, Remove the dead tokenizer bootstrap helpers from real_storage_integration_test.go: mustWriteTokenizerPOSDef, mustPrepareTokenizerWordNet, mustPrepareTokenizerOpenCC, and the now-only-related mustSymlink. Since these functions have no callers anywhere in the repo, delete their definitions and any now-unused imports they were pulling in. Keep prepareTokenizerResourceForIntegration as the remaining tokenizer setup helper.Source: Coding guidelines
internal/ingestion/component/tokenizer.go (1)
17-19: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winKeep tokenizer comments focused on the current Go runtime path.
These new doc comments still describe the Python migration/source behavior. Please rewrite them around the current Go component behavior instead.
As per coding guidelines, "
internal/**/*.go: Keep Go package comments and doc comments aligned with the current runtime path, not with migration history."Proposed comment cleanup
-// Tokenizer ingestion component. Port of Python -// `rag/flow/tokenizer/tokenizer.py`, including the title/content -// embedding merge and token-accounting behavior of `_embedding`. +// Package component contains ingestion runtime components, including +// tokenization and embedding preparation for chunk documents. package component @@ -// tokenizerEmbeddingBatchSize mirrors Python's -// settings.EMBEDDING_BATCH_SIZE default. +// tokenizerEmbeddingBatchSize controls the number of content texts sent +// to the embedder per request. var tokenizerEmbeddingBatchSize = 16 @@ -// NewTokenizerComponent constructs a TokenizerComponent from DSL -// params. Mirrors python `TokenizerParam` defaults (search_method = -// ["full_text","embedding"], filename_embd_weight=0.1, fields=["text"]). +// NewTokenizerComponent constructs a TokenizerComponent from DSL params +// using TokenizerParam defaults. func NewTokenizerComponent(params map[string]any) (runtime.Component, error) {Also applies to: 45-47, 104-106
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/ingestion/component/tokenizer.go` around lines 17 - 19, The doc comments on the tokenizer package and related symbols still describe Python migration history instead of the current Go runtime behavior. Rewrite the comments for the tokenizer component and the affected identifiers in this file (including the package-level comment and the related methods/types referenced by the repeated comment blocks) so they explain what the Go implementation does now, using current behavior and responsibilities rather than mentioning the Python source or porting history.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/ingestion/component/tokenizer.go`:
- Around line 335-347: The timeout wrapper in encodeWithTimeout does not
actually stop a hung Embedder.Encode call because the timeout context is never
passed into the embedder. Update the Embedder interface or the call path in
encodeWithTimeout so the encoding work accepts and observes context
cancellation, and ensure the blocking Encode(texts) operation in tokenizер.go is
tied to timeoutCtx or otherwise enforced within the timeout boundary.
In `@internal/ingestion/task/dataflow_service.go`:
- Around line 520-524: The resolveEmbeddingModel method currently ignores the
explicit modelID override and always falls back to the KB embedding settings.
Update PipelineExecutor.resolveEmbeddingModel to check modelID first and resolve
that embedding model before considering taskCtx.KB.EmbdID or any kbID-based
fallback, while keeping the existing behavior when modelID is empty. Make sure
the tokenizer flow that calls resolveEmbeddingModel can honor request/DSL-level
overrides without changing the existing KB fallback logic.
---
Nitpick comments:
In `@internal/ingestion/component/tokenizer.go`:
- Around line 17-19: The doc comments on the tokenizer package and related
symbols still describe Python migration history instead of the current Go
runtime behavior. Rewrite the comments for the tokenizer component and the
affected identifiers in this file (including the package-level comment and the
related methods/types referenced by the repeated comment blocks) so they explain
what the Go implementation does now, using current behavior and responsibilities
rather than mentioning the Python source or porting history.
In `@internal/ingestion/pipeline/real_storage_integration_test.go`:
- Around line 196-211: The tokenizer bootstrap logic in
prepareTokenizerResourceForIntegration is duplicated elsewhere, so consolidate
it into the shared internal/ingestion/testutil helper package used by the SQLite
DSN helper. Move the environment setup, systemDictPath check, and cleanup
behavior into a single helper (for example, a shared PrepareTokenizerResource
function) and update both prepareTokenizerResourceForIntegration and
prepareTokenizerResourceForTaskIntegration to call it instead of keeping
separate copies.
- Around line 196-299: Remove the dead tokenizer bootstrap helpers from
real_storage_integration_test.go: mustWriteTokenizerPOSDef,
mustPrepareTokenizerWordNet, mustPrepareTokenizerOpenCC, and the
now-only-related mustSymlink. Since these functions have no callers anywhere in
the repo, delete their definitions and any now-unused imports they were pulling
in. Keep prepareTokenizerResourceForIntegration as the remaining tokenizer setup
helper.
In `@internal/ingestion/service/ingestion_service.go`:
- Around line 227-232: Extract a reusable markTaskFailed helper in executeTask
to handle the repeated failure path: log the original error, call
ingestionTaskDAO.UpdateStatus(task.ID, common.FAILED), log any status-update
error, and return. Replace the duplicated blocks in executeTask with calls to
this helper at each failure site so the behavior stays consistent and the code
is easier to maintain.
In `@internal/ingestion/task/real_consumer_test.go`:
- Around line 62-71: The SQLite DSN is being built inline in this test,
duplicating the same shared-memory pattern used elsewhere. Replace the local
`dsn` construction in `real_consumer_test.go` with the shared helper once it
exists, ideally `testutil.SharedMemoryDSN`, so `TestRealConsumer` relies on a
single source of truth for the in-memory SQLite connection string. Keep the rest
of the setup (`gorm.Open`, `db.DB()`, and `SetMaxOpenConns`) unchanged.
In `@internal/ingestion/task/task_context_test.go`:
- Around line 33-42: The SQLite DSN construction in task_context_test.go is
duplicated from testutil.SetupTestDB, so collapse it into a shared helper in
testutil instead of repeating the fmt.Sprintf/strings.NewReplacer logic. Add a
small SharedMemoryDSN(t *testing.T) helper in
internal/ingestion/testutil/helpers.go and use it from the task context test,
keeping the existing gorm.Open and TranslateError settings intact while removing
the copy.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 911eeb21-2cba-40b7-a3ce-c6d0888d5a54
📒 Files selected for processing (36)
internal/agent/canvas/factory_context.gointernal/agent/canvas/loop_subgraph.gointernal/agent/canvas/node_body.gointernal/agent/canvas/node_body_per_class_timeout_integration_test.gointernal/agent/canvas/scheduler.gointernal/dao/task_test.gointernal/ingestion/component/tokenizer.gointernal/ingestion/component/tokenizer_test.gointernal/ingestion/pipeline/pipeline.gointernal/ingestion/pipeline/pipeline_test.gointernal/ingestion/pipeline/real_storage_integration_test.gointernal/ingestion/pipeline/template_integration_test.gointernal/ingestion/service/execute_task_test.gointernal/ingestion/service/ingestion_service.gointernal/ingestion/service/real_consumer_dataflow_test.gointernal/ingestion/service/test_helpers.gointernal/ingestion/task/chunk_builder.gointernal/ingestion/task/chunk_builder_test.gointernal/ingestion/task/chunk_process.gointernal/ingestion/task/chunk_process_test.gointernal/ingestion/task/chunk_utils.gointernal/ingestion/task/chunk_utils_test.gointernal/ingestion/task/dataflow_real_pipeline_integration_test.gointernal/ingestion/task/dataflow_service.gointernal/ingestion/task/dataflow_service_test.gointernal/ingestion/task/embedding_test.gointernal/ingestion/task/naive_merge.gointernal/ingestion/task/naive_merge_test.gointernal/ingestion/task/real_consumer_test.gointernal/ingestion/task/task_context.gointernal/ingestion/task/task_context_test.gointernal/ingestion/task/task_handler.gointernal/ingestion/task/task_handler_test.gointernal/ingestion/testutil/helpers.gointernal/service/document.gointernal/service/model_service.go
💤 Files with no reviewable changes (9)
- internal/ingestion/task/naive_merge.go
- internal/ingestion/task/chunk_utils.go
- internal/ingestion/task/chunk_process_test.go
- internal/ingestion/task/chunk_builder.go
- internal/ingestion/task/naive_merge_test.go
- internal/ingestion/service/test_helpers.go
- internal/ingestion/task/task_context.go
- internal/ingestion/task/embedding_test.go
- internal/ingestion/task/chunk_utils_test.go
| func encodeWithTimeout(ctx context.Context, embedder Embedder, texts []string) ([]EmbeddingResult, error) { | ||
| var ( | ||
| results []EmbeddingResult | ||
| encErr error | ||
| ) | ||
| timeoutErr := runtime.WithTimeout(ctx, tokenizerTimeout, func(timeoutCtx context.Context) error { | ||
| results, encErr = embedder.Encode(texts) | ||
| return encErr | ||
| }) | ||
| if timeoutErr != nil { | ||
| return nil, timeoutErr | ||
| } | ||
| return results, nil |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Inspect runtime.WithTimeout semantics and tokenizer call sites.
rg -n -C4 'func\s+WithTimeout|WithTimeout\(' internal/agent/runtime internal/ingestion/component/tokenizer.goRepository: infiniflow/ragflow
Length of output: 6259
🏁 Script executed:
#!/bin/bash
sed -n '90,140p' internal/agent/runtime/helpers.go
printf '\n--- tests ---\n'
sed -n '150,270p' internal/agent/runtime/helpers_test.goRepository: infiniflow/ragflow
Length of output: 6038
🏁 Script executed:
#!/bin/bash
rg -n -C3 'type\s+Embedder|Encode\(' internal/ingestion/component internal -g '*.go'Repository: infiniflow/ragflow
Length of output: 50375
Timeout doesn’t bound Embedder.Encode here
runtime.WithTimeout only notices the deadline after fn returns, and Embedder.Encode(texts) has no way to observe timeoutCtx. A hung embedder can therefore keep running past tokenizerTimeout; make the embedder call context-aware or enforce the timeout around the blocking work itself. (internal/ingestion/component/tokenizer.go:340-341)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@internal/ingestion/component/tokenizer.go` around lines 335 - 347, The
timeout wrapper in encodeWithTimeout does not actually stop a hung
Embedder.Encode call because the timeout context is never passed into the
embedder. Update the Embedder interface or the call path in encodeWithTimeout so
the encoding work accepts and observes context cancellation, and ensure the
blocking Encode(texts) operation in tokenizер.go is tied to timeoutCtx or
otherwise enforced within the timeout boundary.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/ingestion/pipeline/test_helpers.go`:
- Around line 205-207: The helper expectedFixedEmbedderFirst is out of sync with
fixedEmbedder.Encode: it still computes a weighted name/text value instead of
matching the embedder’s first vector element. Update expectedFixedEmbedderFirst
to mirror fixedEmbedder.Encode by deriving the first value from the text length
only, so the integration assertions use the same behavior as the embedder.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 78cfef15-7d6e-4bf8-8389-2d8f2ab2d7f5
📒 Files selected for processing (5)
internal/ingestion/component/tokenizer.gointernal/ingestion/component/tokenizer_test.gointernal/ingestion/pipeline/real_storage_integration_test.gointernal/ingestion/pipeline/template_integration_test.gointernal/ingestion/pipeline/test_helpers.go
🚧 Files skipped from review as they are similar to previous changes (4)
- internal/ingestion/pipeline/real_storage_integration_test.go
- internal/ingestion/component/tokenizer.go
- internal/ingestion/component/tokenizer_test.go
- internal/ingestion/pipeline/template_integration_test.go
| func expectedFixedEmbedderFirst(name, text string) float64 { | ||
| return 0.1*float64(len(name)) + 0.9*float64(len(text)) | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check the current fixedEmbedder.Encode implementation
rg -n -A10 'func.*fixedEmbedder.*Encode' internal/ingestion/pipeline/template_integration_test.go
# Check all usages of expectedFixedEmbedderFirst
rg -n 'expectedFixedEmbedderFirst' internal/ingestion/Repository: infiniflow/ragflow
Length of output: 1487
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect the helper and the one non-empty-name call site
sed -n '180,220p' internal/ingestion/pipeline/test_helpers.go
sed -n '1080,1125p' internal/ingestion/pipeline/template_integration_test.go
# Look for any other expected-vector helpers that might explain the formula
rg -n -A3 -B3 'expected.*First|Vector:\s+\[]float64|0\.1\*float64\(len\(name\)\)' internal/ingestion/pipeline/Repository: infiniflow/ragflow
Length of output: 9033
🏁 Script executed:
#!/bin/bash
set -euo pipefail
sed -n '1040,1110p' internal/ingestion/pipeline/template_integration_test.goRepository: infiniflow/ragflow
Length of output: 2570
🏁 Script executed:
#!/bin/bash
set -euo pipefail
rg -n -A4 -B4 'assertTokenizerTerminalChunk\(' internal/ingestion/pipeline/template_integration_test.goRepository: infiniflow/ragflow
Length of output: 865
Align expectedFixedEmbedderFirst with fixedEmbedder.Encode internal/ingestion/pipeline/test_helpers.go:205
fixedEmbedder.Encode sets the first vector element to float64(len(text)), but this helper still uses the weighted name/text formula. That makes the integration assertions compare against the wrong value; update the helper to match the embedder.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@internal/ingestion/pipeline/test_helpers.go` around lines 205 - 207, The
helper expectedFixedEmbedderFirst is out of sync with fixedEmbedder.Encode: it
still computes a weighted name/text value instead of matching the embedder’s
first vector element. Update expectedFixedEmbedderFirst to mirror
fixedEmbedder.Encode by deriving the first value from the text length only, so
the integration assertions use the same behavior as the embedder.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
internal/ingestion/pipeline/test_helpers.go (1)
205-207: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winMake
expectedFixedEmbedderFirsttext-onlyinternal/ingestion/pipeline/test_helpers.go:205still mixesnameinto the expected first vector value, butfixedEmbedder.Encodesets it tofloat64(len(text)). Thename-aware call atinternal/ingestion/pipeline/template_integration_test.go:1101will compare against the wrong value.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/ingestion/pipeline/test_helpers.go` around lines 205 - 207, `expectedFixedEmbedderFirst` is still calculating the first vector value from both `name` and `text`, but `fixedEmbedder.Encode` uses only the text length for that slot. Update `expectedFixedEmbedderFirst` in `test_helpers.go` to be text-only, and make sure the `template_integration_test` expectation that passes `name` still matches the new helper behavior by using only the text value for the first element.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@internal/ingestion/pipeline/test_helpers.go`:
- Around line 205-207: `expectedFixedEmbedderFirst` is still calculating the
first vector value from both `name` and `text`, but `fixedEmbedder.Encode` uses
only the text length for that slot. Update `expectedFixedEmbedderFirst` in
`test_helpers.go` to be text-only, and make sure the `template_integration_test`
expectation that passes `name` still matches the new helper behavior by using
only the text value for the first element.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: e56cd54f-cd7c-478a-9b1a-1cda80d50c02
📒 Files selected for processing (4)
internal/ingestion/component/slice3_test.gointernal/ingestion/component/tokenizer.gointernal/ingestion/pipeline/real_storage_integration_test.gointernal/ingestion/pipeline/test_helpers.go
🚧 Files skipped from review as they are similar to previous changes (2)
- internal/ingestion/pipeline/real_storage_integration_test.go
- internal/ingestion/component/tokenizer.go
Summary
Feat: add embedding support