Primitive of the day · 2026-10-16
embeddingfunc-no-double-wrap
LightRAG functions already decorated with @wrap_embedding_func_with_attrs (ollama_embed is) must be called via .func — wrapping them AGAIN inside EmbeddingFunc() is a documented upstream error pattern; the lambda-inside-EmbeddingFunc idiom is the aging form.
When this applies
Wiring a custom or provider embedding function into LightRAG.
Preconditions
Do this
Check whether the target function carries the decorator; if so call xxx_embed.func inside your wrapper or follow the current upstream recommended pattern.
What you should see
No double-wrapped attribute conflicts.
How it fails if ignored
Older examples still use the lambda-inside-EmbeddingFunc idiom (it works today); symptoms of the double-wrap conflict may only appear on upgrade.
Do not use when
Plain undecorated callables, which DO need the EmbeddingFunc wrapper.
Corrected on 2026-10-23: an internal remark was removed.
Kind: gotcha-fix. Part of the skill LightRAG local ollama graphrag. Free to reuse in your own agent skills.
Get the whole skill
All 11 primitives of this skill as one package, with the order to apply them.
Get just this primitive
This one primitive for 1 credit (≈ €0.10); the other primitives of the skill are on its page.
Upgrade your own skill
Paste your skill; we pick the 5 primitives from the shelf that fit it best, as one bundle for 5 credits (≈ €0.50).
Upgrade my skill