Multi-stage evidence-grounded inference architecture replacing the monolithic 9B model extraction pipeline. CPU-first specialist services handle routine extraction while the 9B vLLM model is preserved for semantic adjudication of ambiguous cases. Key components: - Capability-aware inference gateway (OpenAI-compatible + Ollama) - Endpoint registry with DB migrations and REST API - Sentence-aware document segmenter (property tests) - Deterministic financial parsing with offset integrity - Symbol resolution with ambiguity detection - Specialist service (GLiNER2, dynamic batching, K8s deployment) - Company-specific sentiment (FinBERT, calibration) - Retrieval-based novelty and duplicate detection - Confidence calibration pipeline - Deterministic routing engine (property tests) - 9B adjudication layer with VRAM gating - Stock-specific impact model (features, labels, baseline, trained) - Pipeline orchestrator (state machine, queues, leases, feature flags) - Bounded parallelism (async workers, semaphore, load shedding) - Observability (tracing, metrics, alerts) - Compatibility adapter (v3→v2 golden mapping tests) - Shadow/canary promotion framework - Active learning and fine-tuning pipeline Test results: 1,161 tests pass, ruff lint clean. All 282 spec tasks completed.
75 lines
3.2 KiB
SQL
75 lines
3.2 KiB
SQL
-- Migration 042: Seed Inference Registry
|
|
-- Populates initial endpoint profiles and model deployments for the
|
|
-- existing Ollama and vLLM services.
|
|
--
|
|
-- Task 18.1: Create the current Ollama endpoint profile
|
|
-- Task 18.2: Create the current vLLM OpenAI-compatible endpoint profile
|
|
-- Task 18.3: Create model deployments matching actual runtime state
|
|
--
|
|
-- This is a DATA migration. The schema was created in 040_inference_registry.sql.
|
|
-- Uses ON CONFLICT DO NOTHING for idempotency.
|
|
|
|
-- ─── 18.1: Ollama endpoint profile ───────────────────────────────────────────
|
|
INSERT INTO inference_endpoints (id, name, protocol, base_url, auth_secret_ref, auth_scheme, default_headers, health_path, enabled)
|
|
VALUES (
|
|
'a0000000-0000-4000-8000-000000000001'::uuid,
|
|
'stonks-ollama',
|
|
'ollama_native',
|
|
'http://ollama.ollama-service.svc.cluster.local:11434',
|
|
NULL,
|
|
'none',
|
|
'{}',
|
|
'/api/tags',
|
|
TRUE
|
|
)
|
|
ON CONFLICT (name) DO NOTHING;
|
|
|
|
-- ─── 18.2: vLLM OpenAI-compatible endpoint profile ──────────────────────────
|
|
INSERT INTO inference_endpoints (id, name, protocol, base_url, auth_secret_ref, auth_scheme, default_headers, health_path, enabled)
|
|
VALUES (
|
|
'a0000000-0000-4000-8000-000000000002'::uuid,
|
|
'stonks-vllm',
|
|
'openai_chat',
|
|
'http://kube-vllm.stonks-oracle.svc.cluster.local:8000',
|
|
NULL,
|
|
'none',
|
|
'{}',
|
|
'/health',
|
|
TRUE
|
|
)
|
|
ON CONFLICT (name) DO NOTHING;
|
|
|
|
-- ─── 18.3: Model deployments ─────────────────────────────────────────────────
|
|
|
|
-- Ollama model deployment (qwen3.5:9b served via Ollama native protocol)
|
|
INSERT INTO model_deployments (id, endpoint_id, served_model_name, display_name, capabilities, context_window, max_output_tokens, quantization, runtime_metadata, enabled)
|
|
VALUES (
|
|
'b0000000-0000-4000-8000-000000000001'::uuid,
|
|
'a0000000-0000-4000-8000-000000000001'::uuid,
|
|
'qwen3.5:9b',
|
|
'Qwen 3.5 9B (Ollama)',
|
|
'{"chat_completions": true, "json_schema": false, "json_object": true, "seed": false, "usage": false, "max_completion_tokens": false, "model_listing": true}',
|
|
32768,
|
|
32768,
|
|
NULL,
|
|
'{"source": "ollama_native", "notes": "Ollama-served model with native JSON mode"}',
|
|
TRUE
|
|
)
|
|
ON CONFLICT (endpoint_id, served_model_name) DO NOTHING;
|
|
|
|
-- vLLM model deployment (AxionML/Qwen3.5-9B-NVFP4 on RTX 4070 Ti SUPER)
|
|
INSERT INTO model_deployments (id, endpoint_id, served_model_name, display_name, capabilities, context_window, max_output_tokens, quantization, runtime_metadata, enabled)
|
|
VALUES (
|
|
'b0000000-0000-4000-8000-000000000002'::uuid,
|
|
'a0000000-0000-4000-8000-000000000002'::uuid,
|
|
'AxionML/Qwen3.5-9B-NVFP4',
|
|
'Qwen 3.5 9B NVFP4 (vLLM)',
|
|
'{"chat_completions": true, "json_schema": true, "json_object": true, "seed": true, "usage": true, "max_completion_tokens": true, "model_listing": true}',
|
|
8192,
|
|
2048,
|
|
'NVFP4',
|
|
'{"gpu": "RTX 4070 Ti SUPER", "gpu_memory_utilization": 0.80, "max_num_seqs": 8, "vllm_structured_outputs": true}',
|
|
TRUE
|
|
)
|
|
ON CONFLICT (endpoint_id, served_model_name) DO NOTHING;
|