Views
No views yet
| Surface | Mechanism | UI |
|---|---|---|
| Path A — Custom GPT Action | OpenAPI schema → /generate | Markdown fallback |
| Path B — MCP Apps | MCP tool → structuredContent | Real interactive iframe widget |
Chat turn
│
▼
lib/router.py ── heuristic or explicit mode
│
▼
HF Inference Endpoint (handler.py)
│ base model + 3 LoRA adapters (support / analytics / form)
│ emits: <ui>{json}</ui> then prose
│
├─── Path A ── gateway/app.py (FastAPI)
│ renders ui_spec → markdown
│ served via openapi-schema.yaml → Custom GPT Action
│
└─── Path B ── mcp-server/server.py (FastMCP)
returns structuredContent
widget/adaptive.html renders in iframe1cp .env.example .env
2# fill in HF_ENDPOINT_URL, HF_TOKEN, adapter repo IDs1pip install -r gateway/requirements.txt
2python -m gateway.app # runs on :8000gateway/openapi-schema.yaml into your GPT's Actions editor.
Set the server URL to your deployed gateway (ngrok / Railway / Fly.io).1pip install -r mcp-server/requirements.txt
2
3# stdio (local MCP client, e.g. Claude Desktop)
4python mcp-server/server.py
5
6# SSE (remote clients, e.g. ChatGPT plugin host)
7python mcp-server/server.py --http # listens on :31001{
2 "mcpServers": {
3 "adaptive-model": {
4 "command": "python",
5 "args": ["mcp-server/server.py"]
6 }
7 }
8}hf-endpoint/handler.py to your model repo on the Hub.BASE_MODEL, ADAPTER_SUPPORT, ADAPTER_ANALYTICS, ADAPTER_FORM..env as HF_ENDPOINT_URL.<ui>{...}</ui> followed by prose.
Generate synthetic seed data to bootstrap each adapter:1pip install -r hf-endpoint/requirements.txt
2
3python training/generate_examples.py --all --n 200 -o data/
4# writes data/support.jsonl data/analytics.jsonl data/form.jsonlSFTTrainer works well):1from trl import SFTTrainer, SFTConfig
2from peft import LoraConfig
3
4lora_cfg = LoraConfig(r=16, lora_alpha=32, target_modules=["q_proj","v_proj"])
5trainer = SFTTrainer(
6 model=base_model,
7 args=SFTConfig(output_dir="./adapter-support", num_train_epochs=3),
8 train_dataset=support_dataset,
9 peft_config=lora_cfg,
10)
11trainer.train()
12trainer.push_to_hub("your-org/adapter-support")1// form
2{"component":"form","props":{"title":"...","fields":[{"name":"x","label":"X","type":"text","required":true}],"submitLabel":"Send"}}
3
4// chart
5{"component":"chart","props":{"title":"...","type":"bar","data":{"labels":["Jan","Feb"],"datasets":[{"label":"Revenue","data":[400,600]}]}}}
6
7// card
8{"component":"card","props":{"title":"...","body":"...","items":[{"label":"Status","value":"OK"}]}}
9
10// table
11{"component":"table","props":{"columns":["Name","Value"],"rows":[["Alpha",1],["Beta",2]]}}lib/markdown_renderer.py.lib/router.py) scores keywords in the last user turn:| Adapter | Triggers |
|---|---|
support | error, help, issue, bug, broken, fix … |
analytics | chart, graph, trend, metric, dashboard … |
form | form, fill, submit, register, sign up … |
mode explicitly to override. Default is support.