decision-model-router / workflow.json
hmb's picture
hmb HF Staff
Upload folder using huggingface_hub
641a7ea verified
Raw History Blame Contribute Delete
5.36 kB
{
"schema_version": "2",
"name": "Decision Model Router",
"references": [
{
"id": "prompt",
"role": "reference",
"label": "Prompt",
"asset_type": "text",
"inputs": [
{
"id": "in",
"label": "Text",
"type": "text"
}
],
"outputs": [
{
"id": "out",
"label": "Text",
"type": "text"
}
],
"data": {
"out": "Write a Python function that returns the n-th Fibonacci number in O(log n) time and explain why it works."
}
}
],
"operators": [
{
"id": "router",
"role": "operator",
"kind": "space",
"space_id": "vllm-sr/d3-decision-model",
"endpoint": "/decide",
"label": "d3 router: difficulty + domain",
"inputs": [
{
"id": "state",
"label": "Prompt",
"type": "text",
"required": true
},
{
"id": "questions",
"label": "Router questions",
"type": "text"
}
],
"outputs": [
{
"id": "scores",
"label": "Router verdict",
"type": "json",
"output_index": 1
}
],
"data": {
"questions": "{\n \"difficulty\": {\n \"type\": \"score\",\n \"instructions\": \"How hard is it for an AI assistant to answer this prompt correctly? Easy: simple facts, greetings, short rewrites. Hard: multi-step reasoning, non-trivial code, proofs, expert analysis.\",\n \"criteria\": [\n \"easy\",\n \"medium\",\n \"hard\"\n ]\n },\n \"domain\": {\n \"type\": \"choice\",\n \"instructions\": \"What kind of task is this?\",\n \"criteria\": {\n \"code\": \"Programming, debugging, software\",\n \"math\": \"Math, logic, quantitative reasoning\",\n \"general\": \"Facts, advice, everyday questions\",\n \"creative\": \"Writing, stories, rewriting\"\n }\n }\n}"
}
},
{
"id": "small",
"role": "operator",
"kind": "model",
"model_id": "meta-llama/Llama-3.1-8B-Instruct",
"pipeline_tag": "text-generation",
"endpoint": "chat_completion",
"provider": "deepinfra",
"label": "Small LLM: Llama-3.1-8B (DeepInfra, $0.02 in / $0.05 out per 1M tokens)",
"inputs": [
{
"id": "text",
"label": "Prompt",
"type": "text",
"required": true
},
{
"id": "max_tokens",
"label": "Max tokens",
"type": "number"
}
],
"outputs": [
{
"id": "out_0",
"label": "Answer",
"type": "markdown",
"output_index": 0
}
],
"data": {
"max_tokens": 1024
}
},
{
"id": "large",
"role": "operator",
"kind": "model",
"model_id": "openai/gpt-oss-120b",
"pipeline_tag": "text-generation",
"endpoint": "chat_completion",
"provider": "groq",
"label": "Large LLM: gpt-oss-120b (Groq, $0.15 in / $0.75 out per 1M tokens)",
"inputs": [
{
"id": "text",
"label": "Prompt",
"type": "text",
"required": true
},
{
"id": "max_tokens",
"label": "Max tokens",
"type": "number"
}
],
"outputs": [
{
"id": "out_0",
"label": "Answer",
"type": "markdown",
"output_index": 0
}
],
"data": {
"max_tokens": 4096
}
}
],
"subjects": [
{
"id": "verdict",
"role": "subject",
"label": "Router verdict (d3): hard \u2192 large, else small",
"asset_type": "json",
"inputs": [
{
"id": "in",
"label": "Router verdict (d3): hard \u2192 large, else small",
"type": "json"
}
],
"outputs": [
{
"id": "out",
"label": "Router verdict (d3): hard \u2192 large, else small",
"type": "json"
}
],
"data": {}
},
{
"id": "small_answer",
"role": "subject",
"label": "Small LLM answer (Llama-3.1-8B, ~13x cheaper per output token)",
"asset_type": "markdown",
"inputs": [
{
"id": "in",
"label": "Small LLM answer (Llama-3.1-8B, ~13x cheaper per output token)",
"type": "markdown"
}
],
"outputs": [
{
"id": "out",
"label": "Small LLM answer (Llama-3.1-8B, ~13x cheaper per output token)",
"type": "markdown"
}
],
"data": {}
},
{
"id": "large_answer",
"role": "subject",
"label": "Large LLM answer (gpt-oss-120b)",
"asset_type": "markdown",
"inputs": [
{
"id": "in",
"label": "Large LLM answer (gpt-oss-120b)",
"type": "markdown"
}
],
"outputs": [
{
"id": "out",
"label": "Large LLM answer (gpt-oss-120b)",
"type": "markdown"
}
],
"data": {}
}
],
"edges": [
{
"id": "e0",
"from_node_id": "prompt",
"from_port_id": "out",
"to_node_id": "router",
"to_port_id": "state",
"type": "text"
},
{
"id": "e1",
"from_node_id": "prompt",
"from_port_id": "out",
"to_node_id": "small",
"to_port_id": "text",
"type": "text"
},
{
"id": "e2",
"from_node_id": "prompt",
"from_port_id": "out",
"to_node_id": "large",
"to_port_id": "text",
"type": "text"
},
{
"id": "e3",
"from_node_id": "router",
"from_port_id": "scores",
"to_node_id": "verdict",
"to_port_id": "in",
"type": "json"
},
{
"id": "e4",
"from_node_id": "small",
"from_port_id": "out_0",
"to_node_id": "small_answer",
"to_port_id": "in",
"type": "markdown"
},
{
"id": "e5",
"from_node_id": "large",
"from_port_id": "out_0",
"to_node_id": "large_answer",
"to_port_id": "in",
"type": "markdown"
}
]
}