openclaw - ✅(Solved) Fix feat: support Jina Embeddings v5 task parameter for task-specific adapters [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#74419Fetched 2026-04-30 06:24:07
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
2
Author
Timeline (top)
commented ×1cross-referenced ×1

Root Cause

Jina v5 is the current price-performance leader for text embedding (239M params, 2x faster than v3, $0.02/1M tokens, 65.5 MMTEB). Without task adapters, users miss the primary innovation of v5 over v3.

Fix Action

Fixed

PR fix notes

PR #74444: feat(openai): add queryTask/documentTask config for Jina v5 task-specific embeddings

Description (problem / solution / changelog)

Summary

Add typed configuration fields queryTask and documentTask under agents.*.memorySearch to forward Jina v5 task-specific LoRA adapter parameters in OpenAI-compatible embedding requests.

Closes #74419

Background

Jina Embeddings v5 introduces task-specific LoRA adapters that significantly boost performance per task type. This requires passing a task parameter in the embeddings API body. Currently OpenClaw only sends model and input — the task field cannot be configured. v5 models still work without it (falling back to general-purpose embeddings), but task-optimized quality is left on the table.

Jina v5 is the current price-performance leader for text embeddings (239M params, $0.02/1M tokens, 65.5 MMTEB). Without task adapters, users miss the primary innovation of v5 over v3.

Changes

Config surface

  • New queryTask and documentTask fields in MemorySearchConfig, MemorySearchSchema, and resolved config
  • Both fields are optional strings — existing configs continue to work unchanged

Embedding provider pipeline

  • RemoteEmbeddingClient type extended with optional queryTask/documentTask
  • createRemoteEmbeddingProvider forwards task in the request body, differentiated by query vs document
  • OpenAiEmbeddingClient extracts task values from MemoryEmbeddingProviderCreateOptions

Cache identity

  • Task values included in embedding cache key — changing task triggers automatic cache invalidation

Batch indexing

  • memory-embedding-adapter.ts forwards documentTask in batch embedding request bodies

Docs

  • docs/providers/openai.md — new Jina v5 task parameters section with config example
  • docs/reference/memory-config.md — full reference for queryTask/documentTask

Supported task values

  • retrieval.query / retrieval.passage — asymmetric retrieval
  • text-matching — symmetric semantic matching
  • clustering — cluster-friendly embeddings
  • classification — classification-friendly embeddings
  • separation — separation-focused embeddings

When left unset, Jina v5 defaults to general-purpose embeddings.

Files changed (13 files, +153/-9)

FileChange
src/config/types.tools.tsAdd queryTask/documentTask types
src/config/zod-schema.agent-runtime.tsAdd fields to MemorySearchSchema
src/agents/memory-search.tsResolve and include in merged config
src/plugins/memory-embedding-providers.tsAdd to MemoryEmbeddingProviderCreateOptions
src/memory-host-sdk/host/embeddings.types.tsAdd to EmbeddingProviderOptions
src/memory-host-sdk/host/embeddings-remote-provider.tsForward task in body
packages/memory-host-sdk/src/host/embeddings-remote-provider.tsSync with src version
extensions/memory-core/src/memory/manager-provider-state.tsInclude in provider requests
extensions/openai/embedding-provider.tsExtract tasks from options
extensions/openai/memory-embedding-adapter.tsCache key + batch body
docs/providers/openai.mdJina v5 task docs
docs/reference/memory-config.mdConfig reference
CHANGELOG.mdChangelog entry

Changed files

  • CHANGELOG.md (modified, +1/-0)
  • docs/providers/openai.md (modified, +40/-0)
  • docs/reference/memory-config.md (modified, +45/-0)
  • extensions/memory-core/src/memory/manager-provider-state.ts (modified, +8/-0)
  • extensions/openai/embedding-provider.ts (modified, +8/-1)
  • extensions/openai/memory-embedding-adapter.ts (modified, +3/-0)
  • packages/memory-host-sdk/src/host/embeddings-remote-provider.ts (modified, +11/-4)
  • src/agents/memory-search.ts (modified, +6/-0)
  • src/config/types.tools.ts (modified, +12/-0)
  • src/config/zod-schema.agent-runtime.ts (modified, +2/-0)
  • src/memory-host-sdk/host/embeddings-remote-provider.ts (modified, +11/-4)
  • src/memory-host-sdk/host/embeddings.types.ts (modified, +4/-0)
  • src/plugins/memory-embedding-providers.ts (modified, +2/-0)

Code Example

{
  "memorySearch": {
    "model": "jina-embeddings-v5-text-nano",
    "provider": "openai",
    "extraBody": {
      "task": "retrieval.query"
    }
  }
}

---

{
  "memorySearch": {
    "model": "jina-embeddings-v5-text-nano",
    "queryTask": "retrieval.query",
    "documentTask": "retrieval.passage"
  }
}

---

body: {
    model: client.model,
    input,
    ...inputType ? { input_type: inputType } : {}
}
RAW_BUFFERClick to expand / collapse

Feature request

Jina Embeddings v5 (jina-embeddings-v5-text-nano / jina-embeddings-v5-text-small) introduces task-specific LoRA adapters that significantly boost performance per task type. This requires passing a task parameter in the embeddings API body.

Current behavior

OpenClaw only sends model, input, and optionally input_type in the embedding request body. The task field cannot be configured.

v5 models still work without task (they fall back to general-purpose embeddings), but task-optimized quality is left on the table.

Request

Allow configuring extra body parameters for embedding requests, e.g. via memorySearch.extraBody or a dedicated memorySearch.task field:

{
  "memorySearch": {
    "model": "jina-embeddings-v5-text-nano",
    "provider": "openai",
    "extraBody": {
      "task": "retrieval.query"
    }
  }
}

Or differentiate query vs document tasks:

{
  "memorySearch": {
    "model": "jina-embeddings-v5-text-nano",
    "queryTask": "retrieval.query",
    "documentTask": "retrieval.passage"
  }
}

Why this matters

Jina v5 is the current price-performance leader for text embedding (239M params, 2x faster than v3, $0.02/1M tokens, 65.5 MMTEB). Without task adapters, users miss the primary innovation of v5 over v3.

Relevant Jina v5 task values

  • retrieval.query — query-side embeddings
  • retrieval.passage — document-side embeddings
  • text-matching — semantic textual similarity
  • clustering — document clustering
  • classification — text classification
  • separation — ensuring unrelated inputs are far apart

Code pointer

The body is constructed in extensions/openai/embedding-provider.ts (createOpenAiEmbeddingProvider):

body: {
    model: client.model,
    input,
    ...inputType ? { input_type: inputType } : {}
}

A straightforward approach would be to pass through an extraBody object from the config alongside input_type.

extent analysis

TL;DR

To utilize task-specific LoRA adapters in Jina Embeddings v5, add support for passing a task parameter in the embeddings API body, potentially via an extraBody object or dedicated task fields.

Guidance

  • Modify the createOpenAiEmbeddingProvider function in extensions/openai/embedding-provider.ts to accept and pass through an extraBody object from the config.
  • Introduce a new configuration option, such as memorySearch.extraBody or memorySearch.task, to allow users to specify task-specific parameters.
  • Update the embedding request body construction to include the task field, using the provided extraBody object or dedicated task fields.
  • Consider adding support for differentiating between query and document tasks, using separate fields like queryTask and documentTask.

Example

body: {
    model: client.model,
    input,
    ...inputType ? { input_type: inputType } : {},
    ...extraBody // assuming extraBody is an object passed from the config
}

Notes

The exact implementation details may vary depending on the specific requirements and constraints of the project. It's essential to ensure that the new configuration options are properly validated and handled to avoid any potential issues.

Recommendation

Apply workaround by introducing an extraBody object or dedicated task fields to the configuration, allowing users to specify task-specific parameters for Jina Embeddings v5. This will enable the utilization of task-specific LoRA adapters and improve performance.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix feat: support Jina Embeddings v5 task parameter for task-specific adapters [1 pull requests, 1 comments, 2 participants]