code wiki / _hdl_build / nx_llm_provider.nx
nx_llm_provider.nx
buildroot/runtime/_hdl_build/nx_llm_provider.nx
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
imports: nx_syscalls.nx
imported by: nx_llm_provider_local_test.nxnx_llm_provider_test.nx
structs
| none |
consts
| 16 | const LP_NONE: i64 = 0 |
| 17 | const LP_NISHI_LLM: i64 = 1 // sovereign custom model (preferred) |
| 18 | const LP_EXTERNAL: i64 = 2 // Diffbot / embedding API -- the backup to Claude |
| 19 | const LP_CLAUDE: i64 = 3 // current fallback |
| 22 | const LP_TASK_EXTRACT: i64 = 1 // semantic prose -> verified claims |
| 23 | const LP_TASK_EMBED: i64 = 2 // semantic embeddings for retrieval |
| 24 | const LP_TASK_PROSE: i64 = 3 // natural-language authoring |
| 27 | const LP_SVC_NONE: i64 = 0 |
| 28 | const LP_SVC_DIFFBOT: i64 = 10 // Diffbot Article/Knowledge-Graph extraction |
| 29 | const LP_SVC_EMBED_API: i64 = 11 // an embedding API / local sentence-transformer |
| 57 | const LP_LOCAL: i64 = 4 |
| 59 | const LP_LOCAL_MINILM: i64 = 20 // all-MiniLM-L6-v2 (~22M params, ~80MB, CPU/GPU) -- local EMBEDDINGS |
| 60 | const LP_LOCAL_BGE: i64 = 21 // bge-small-en-v1.5 -- stronger local embeddings, still tiny |
| 61 | const LP_LOCAL_EXTRACT: i64 = 22 // a small local instruct model (Qwen/Llama) for prose->claims EXTRACT |
functions
| 32 | func lp_route(nishi_ready: i64, external_configured: i64) -> i64 called by 1: main |
| 39 | func lp_reduces_claude(provider: i64) -> i64 { if provider == LP_CLAUDE { return 0 } return 1 } called by 1: main |
| 42 | func lp_sovereign(provider: i64) -> i64 { if provider == LP_NISHI_LLM { return 1 } return 0 } called by 1: main |
| 45 | func lp_external_service(task: i64) -> i64 called by 1: main |
| 52 | func lp_retires_claude(nishi_ready: i64) -> i64 { if nishi_ready == 1 { return 1 } return 0 } called by 1: main |
| 64 | func lp_route_local(nishi_ready: i64, local_available: i64, external_configured: i64) -> i64 called by 1: main |
| 72 | func lp_local_is_free(provider: i64) -> i64 { if provider == LP_LOCAL { return 1 } return 0 } called by 1: main |
| 75 | func lp_local_model(task: i64) -> i64 called by 1: main |
| 82 | func lp_is_sovereign_ish(provider: i64) -> i64 called by 1: main |