minor gultra fix
This commit is contained in:
parent
9ab1e7d0ce
commit
6c9f302fb9
|
@ -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;
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { getGoogleAIModelFamily, type GoogleAIModelFamily } from "../../models";
|
||||||
import { PaymentRequiredError } from "../../errors";
|
import { PaymentRequiredError } from "../../errors";
|
||||||
import { GoogleAIKeyChecker } from "./checker";
|
import { GoogleAIKeyChecker } from "./checker";
|
||||||
|
|
||||||
// Note that Google AI is not the same as Vertex AI, both are provided by
|
// Note that Google AI is not the same as Vertex AI, both are provided by
|
||||||
// Google but Vertex is the GCP product for enterprise, while Google API is a
|
// Google but Vertex is the GCP product for enterprise, while Google API is a
|
||||||
// development/hobbyist product. They use completely different APIs and keys.
|
// development/hobbyist product. They use completely different APIs and keys.
|
||||||
// https://ai.google.dev/docs/migrate_to_cloud
|
// https://ai.google.dev/docs/migrate_to_cloud
|
||||||
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue