fixes info page display for gemini flash/ultra
This commit is contained in:
parent
2f7315379c
commit
29ed07492e
|
@ -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-\d{3}$/)) {
|
} 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;
|
||||||
|
|
|
@ -143,8 +143,6 @@ export function sendErrorToClient({
|
||||||
res.setHeader("x-oai-proxy-error-status", redactedOpts.statusCode || 500);
|
res.setHeader("x-oai-proxy-error-status", redactedOpts.statusCode || 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
req.log.info({ statusCode: res.statusCode, isStreaming, format, redactedOpts, event }, "Sending error response");
|
|
||||||
|
|
||||||
if (isStreaming) {
|
if (isStreaming) {
|
||||||
if (!res.headersSent) {
|
if (!res.headersSent) {
|
||||||
initializeSseStream(res);
|
initializeSseStream(res);
|
||||||
|
@ -222,19 +220,16 @@ export function buildSpoofedCompletion({
|
||||||
stop_sequence: null,
|
stop_sequence: null,
|
||||||
};
|
};
|
||||||
case "google-ai":
|
case "google-ai":
|
||||||
// TODO: Native Google AI non-streaming responses are not supported, this
|
|
||||||
// is an untested guess at what the response should look like.
|
|
||||||
return {
|
return {
|
||||||
candidates: [
|
candidates: [
|
||||||
{
|
{
|
||||||
content: { parts: [{ text: content }], role: "assistant" },
|
content: { parts: [{ text: content }], role: "model" },
|
||||||
finishReason: title,
|
finishReason: title,
|
||||||
index: 0,
|
index: 0,
|
||||||
tokenCount: null,
|
tokenCount: null,
|
||||||
safetyRatings: [],
|
safetyRatings: [],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
usage: { prompt_tokens: 0, completion_tokens: 0, total_tokens: 0 },
|
|
||||||
};
|
};
|
||||||
case "openai-image":
|
case "openai-image":
|
||||||
return obj;
|
return obj;
|
||||||
|
|
|
@ -363,12 +363,14 @@ function addKeyToAggregates(k: KeyPoolKey) {
|
||||||
}
|
}
|
||||||
case "google-ai": {
|
case "google-ai": {
|
||||||
if (!keyIsGoogleAIKey(k)) throw new Error("Invalid key type");
|
if (!keyIsGoogleAIKey(k)) throw new Error("Invalid key type");
|
||||||
const family = "gemini-pro";
|
k.modelFamilies.forEach((family) => {
|
||||||
sumTokens += k["gemini-proTokens"];
|
const tokens = k[`${family}Tokens`];
|
||||||
sumCost += getTokenCostUsd(family, k["gemini-proTokens"]);
|
sumTokens += tokens;
|
||||||
increment(modelStats, `${family}__active`, k.isDisabled ? 0 : 1);
|
sumCost += getTokenCostUsd(family, tokens);
|
||||||
increment(modelStats, `${family}__revoked`, k.isRevoked ? 1 : 0);
|
increment(modelStats, `${family}__tokens`, tokens);
|
||||||
increment(modelStats, `${family}__tokens`, k["gemini-proTokens"]);
|
increment(modelStats, `${family}__active`, k.isDisabled ? 0 : 1);
|
||||||
|
increment(modelStats, `${family}__revoked`, k.isRevoked ? 1 : 0);
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "mistral-ai": {
|
case "mistral-ai": {
|
||||||
|
|
Loading…
Reference in New Issue