Commit 446a24a
authored
support glm-5-2 on opencode (#186)
* Broaden OSS model bucket to catch all non-claude/gpt/gemini families
discover_model_services bucketed OSS models with an allowlist ("kimi-"
only), so GLM/Llama/Qwen/DeepSeek and any future OSS family were
discovered from UC model-services but dropped on the floor — never
reaching opencode_models, so they couldn't be listed or selected in
OpenCode (e.g. system.ai.glm-5-2).
Bucket OSS by exclusion instead: anything not claude/gpt/gemini, minus
non-chat model services (embeddings, rerankers) that can't back a chat
agent. New OSS families now surface without a code change.
Co-authored-by: Isaac
* Bound GLM token limits (200k context / 25k output) for OSS-serving agents
The Databricks gateway caps GLM's max output (completion) tokens and
rejects requests above it. These limits are a property of the model +
its /ai-gateway/mlflow/v1 route, not of any one agent, so expose them as
a single model_token_limits() helper (family->limits table) in
databricks.py. Each agent translates the limits into its own config
dialect.
OpenCode's per-model schema is strict (`additionalProperties: false`)
and its `limit` object requires BOTH context and output — supplying only
output made the whole opencode.json invalid ("Configuration is
invalid"). The table now always provides both fields, so OpenCode pins
`limit: {context, output}` and clamps `max_tokens` to a gateway-accepted
value. Adding a model/limit is a one-line edit shared across
opencode/pi/copilot.
Co-authored-by: Isaac
* Restrict OSS model bucket to kimi and glm allowlist
The previous catch-all bucketed any non-claude/gpt/gemini model (llama,
qwen, deepseek, ...) into OSS, offering families we haven't validated.
Go back to an explicit allowlist, but include both kimi and glm.
_OSS_MODEL_FAMILIES = ("kimi-", "glm-") replaces the exclusion logic and
its non-chat marker filter (embeddings/rerankers never match the
allowlist, so no filtering is needed).
Co-authored-by: Isaac
* Revert test_no_matching_families_reports_sample to llama sample
Under the kimi/glm allowlist, llama-4-maverick again matches no family,
so the original test (asserting it's reported in the "no families" reason)
holds without the embedding-service substitute.
Co-authored-by: Isaac
* Trim verbose comments on OSS allowlist
Co-authored-by: Isaac1 parent a0a0d1c commit 446a24a
4 files changed
Lines changed: 103 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
72 | 87 | | |
73 | 88 | | |
74 | 89 | | |
| |||
130 | 145 | | |
131 | 146 | | |
132 | 147 | | |
133 | | - | |
| 148 | + | |
134 | 149 | | |
135 | 150 | | |
136 | 151 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1096 | 1096 | | |
1097 | 1097 | | |
1098 | 1098 | | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
1099 | 1127 | | |
1100 | 1128 | | |
1101 | 1129 | | |
| |||
1223 | 1251 | | |
1224 | 1252 | | |
1225 | 1253 | | |
1226 | | - | |
| 1254 | + | |
| 1255 | + | |
1227 | 1256 | | |
1228 | 1257 | | |
1229 | 1258 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
96 | 111 | | |
97 | 112 | | |
98 | 113 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
143 | 160 | | |
144 | 161 | | |
145 | 162 | | |
| |||
151 | 168 | | |
152 | 169 | | |
153 | 170 | | |
| 171 | + | |
154 | 172 | | |
155 | 173 | | |
156 | 174 | | |
| |||
169 | 187 | | |
170 | 188 | | |
171 | 189 | | |
172 | | - | |
173 | | - | |
174 | | - | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
175 | 214 | | |
176 | 215 | | |
177 | 216 | | |
| |||
0 commit comments