models: Anthropic-Grenzen aus max_input_tokens/max_tokens lesen
Die Anthropic-Modellliste nennt 1M Kontext und 128k Ausgabe nicht im OpenAI-"limit"-Objekt, sondern als max_input_tokens und max_tokens. Ohne diese Felder fiel die Ausgabegrenze auf die Endpunktzahl zurück und stand in /v1/models falsch da.
This commit is contained in:
1 parent
883f111756
commit
20e0a08f2b
1 file changed
+10
@@ -122,6 +122,16 @@ int j_models_parse(j_endpoint *ep, const char *json, size_t len)
|
||||
const char *ok = find_in(lim, oend, "\"output\"");
|
||||
if (ok) out = long_after(find_in(ok, oend, ":"), oend);
|
||||
}
|
||||
/* Anthropic's model list names the same limits without the
|
||||
* OpenAI "limit" wrapper: max_input_tokens and max_tokens. */
|
||||
if (ctx == 0) {
|
||||
const char *ck = find_in(obj, oend, "\"max_input_tokens\"");
|
||||
if (ck) ctx = long_after(find_in(ck, oend, ":"), oend);
|
||||
}
|
||||
if (out == 0) {
|
||||
const char *ok = find_in(obj, oend, "\"max_tokens\"");
|
||||
if (ok) out = long_after(find_in(ok, oend, ":"), oend);
|
||||
}
|
||||
if (n == cap) {
|
||||
int ncap = cap ? cap * 2 : 16;
|
||||
j_model_meta *grown = realloc(arr, (size_t)ncap * sizeof *arr);
|
||||
|
||||
Reference in new issue
Block a user