Spaces:
Running
Running
farooquiowais commited on
Commit ·
2be6e7d
1
Parent(s): 64a3efa
feat: raise default max_tokens fallback from 4096 to 16384
Browse filesOpenAI-compatible (/v1/chat/completions) and Anthropic-compatible
(/v1/messages) endpoints now default to 16384 output tokens when the
client omits max_tokens. This matches the existing Gemini hard cap and
mitigates truncation for streaming clients (e.g. Mike tabular batch
extraction) until they send explicit per-request budgets.
- src/format/openai-compat.js +1 -1
- src/server.js +1 -1
src/format/openai-compat.js
CHANGED
|
@@ -390,7 +390,7 @@ export function convertOpenAIRequestToAnthropic(openAIRequest, configuredMapping
|
|
| 390 |
const model = resolveModelAlias(openAIRequest.model, configuredMappings);
|
| 391 |
const maxTokens = openAIRequest.max_completion_tokens
|
| 392 |
?? openAIRequest.max_tokens
|
| 393 |
-
??
|
| 394 |
|
| 395 |
if (!Number.isInteger(maxTokens) || maxTokens <= 0) {
|
| 396 |
throw new OpenAICompatError('max_tokens must be a positive integer', {
|
|
|
|
| 390 |
const model = resolveModelAlias(openAIRequest.model, configuredMappings);
|
| 391 |
const maxTokens = openAIRequest.max_completion_tokens
|
| 392 |
?? openAIRequest.max_tokens
|
| 393 |
+
?? 16384;
|
| 394 |
|
| 395 |
if (!Number.isInteger(maxTokens) || maxTokens <= 0) {
|
| 396 |
throw new OpenAICompatError('max_tokens must be a positive integer', {
|
src/server.js
CHANGED
|
@@ -773,7 +773,7 @@ app.post('/v1/messages', async (req, res) => {
|
|
| 773 |
const request = {
|
| 774 |
model: modelId,
|
| 775 |
messages,
|
| 776 |
-
max_tokens: max_tokens ||
|
| 777 |
stream,
|
| 778 |
system,
|
| 779 |
tools,
|
|
|
|
| 773 |
const request = {
|
| 774 |
model: modelId,
|
| 775 |
messages,
|
| 776 |
+
max_tokens: max_tokens || 16384,
|
| 777 |
stream,
|
| 778 |
system,
|
| 779 |
tools,
|