warn users when maxTokens too close to contextLength
This commit is contained in:
parent
f534820b66
commit
b614c43f8d
1 changed files with 12 additions and 0 deletions
|
|
@ -34,6 +34,18 @@ export function validateConfig(config: SerializedContinueConfig) {
|
|||
message: `Model at index ${index} has an invalid 'provider'.`,
|
||||
});
|
||||
}
|
||||
|
||||
if (model.contextLength && model.completionOptions?.maxTokens) {
|
||||
const difference =
|
||||
model.contextLength - model.completionOptions.maxTokens;
|
||||
|
||||
if (difference < 1000) {
|
||||
errors.push({
|
||||
fatal: false,
|
||||
message: `Model "${model.title}" has a contextLength of ${model.contextLength} and a maxTokens of ${model.completionOptions.maxTokens}. This leaves only ${difference} tokens for input context and will likely result in your inputs being truncated.`,
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue