fix: restore memory search output dimensionality
This commit is contained in:
parent
a09b32e86f
commit
750a67b991
@ -63,6 +63,29 @@ describe("memory search config", () => {
|
||||
expect(resolved?.fallback).toBe("none");
|
||||
});
|
||||
|
||||
it("preserves output dimensionality overrides", () => {
|
||||
const cfg = asConfig({
|
||||
agents: {
|
||||
defaults: {
|
||||
memorySearch: {
|
||||
outputDimensionality: 768,
|
||||
},
|
||||
},
|
||||
list: [
|
||||
{
|
||||
id: "main",
|
||||
default: true,
|
||||
memorySearch: {
|
||||
outputDimensionality: 512,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
const resolved = resolveMemorySearchConfig(cfg, "main");
|
||||
expect(resolved?.outputDimensionality).toBe(512);
|
||||
});
|
||||
|
||||
it("merges defaults and overrides", () => {
|
||||
const cfg = asConfig({
|
||||
agents: {
|
||||
@ -131,113 +154,6 @@ describe("memory search config", () => {
|
||||
expect(resolved?.extraPaths).toEqual(["/shared/notes", "docs", "../team-notes"]);
|
||||
});
|
||||
|
||||
it("normalizes multimodal settings", () => {
|
||||
const cfg = asConfig({
|
||||
agents: {
|
||||
defaults: {
|
||||
memorySearch: {
|
||||
provider: "gemini",
|
||||
model: "gemini-embedding-2-preview",
|
||||
multimodal: {
|
||||
enabled: true,
|
||||
modalities: ["all"],
|
||||
maxFileBytes: 8192,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
const resolved = resolveMemorySearchConfig(cfg, "main");
|
||||
expect(resolved?.multimodal).toEqual({
|
||||
enabled: true,
|
||||
modalities: ["image", "audio"],
|
||||
maxFileBytes: 8192,
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps an explicit empty multimodal modalities list empty", () => {
|
||||
const cfg = asConfig({
|
||||
agents: {
|
||||
defaults: {
|
||||
memorySearch: {
|
||||
provider: "gemini",
|
||||
model: "gemini-embedding-2-preview",
|
||||
multimodal: {
|
||||
enabled: true,
|
||||
modalities: [],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
const resolved = resolveMemorySearchConfig(cfg, "main");
|
||||
expect(resolved?.multimodal).toEqual({
|
||||
enabled: true,
|
||||
modalities: [],
|
||||
maxFileBytes: 10 * 1024 * 1024,
|
||||
});
|
||||
expect(resolved?.provider).toBe("gemini");
|
||||
});
|
||||
|
||||
it("does not enforce multimodal provider validation when no modalities are active", () => {
|
||||
const cfg = asConfig({
|
||||
agents: {
|
||||
defaults: {
|
||||
memorySearch: {
|
||||
provider: "openai",
|
||||
model: "text-embedding-3-small",
|
||||
fallback: "openai",
|
||||
multimodal: {
|
||||
enabled: true,
|
||||
modalities: [],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
const resolved = resolveMemorySearchConfig(cfg, "main");
|
||||
expect(resolved?.multimodal).toEqual({
|
||||
enabled: true,
|
||||
modalities: [],
|
||||
maxFileBytes: 10 * 1024 * 1024,
|
||||
});
|
||||
});
|
||||
|
||||
it("rejects multimodal memory on unsupported providers", () => {
|
||||
const cfg = asConfig({
|
||||
agents: {
|
||||
defaults: {
|
||||
memorySearch: {
|
||||
provider: "openai",
|
||||
model: "text-embedding-3-small",
|
||||
multimodal: { enabled: true, modalities: ["image"] },
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
expect(() => resolveMemorySearchConfig(cfg, "main")).toThrow(
|
||||
/memorySearch\.multimodal requires memorySearch\.provider = "gemini"/,
|
||||
);
|
||||
});
|
||||
|
||||
it("rejects multimodal memory when fallback is configured", () => {
|
||||
const cfg = asConfig({
|
||||
agents: {
|
||||
defaults: {
|
||||
memorySearch: {
|
||||
provider: "gemini",
|
||||
model: "gemini-embedding-2-preview",
|
||||
fallback: "openai",
|
||||
multimodal: { enabled: true, modalities: ["image"] },
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
expect(() => resolveMemorySearchConfig(cfg, "main")).toThrow(
|
||||
/memorySearch\.multimodal does not support memorySearch\.fallback/,
|
||||
);
|
||||
});
|
||||
|
||||
it("includes batch defaults for openai without remote overrides", () => {
|
||||
const cfg = configWithDefaultProvider("openai");
|
||||
const resolved = resolveMemorySearchConfig(cfg, "main");
|
||||
@ -284,7 +200,6 @@ describe("memory search config", () => {
|
||||
expect(resolved?.sync.sessions).toEqual({
|
||||
deltaBytes: 100000,
|
||||
deltaMessages: 50,
|
||||
postCompactionForce: true,
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user