schemacast.cli¶
Command line: schemacast.
Attributes¶
EX_TEMPFAIL = 75
module-attribute
¶
Classes¶
Functions:¶
cast(schema_path, episodes_path, out_dir, db_path, replay, recreate_schema, concurrency)
¶
Cast EPISODES into SCHEMA and save the result under OUT.
Each text becomes a mention graph; what its keys identify is the graph, the rest is staged. With --db, keys are looked up there too; a manifest's connector-owned types are linked, never created.
Episodes that produce nothing are quarantined and the run goes on; a misconfigured or unreachable model, or a cache miss under --replay, stops it.
Exit status: 0 when every episode was cast or failed on its own content (too long, refused, truncated, unparseable), which a rerun reproduces; 75 when some failed at the provider, which a rerun retries; 1 when the run stopped or every episode failed.
Source code in schemacast/cli.py
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 | |
cast_summary(result, out_dir, *, cache_enabled)
¶
The lines cast prints and its exit status.
A provider_error is never cached, so a rerun retries it; every other
failure is replayed from the cache, so a rerun reproduces it.
Source code in schemacast/cli.py
main()
¶
pick(input_path, out_dir, replay, concurrency)
¶
Link staged mentions to their candidates: one model call per episode.
Each staged mention gets one of its candidates or none, checked without a model. A pick links; it writes nothing.
Exit status: 0 when every call answered; 75 when some failed at the provider, which a rerun retries; 1 when the run stopped or every call failed.
Source code in schemacast/cli.py
read_pick_items(path)
¶
Pick input: one JSON object per line, each a PickItem.
Raises:
| Type | Description |
|---|---|
ClickException
|
a line that is not a pick item. |
Source code in schemacast/cli.py
select_command(schema_path, text, episodes_path, show_sheet)
¶
Show the slice of SCHEMA each text would be cast against. Makes no model call.
Prints one JSON line per text: the mode, the seeds and how each lane ranked them, the retrieval metrics and the slice's vertex and edge counts.
Source code in schemacast/cli.py
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | |
serve(host, port)
¶
Serve POST /cast and POST /pick over HTTP (needs the server extra).
Every request needs Authorization: Bearer $SCHEMACAST_SERVE_API_KEY; without
a key the service refuses to cast unless SCHEMACAST_SERVE_ALLOW_ANONYMOUS is
set. Model settings come from SCHEMACAST_LLM_*.
Source code in schemacast/cli.py
sheet(schema_path, as_json_schema)
¶
Print what a model is shown for SCHEMA. Makes no model call.