MCPcopy Index your code
hub / github.com/CaviraOSS/OpenMemory / embedForSector

Function embedForSector

backend/src/memory/embed.ts:79–90  ·  view source on GitHub ↗
(t: string, s: string)

Source from the content-addressed store, hash-verified

77};
78
79export async function embedForSector(t: string, s: string): Promise<number[]> {
80 if (!sector_configs[s]) throw new Error(`Unknown sector: ${s}`);
81 if (tier === "hybrid") return gen_syn_emb(t, s);
82 if (tier === "smart" && env.emb_kind !== "synthetic") {
83 const syn = gen_syn_emb(t, s),
84 sem = await get_sem_emb(t, s),
85 comp = compress_vec(sem, 128);
86 return fuse_vecs(syn, comp);
87 }
88 if (tier === "fast") return gen_syn_emb(t, s);
89 return await get_sem_emb(t, s);
90}
91
92/**
93 * Batch embed query text for ALL sectors in one API call.

Callers 5

hsg_queryFunction · 0.90
embedQueryForAllSectorsFunction · 0.70
embedMultiSectorFunction · 0.70
embedFunction · 0.70
dynroutesFunction · 0.50

Calls 4

gen_syn_embFunction · 0.70
get_sem_embFunction · 0.70
compress_vecFunction · 0.70
fuse_vecsFunction · 0.70

Tested by

no test coverage detected