code wiki / _hdl_build / nx_llm_provider.nx

nx_llm_provider.nx

buildroot/runtime/_hdl_build/nx_llm_provider.nx

4585 B86 linesdepth 2pulls 2 transitivereach 2 importersview sourcekind librarytopic llm
docsdependenciesstructsconstsfunctions

about

nx_llm_provider.nx -- a BACKUP to Claude for the LLM-rung work (operator: "figure out a plan to have a backup to you that actually can do that like maybe diffbot or something"). For the work the team cannot yet do sovereignly -- semantic prose->claims EXTRACT, semantic EMBEDDINGS, prose authoring -- the team ROUTES to the most-preferred AVAILABLE provider, so Claude becomes a fallback, not the default: 1. NISHI-LLM (the future custom model -- fully sovereign, the end goal) 2. EXTERNAL (a configured 3rd-party: Diffbot for extraction, an embedding API for semantics) = the BACKUP that reduces Claude dependence today 3. CLAUDE (current fallback when nothing else is available) This is the routing/governance LAYER the team owns; the external calls are HTTPS (env-gated like all live reach). Honest: EXTERNAL is paid + not sovereign -- a stepping stone, not the destination. license_tier: ORIGINAL Pairs with nx_llm_gap_registry (what still needs the rung) + nx_teacher.

dependencies 1 imports · 2 importers

nx_syscalls.nx nx_llm_provider.nx nx_llm_provider_local_test.nx nx_llm_provider_test.nx

imports: nx_syscalls.nx

imported by: nx_llm_provider_local_test.nxnx_llm_provider_test.nx

structs

none

consts

16const LP_NONE: i64 = 0
17const LP_NISHI_LLM: i64 = 1 // sovereign custom model (preferred)
18const LP_EXTERNAL: i64 = 2 // Diffbot / embedding API -- the backup to Claude
19const LP_CLAUDE: i64 = 3 // current fallback
22const LP_TASK_EXTRACT: i64 = 1 // semantic prose -> verified claims
23const LP_TASK_EMBED: i64 = 2 // semantic embeddings for retrieval
24const LP_TASK_PROSE: i64 = 3 // natural-language authoring
27const LP_SVC_NONE: i64 = 0
28const LP_SVC_DIFFBOT: i64 = 10 // Diffbot Article/Knowledge-Graph extraction
29const LP_SVC_EMBED_API: i64 = 11 // an embedding API / local sentence-transformer
57const LP_LOCAL: i64 = 4
59const LP_LOCAL_MINILM: i64 = 20 // all-MiniLM-L6-v2 (~22M params, ~80MB, CPU/GPU) -- local EMBEDDINGS
60const LP_LOCAL_BGE: i64 = 21 // bge-small-en-v1.5 -- stronger local embeddings, still tiny
61const LP_LOCAL_EXTRACT: i64 = 22 // a small local instruct model (Qwen/Llama) for prose->claims EXTRACT

functions

32func lp_route(nishi_ready: i64, external_configured: i64) -> i64
called by 1: main
39func lp_reduces_claude(provider: i64) -> i64 { if provider == LP_CLAUDE { return 0 } return 1 }
called by 1: main
42func lp_sovereign(provider: i64) -> i64 { if provider == LP_NISHI_LLM { return 1 } return 0 }
called by 1: main
45func lp_external_service(task: i64) -> i64
called by 1: main
52func lp_retires_claude(nishi_ready: i64) -> i64 { if nishi_ready == 1 { return 1 } return 0 }
called by 1: main
64func lp_route_local(nishi_ready: i64, local_available: i64, external_configured: i64) -> i64
called by 1: main
72func lp_local_is_free(provider: i64) -> i64 { if provider == LP_LOCAL { return 1 } return 0 }
called by 1: main
75func lp_local_model(task: i64) -> i64
called by 1: main
82func lp_is_sovereign_ish(provider: i64) -> i64
called by 1: main