minor gultra fix

This commit is contained in:
nai-degen 2024-08-06 18:46:49 -05:00
parent 9ab1e7d0ce
commit 6c9f302fb9
2 changed files with 7 additions and 5 deletions

View File

@ -81,7 +81,7 @@ export const validateContextSize: RequestPreprocessor = async (req) => {
modelMax = 200000; modelMax = 200000;
} else if (model.match(/^claude-3/)) { } else if (model.match(/^claude-3/)) {
modelMax = 200000; modelMax = 200000;
} else if (model.match(/^gemini-$/)) { } else if (model.match(/^gemini-/)) {
modelMax = 1024000; modelMax = 1024000;
} else if (model.match(/^anthropic\.claude-3/)) { } else if (model.match(/^anthropic\.claude-3/)) {
modelMax = 200000; modelMax = 200000;

View File

@ -103,13 +103,15 @@ export class GoogleAIKeyProvider implements KeyProvider<GoogleAIKey> {
return this.keys.map((k) => Object.freeze({ ...k, key: undefined })); return this.keys.map((k) => Object.freeze({ ...k, key: undefined }));
} }
public get(_model: string) { public get(model: string) {
const availableKeys = this.keys.filter((k) => !k.isDisabled); const neededFamily = getGoogleAIModelFamily(model);
const availableKeys = this.keys.filter(
(k) => !k.isDisabled && k.modelFamilies.includes(neededFamily)
);
if (availableKeys.length === 0) { if (availableKeys.length === 0) {
throw new PaymentRequiredError("No Google AI keys available"); throw new PaymentRequiredError("No Google AI keys available");
} }
// (largely copied from the OpenAI provider, without trial key support)
// Select a key, from highest priority to lowest priority: // Select a key, from highest priority to lowest priority:
// 1. Keys which are not rate limited // 1. Keys which are not rate limited
// a. If all keys were rate limited recently, select the least-recently // a. If all keys were rate limited recently, select the least-recently