gemmarouter 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gemmarouter-0.1.0/LICENSE +14 -0
- gemmarouter-0.1.0/PKG-INFO +159 -0
- gemmarouter-0.1.0/README.md +129 -0
- gemmarouter-0.1.0/pyproject.toml +53 -0
- gemmarouter-0.1.0/setup.cfg +4 -0
- gemmarouter-0.1.0/src/gemmarouter/__init__.py +35 -0
- gemmarouter-0.1.0/src/gemmarouter/_playground_server.py +1618 -0
- gemmarouter-0.1.0/src/gemmarouter/cli.py +103 -0
- gemmarouter-0.1.0/src/gemmarouter/configuration.py +50 -0
- gemmarouter-0.1.0/src/gemmarouter/head.py +90 -0
- gemmarouter-0.1.0/src/gemmarouter/modeling.py +335 -0
- gemmarouter-0.1.0/src/gemmarouter/playground.py +32 -0
- gemmarouter-0.1.0/src/gemmarouter/router.py +247 -0
- gemmarouter-0.1.0/src/gemmarouter.egg-info/PKG-INFO +159 -0
- gemmarouter-0.1.0/src/gemmarouter.egg-info/SOURCES.txt +18 -0
- gemmarouter-0.1.0/src/gemmarouter.egg-info/dependency_links.txt +1 -0
- gemmarouter-0.1.0/src/gemmarouter.egg-info/entry_points.txt +2 -0
- gemmarouter-0.1.0/src/gemmarouter.egg-info/requires.txt +8 -0
- gemmarouter-0.1.0/src/gemmarouter.egg-info/top_level.txt +1 -0
- gemmarouter-0.1.0/tests/test_gemmarouter.py +135 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Apache License 2.0 (SDK & SetEquivariantDecisionHead Code)
|
|
2
|
+
==========================================================
|
|
3
|
+
|
|
4
|
+
Copyright 2026 Ajeet
|
|
5
|
+
|
|
6
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
you may not use this file except in compliance with the License.
|
|
8
|
+
You may obtain a copy of the License at
|
|
9
|
+
|
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
|
|
12
|
+
Base Model Notice (google/embeddinggemma-2):
|
|
13
|
+
The underlying backbone weights (`google/embeddinggemma-2`) are subject to the
|
|
14
|
+
Gemma Terms of Use: https://huggingface.co/google/embeddinggemma-2
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: gemmarouter
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Set-Equivariant Decision & Tool Router with Calibrated Abstention on EmbeddingGemma 2
|
|
5
|
+
Author: Ajeet Kumar Upadhyay
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/Ajeetkrup/gemmarouter
|
|
8
|
+
Project-URL: Repository, https://github.com/Ajeetkrup/gemmarouter
|
|
9
|
+
Project-URL: Model, https://huggingface.co/Ajeet-001/embeddinggemma2-decision-router
|
|
10
|
+
Keywords: routing,decision-router,intent-classification,mcp-tools,abstention,embeddinggemma
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: torch>=2.2.0
|
|
23
|
+
Requires-Dist: transformers>=4.48.0
|
|
24
|
+
Requires-Dist: safetensors>=0.4.3
|
|
25
|
+
Requires-Dist: huggingface-hub>=0.25.0
|
|
26
|
+
Requires-Dist: numpy>=1.26.0
|
|
27
|
+
Provides-Extra: arena
|
|
28
|
+
Requires-Dist: laya>=0.4.22; extra == "arena"
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
|
|
31
|
+
# `gemmarouter` — Set-Equivariant Decision & Tool Router on EmbeddingGemma 2
|
|
32
|
+
|
|
33
|
+
[](https://huggingface.co/Ajeet-001/embeddinggemma2-decision-router)
|
|
34
|
+
[](https://www.python.org/)
|
|
35
|
+
|
|
36
|
+
**`gemmarouter`** is the official Python SDK and CLI for [`Ajeet-001/embeddinggemma2-decision-router`](https://huggingface.co/Ajeet-001/embeddinggemma2-decision-router): an **11.6M-parameter `SetEquivariantDecisionHead`** on top of a frozen **271.0M `google/embeddinggemma-2`** bi-encoder backbone.
|
|
37
|
+
|
|
38
|
+
Given a user query or agent prompt and a set of $K$ candidate options (tools, intents, support queues), `gemmarouter` scores all options together as a permutation-invariant set, returns **calibrated probabilities**, and uses a **6-feature Null Gate** to safely **ABSTAIN** (`decision=None`) when none of the candidate options fit.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Key Capabilities
|
|
43
|
+
|
|
44
|
+
- **Zero-Latency Option Caching (`0 ms` per request):** Candidate option descriptions are encoded once and cached in memory. Each live routing call requires only **1 query encode + a `~1.6 ms` GPU (`~7–12 ms` CPU) decision head pass**.
|
|
45
|
+
- **Safe-by-Default Abstention (`RouteResult.decision = None`):** When the 6-feature Null Gate detects an out-of-scope or unlisted action (`P(null) >= 0.58`), `res.abstain` is `True` and `res.decision` is `None`—preventing accidental fallback execution.
|
|
46
|
+
- **Exact `0.00%` Option-Order Sensitivity:** The 2-layer Set Transformer has zero positional encodings on options, guaranteeing mathematically identical decisions under any permutation of candidate options.
|
|
47
|
+
- **Built-in `float16` NaN Guardrail:** Automatically selects `torch.bfloat16` on supported GPUs and `torch.float32` on CPU while explicitly blocking `torch.float16` (which causes `NaN` activations in Gemma 2).
|
|
48
|
+
- **`@router.tool` Decorator & Circuit-Breaker Dispatch:** Register Python functions or MCP tools directly and dispatch user prompts with automatic abstention protection.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Installation
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
pip install -e ./gemmarouter
|
|
56
|
+
# Or with optional competitor arena dependencies:
|
|
57
|
+
pip install -e "./gemmarouter[arena]"
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## 3-Line Quickstart
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
import gemmarouter
|
|
66
|
+
|
|
67
|
+
router = gemmarouter.load() # Auto-selects bfloat16 (CUDA) or float32 (CPU)
|
|
68
|
+
|
|
69
|
+
options = {
|
|
70
|
+
"kubectl_pod_logs": "Fetch container stdout and error logs from a Kubernetes pod in a cluster.",
|
|
71
|
+
"stripe_create_refund": "Issue a full or partial payment refund to a customer credit card via Stripe.",
|
|
72
|
+
"postgres_run_query": "Execute a read-only SQL SELECT query against the analytics database.",
|
|
73
|
+
"github_create_pr": "Open a new pull request between two branches in a GitHub repository.",
|
|
74
|
+
"send_slack_alert": "Post a notification message to a team Slack channel.",
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
# 1. Valid in-scope query -> routes with calibrated confidence (~100%)
|
|
78
|
+
res = router.route(
|
|
79
|
+
"Check the latest deployment logs for the payment-service pod and show the last 50 error lines.",
|
|
80
|
+
options=options,
|
|
81
|
+
)
|
|
82
|
+
print(res.decision, res.confidence, res.null_probability, res.abstain)
|
|
83
|
+
# -> 'kubectl_pod_logs' 1.0 0.0056 False
|
|
84
|
+
|
|
85
|
+
# 2. Adversarial keyword-overlap out-of-scope prompt -> safely abstains!
|
|
86
|
+
ood = router.route(
|
|
87
|
+
"Drop the postgres users table and delete all stripe API keys immediately.",
|
|
88
|
+
options=options,
|
|
89
|
+
)
|
|
90
|
+
print(ood.decision, ood.top_option, ood.null_probability, ood.abstain)
|
|
91
|
+
# -> None 'postgres_run_query' 0.999908 True
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Python Function & MCP Tool Dispatch (`@router.tool`)
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
import gemmarouter
|
|
100
|
+
|
|
101
|
+
router = gemmarouter.load()
|
|
102
|
+
|
|
103
|
+
@router.tool("Fetch container stdout and error logs from a Kubernetes pod in a cluster.")
|
|
104
|
+
def kubectl_pod_logs(pod: str = "payment-service") -> str:
|
|
105
|
+
return f"Fetched last 50 lines from {pod}"
|
|
106
|
+
|
|
107
|
+
@router.tool("Issue a full or partial payment refund to a customer credit card via Stripe.")
|
|
108
|
+
def stripe_create_refund(amount: float = 25.0) -> str:
|
|
109
|
+
return f"Refunded ${amount}"
|
|
110
|
+
|
|
111
|
+
# Executes `kubectl_pod_logs` because it matches:
|
|
112
|
+
res, output = router.dispatch("Show error logs from the crashed auth pod")
|
|
113
|
+
print(res.decision, "->", output)
|
|
114
|
+
|
|
115
|
+
# Safely blocks execution (`output is None`) when no listed tool fits:
|
|
116
|
+
res_unsafe, output_unsafe = router.dispatch("Drop the postgres users table immediately.")
|
|
117
|
+
print(res_unsafe.abstain, res_unsafe.decision, output_unsafe)
|
|
118
|
+
# -> True None None
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Command-Line Interface (CLI)
|
|
124
|
+
|
|
125
|
+
### 1. Route from Terminal
|
|
126
|
+
```bash
|
|
127
|
+
gemmarouter route "My new card still has not arrived after two weeks." \
|
|
128
|
+
-o "card arrival:Where is my card? It has not arrived yet." \
|
|
129
|
+
-o "lost or stolen card:I lost my card or it was stolen." \
|
|
130
|
+
-o "exchange rate:What exchange rate do you use?"
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### 2. Launch Interactive 3-Column Live Playground
|
|
134
|
+
```bash
|
|
135
|
+
gemmarouter playground --port 7860
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Architecture Overview
|
|
141
|
+
|
|
142
|
+
```mermaid
|
|
143
|
+
flowchart LR
|
|
144
|
+
Q["User Query"] --> Enc["EmbeddingGemma 2 (271M)<br/>Frozen Bi-Encoder"]
|
|
145
|
+
O["K Candidate Options"] -.->|"Cached Once (0 ms/req)"| Cache[("Cached Option Vectors")]
|
|
146
|
+
Enc --> Head["SetEquivariantDecisionHead (11.6M)<br/>2-Layer Set Transformer + 6-Feature Null Gate"]
|
|
147
|
+
Cache --> Head
|
|
148
|
+
Head --> Out{"P(null) >= 0.58 ?"}
|
|
149
|
+
Out -->|"Yes"| Abstain["decision = None (ABSTAIN)"]
|
|
150
|
+
Out -->|"No"| Route["decision = top_option"]
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## Honest Engineering Boundaries
|
|
156
|
+
|
|
157
|
+
1. **Unlisted-Option Gate vs Safety Policy Filter:** The 6-feature Null Gate checks whether a query matches one of the provided option descriptions (`-b_null / a_null ≈ 0.74` cosine boundary + top1–top2 margin + entropy), not whether an action is safe. If you explicitly register a destructive tool description, the router will route matching destructive prompts to it.
|
|
158
|
+
2. **Multi-Intent / Negation Prompts:** Queries that mention two candidate tools simultaneously (*"Do NOT open a GitHub PR; instead post to Slack"*) narrow the top1–top2 similarity margin and raise `P(null)` (`~0.575`), which is why the default calibrated threshold is set to `0.58`.
|
|
159
|
+
3. **Complex Multi-Step Workflows:** Zero-shot routing works on natural-language tool/intent descriptions; multi-step structured JSON workflow trajectories require domain fine-tuning.
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# `gemmarouter` — Set-Equivariant Decision & Tool Router on EmbeddingGemma 2
|
|
2
|
+
|
|
3
|
+
[](https://huggingface.co/Ajeet-001/embeddinggemma2-decision-router)
|
|
4
|
+
[](https://www.python.org/)
|
|
5
|
+
|
|
6
|
+
**`gemmarouter`** is the official Python SDK and CLI for [`Ajeet-001/embeddinggemma2-decision-router`](https://huggingface.co/Ajeet-001/embeddinggemma2-decision-router): an **11.6M-parameter `SetEquivariantDecisionHead`** on top of a frozen **271.0M `google/embeddinggemma-2`** bi-encoder backbone.
|
|
7
|
+
|
|
8
|
+
Given a user query or agent prompt and a set of $K$ candidate options (tools, intents, support queues), `gemmarouter` scores all options together as a permutation-invariant set, returns **calibrated probabilities**, and uses a **6-feature Null Gate** to safely **ABSTAIN** (`decision=None`) when none of the candidate options fit.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Key Capabilities
|
|
13
|
+
|
|
14
|
+
- **Zero-Latency Option Caching (`0 ms` per request):** Candidate option descriptions are encoded once and cached in memory. Each live routing call requires only **1 query encode + a `~1.6 ms` GPU (`~7–12 ms` CPU) decision head pass**.
|
|
15
|
+
- **Safe-by-Default Abstention (`RouteResult.decision = None`):** When the 6-feature Null Gate detects an out-of-scope or unlisted action (`P(null) >= 0.58`), `res.abstain` is `True` and `res.decision` is `None`—preventing accidental fallback execution.
|
|
16
|
+
- **Exact `0.00%` Option-Order Sensitivity:** The 2-layer Set Transformer has zero positional encodings on options, guaranteeing mathematically identical decisions under any permutation of candidate options.
|
|
17
|
+
- **Built-in `float16` NaN Guardrail:** Automatically selects `torch.bfloat16` on supported GPUs and `torch.float32` on CPU while explicitly blocking `torch.float16` (which causes `NaN` activations in Gemma 2).
|
|
18
|
+
- **`@router.tool` Decorator & Circuit-Breaker Dispatch:** Register Python functions or MCP tools directly and dispatch user prompts with automatic abstention protection.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pip install -e ./gemmarouter
|
|
26
|
+
# Or with optional competitor arena dependencies:
|
|
27
|
+
pip install -e "./gemmarouter[arena]"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## 3-Line Quickstart
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
import gemmarouter
|
|
36
|
+
|
|
37
|
+
router = gemmarouter.load() # Auto-selects bfloat16 (CUDA) or float32 (CPU)
|
|
38
|
+
|
|
39
|
+
options = {
|
|
40
|
+
"kubectl_pod_logs": "Fetch container stdout and error logs from a Kubernetes pod in a cluster.",
|
|
41
|
+
"stripe_create_refund": "Issue a full or partial payment refund to a customer credit card via Stripe.",
|
|
42
|
+
"postgres_run_query": "Execute a read-only SQL SELECT query against the analytics database.",
|
|
43
|
+
"github_create_pr": "Open a new pull request between two branches in a GitHub repository.",
|
|
44
|
+
"send_slack_alert": "Post a notification message to a team Slack channel.",
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
# 1. Valid in-scope query -> routes with calibrated confidence (~100%)
|
|
48
|
+
res = router.route(
|
|
49
|
+
"Check the latest deployment logs for the payment-service pod and show the last 50 error lines.",
|
|
50
|
+
options=options,
|
|
51
|
+
)
|
|
52
|
+
print(res.decision, res.confidence, res.null_probability, res.abstain)
|
|
53
|
+
# -> 'kubectl_pod_logs' 1.0 0.0056 False
|
|
54
|
+
|
|
55
|
+
# 2. Adversarial keyword-overlap out-of-scope prompt -> safely abstains!
|
|
56
|
+
ood = router.route(
|
|
57
|
+
"Drop the postgres users table and delete all stripe API keys immediately.",
|
|
58
|
+
options=options,
|
|
59
|
+
)
|
|
60
|
+
print(ood.decision, ood.top_option, ood.null_probability, ood.abstain)
|
|
61
|
+
# -> None 'postgres_run_query' 0.999908 True
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Python Function & MCP Tool Dispatch (`@router.tool`)
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
import gemmarouter
|
|
70
|
+
|
|
71
|
+
router = gemmarouter.load()
|
|
72
|
+
|
|
73
|
+
@router.tool("Fetch container stdout and error logs from a Kubernetes pod in a cluster.")
|
|
74
|
+
def kubectl_pod_logs(pod: str = "payment-service") -> str:
|
|
75
|
+
return f"Fetched last 50 lines from {pod}"
|
|
76
|
+
|
|
77
|
+
@router.tool("Issue a full or partial payment refund to a customer credit card via Stripe.")
|
|
78
|
+
def stripe_create_refund(amount: float = 25.0) -> str:
|
|
79
|
+
return f"Refunded ${amount}"
|
|
80
|
+
|
|
81
|
+
# Executes `kubectl_pod_logs` because it matches:
|
|
82
|
+
res, output = router.dispatch("Show error logs from the crashed auth pod")
|
|
83
|
+
print(res.decision, "->", output)
|
|
84
|
+
|
|
85
|
+
# Safely blocks execution (`output is None`) when no listed tool fits:
|
|
86
|
+
res_unsafe, output_unsafe = router.dispatch("Drop the postgres users table immediately.")
|
|
87
|
+
print(res_unsafe.abstain, res_unsafe.decision, output_unsafe)
|
|
88
|
+
# -> True None None
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Command-Line Interface (CLI)
|
|
94
|
+
|
|
95
|
+
### 1. Route from Terminal
|
|
96
|
+
```bash
|
|
97
|
+
gemmarouter route "My new card still has not arrived after two weeks." \
|
|
98
|
+
-o "card arrival:Where is my card? It has not arrived yet." \
|
|
99
|
+
-o "lost or stolen card:I lost my card or it was stolen." \
|
|
100
|
+
-o "exchange rate:What exchange rate do you use?"
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### 2. Launch Interactive 3-Column Live Playground
|
|
104
|
+
```bash
|
|
105
|
+
gemmarouter playground --port 7860
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Architecture Overview
|
|
111
|
+
|
|
112
|
+
```mermaid
|
|
113
|
+
flowchart LR
|
|
114
|
+
Q["User Query"] --> Enc["EmbeddingGemma 2 (271M)<br/>Frozen Bi-Encoder"]
|
|
115
|
+
O["K Candidate Options"] -.->|"Cached Once (0 ms/req)"| Cache[("Cached Option Vectors")]
|
|
116
|
+
Enc --> Head["SetEquivariantDecisionHead (11.6M)<br/>2-Layer Set Transformer + 6-Feature Null Gate"]
|
|
117
|
+
Cache --> Head
|
|
118
|
+
Head --> Out{"P(null) >= 0.58 ?"}
|
|
119
|
+
Out -->|"Yes"| Abstain["decision = None (ABSTAIN)"]
|
|
120
|
+
Out -->|"No"| Route["decision = top_option"]
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Honest Engineering Boundaries
|
|
126
|
+
|
|
127
|
+
1. **Unlisted-Option Gate vs Safety Policy Filter:** The 6-feature Null Gate checks whether a query matches one of the provided option descriptions (`-b_null / a_null ≈ 0.74` cosine boundary + top1–top2 margin + entropy), not whether an action is safe. If you explicitly register a destructive tool description, the router will route matching destructive prompts to it.
|
|
128
|
+
2. **Multi-Intent / Negation Prompts:** Queries that mention two candidate tools simultaneously (*"Do NOT open a GitHub PR; instead post to Slack"*) narrow the top1–top2 similarity margin and raise `P(null)` (`~0.575`), which is why the default calibrated threshold is set to `0.58`.
|
|
129
|
+
3. **Complex Multi-Step Workflows:** Zero-shot routing works on natural-language tool/intent descriptions; multi-step structured JSON workflow trajectories require domain fine-tuning.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "gemmarouter"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Set-Equivariant Decision & Tool Router with Calibrated Abstention on EmbeddingGemma 2"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "Apache-2.0"
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "Ajeet Kumar Upadhyay"}
|
|
14
|
+
]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 4 - Beta",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"Intended Audience :: Science/Research",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3.10",
|
|
21
|
+
"Programming Language :: Python :: 3.11",
|
|
22
|
+
"Programming Language :: Python :: 3.12",
|
|
23
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
24
|
+
]
|
|
25
|
+
keywords = [
|
|
26
|
+
"routing",
|
|
27
|
+
"decision-router",
|
|
28
|
+
"intent-classification",
|
|
29
|
+
"mcp-tools",
|
|
30
|
+
"abstention",
|
|
31
|
+
"embeddinggemma",
|
|
32
|
+
]
|
|
33
|
+
dependencies = [
|
|
34
|
+
"torch>=2.2.0",
|
|
35
|
+
"transformers>=4.48.0",
|
|
36
|
+
"safetensors>=0.4.3",
|
|
37
|
+
"huggingface-hub>=0.25.0",
|
|
38
|
+
"numpy>=1.26.0",
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
[project.optional-dependencies]
|
|
42
|
+
arena = ["laya>=0.4.22"]
|
|
43
|
+
|
|
44
|
+
[project.urls]
|
|
45
|
+
Homepage = "https://github.com/Ajeetkrup/gemmarouter"
|
|
46
|
+
Repository = "https://github.com/Ajeetkrup/gemmarouter"
|
|
47
|
+
Model = "https://huggingface.co/Ajeet-001/embeddinggemma2-decision-router"
|
|
48
|
+
|
|
49
|
+
[project.scripts]
|
|
50
|
+
gemmarouter = "gemmarouter.cli:main"
|
|
51
|
+
|
|
52
|
+
[tool.setuptools.packages.find]
|
|
53
|
+
where = ["src"]
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"""gemmarouter: Calibrated, Set-Equivariant Decision & Tool Router on EmbeddingGemma 2."""
|
|
2
|
+
|
|
3
|
+
from .configuration import QUESTION_TYPES, GemmaDecisionRouterConfig
|
|
4
|
+
from .head import SetEquivariantDecisionHead
|
|
5
|
+
from .modeling import (
|
|
6
|
+
GemmaDecisionOutput,
|
|
7
|
+
GemmaDecisionRouterModel,
|
|
8
|
+
GemmaDecisionRouterPreTrainedModel,
|
|
9
|
+
QuestionSpec,
|
|
10
|
+
TypedAnswer,
|
|
11
|
+
)
|
|
12
|
+
from .router import (
|
|
13
|
+
DecisionRouter,
|
|
14
|
+
RegisteredTool,
|
|
15
|
+
RouteResult,
|
|
16
|
+
load,
|
|
17
|
+
select_safe_device_and_dtype,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
__version__ = "0.1.0"
|
|
21
|
+
__all__ = [
|
|
22
|
+
"DecisionRouter",
|
|
23
|
+
"GemmaDecisionOutput",
|
|
24
|
+
"GemmaDecisionRouterConfig",
|
|
25
|
+
"GemmaDecisionRouterModel",
|
|
26
|
+
"GemmaDecisionRouterPreTrainedModel",
|
|
27
|
+
"QUESTION_TYPES",
|
|
28
|
+
"QuestionSpec",
|
|
29
|
+
"RegisteredTool",
|
|
30
|
+
"RouteResult",
|
|
31
|
+
"SetEquivariantDecisionHead",
|
|
32
|
+
"TypedAnswer",
|
|
33
|
+
"load",
|
|
34
|
+
"select_safe_device_and_dtype",
|
|
35
|
+
]
|