Skip to content

[Feature] Support ZeroEntropy native embedding API #68

@codxt

Description

@codxt

Is this feature related to a problem? | 该功能需求是否与某个问题相关?请描述

Support ZeroEntropy native embedding API in memory-tencentdb

Summary

Please add first-class support for ZeroEntropy as an embedding provider in @tencentdb-agent-memory/memory-tencentdb.

Currently, memory-tencentdb treats non-local embedding providers as OpenAI-compatible and calls:

ts
${this.baseUrl}/embeddings

This works for OpenAI-compatible providers, but ZeroEntropy’s working embedding endpoint is native/non-OpenAI-shaped:

POST https://api.zeroentropy.dev/v1/models/embed

with model:
zembed-1

and request body shape:

json
{
"input": ["text to embed"],
"input_type": "query",
"model": "zembed-1"
}

The response shape is also different from OpenAI:

json
{
"results": [
{
"embedding": [...]
}
]
}

rather than:

json
{
"data": [
{
"index": 0,
"embedding": [...]
}
]
}

Environment

  • Package: @tencentdb-agent-memory/memory-tencentdb
  • Observed version: 0.3.5
  • Runtime: Hermes sidecar gateway
  • Gateway health reports:
    • vectorStore: true
    • embeddingService: true
  • Embedding config:
    • provider: openai
    • baseUrl: https://api.zeroentropy.dev
    • model: zembed-1
    • dimensions: 2560

Current behavior

With ZeroEntropy configured, memory-tencentdb calls:

POST https://api.zeroentropy.dev/embeddings

That returns:

HTTP 404

If /v1 is included in the base URL, the OpenAI-style endpoint still fails:

POST https://api.zeroentropy.dev/v1/embeddings
HTTP 404 {"detail":"Not Found"}

As a result, the embedding service object exists, but no vectors are persisted.

Example local DB state after multiple captured conversations:

l0_conversations: 123
l1_records: 3
l0_vec_rowids: 0
l1_vec_rowids: 0

Memory search falls back to FTS for exact keyword matches, while semantic/vector search returns no results.

Expected behavior

memory-tencentdb should support ZeroEntropy embeddings, either via:

  1. A dedicated provider, e.g.

yaml
embedding:
enabled: true
provider: zeroentropy
baseUrl: https://api.zeroentropy.dev
model: zembed-1
dimensions: 2560

or

  1. A configurable embedding endpoint/response adapter that can support non-OpenAI-compatible APIs.

For ZeroEntropy, the provider should:

  • call:

POST {baseUrl}/v1/models/embed

  • send:

json
{
"input": ["..."],
"input_type": "query",
"model": "zembed-1"
}

  • parse:

results[].embedding

  • return normalized Float32Array embeddings as the existing embedding service does.

Validation

Direct ZeroEntropy native call succeeds:

POST https://api.zeroentropy.dev/v1/models/embed
model: zembed-1

Result:

HTTP 200
embedding dimensions: 2560

But the current OpenAI-compatible path used by memory-tencentdb fails:

POST https://api.zeroentropy.dev/embeddings
HTTP 404

Describe the solution you'd like | 描述你期望的解决方案

Suggested implementation

Add a ZeroEntropyEmbeddingService or branch inside the existing remote embedding service:

ts
if (providerName === "zeroentropy") {
const fetchUrl = ${baseUrl.replace(//+$/, "")}/v1/models/embed;
const body = {
input: texts,
input_type: "query",
model: this.model,
};

const json = await resp.json();
if (!json.results || !Array.isArray(json.results)) {
throw new Error("ZeroEntropy embedding API returned unexpected format: missing 'results' array");
}

return json.results.map((r) => sanitizeAndNormalize(r.embedding));
}

Optionally allow input_type to be configured (query vs document) if users need both retrieval modes.

Why this matters

ZeroEntropy provides 2560-dimensional embeddings through zembed-1, and works well as a hosted embedding provider. Supporting it directly would let Hermes/TencentDB users use ZeroEntropy for semantic memory search without needing an OpenAI-compatible proxy.

Describe alternatives you've considered | 描述你考虑过的其他方案

No response

Additional context | 补充说明

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions