mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-14 09:03:16 +00:00
fix: satisfy activity lint budgets and refresh lazy API schema
This commit is contained in:
parent
ee9ef4f621
commit
6abcf03edc
3 changed files with 159 additions and 5 deletions
|
|
@ -3740,6 +3740,38 @@
|
|||
"title": "AgentSkill",
|
||||
"type": "object"
|
||||
},
|
||||
"BoundedDailyActivityResponse": {
|
||||
"properties": {
|
||||
"metadata": {
|
||||
"$ref": "#/components/schemas/DailySpendMetadata"
|
||||
},
|
||||
"model_breakdown": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/DailyActivityModelBreakdown"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"description": "When requested, includes the highest-spend models across the full date range and an explicit aggregate of all remaining models. Daily totals always cover the complete activity scope. Other per-day dimension breakdowns are omitted."
|
||||
},
|
||||
"results": {
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/DailySpendData"
|
||||
},
|
||||
"maxItems": 366,
|
||||
"title": "Results",
|
||||
"type": "array"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"results",
|
||||
"metadata"
|
||||
],
|
||||
"title": "BoundedDailyActivityResponse",
|
||||
"type": "object"
|
||||
},
|
||||
"BreakdownMetrics": {
|
||||
"description": "Breakdown of spend by different dimensions",
|
||||
"properties": {
|
||||
|
|
@ -3851,6 +3883,82 @@
|
|||
"title": "DailyActivityKeySearchResponse",
|
||||
"type": "object"
|
||||
},
|
||||
"DailyActivityModelBreakdown": {
|
||||
"properties": {
|
||||
"limit": {
|
||||
"maximum": 100.0,
|
||||
"minimum": 1.0,
|
||||
"title": "Limit",
|
||||
"type": "integer"
|
||||
},
|
||||
"models": {
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/DailyActivityModelContribution"
|
||||
},
|
||||
"maxItems": 100,
|
||||
"title": "Models",
|
||||
"type": "array"
|
||||
},
|
||||
"other": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/DailyActivityOtherModels"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"total_models": {
|
||||
"minimum": 0.0,
|
||||
"title": "Total Models",
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"limit",
|
||||
"total_models",
|
||||
"models"
|
||||
],
|
||||
"title": "DailyActivityModelBreakdown",
|
||||
"type": "object"
|
||||
},
|
||||
"DailyActivityModelContribution": {
|
||||
"properties": {
|
||||
"metrics": {
|
||||
"$ref": "#/components/schemas/SpendMetrics"
|
||||
},
|
||||
"model": {
|
||||
"maxLength": 1024,
|
||||
"title": "Model",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"model",
|
||||
"metrics"
|
||||
],
|
||||
"title": "DailyActivityModelContribution",
|
||||
"type": "object"
|
||||
},
|
||||
"DailyActivityOtherModels": {
|
||||
"properties": {
|
||||
"metrics": {
|
||||
"$ref": "#/components/schemas/SpendMetrics"
|
||||
},
|
||||
"model_count": {
|
||||
"minimum": 1.0,
|
||||
"title": "Model Count",
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"model_count",
|
||||
"metrics"
|
||||
],
|
||||
"title": "DailyActivityOtherModels",
|
||||
"type": "object"
|
||||
},
|
||||
"DailySpendData": {
|
||||
"properties": {
|
||||
"breakdown": {
|
||||
|
|
@ -5125,6 +5233,38 @@
|
|||
"type": "integer"
|
||||
}
|
||||
},
|
||||
{
|
||||
"in": "query",
|
||||
"name": "bounded",
|
||||
"required": false,
|
||||
"schema": {
|
||||
"default": false,
|
||||
"title": "Bounded",
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
{
|
||||
"in": "query",
|
||||
"name": "include_model_breakdown",
|
||||
"required": false,
|
||||
"schema": {
|
||||
"default": false,
|
||||
"title": "Include Model Breakdown",
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
{
|
||||
"in": "query",
|
||||
"name": "model_limit",
|
||||
"required": false,
|
||||
"schema": {
|
||||
"default": 20,
|
||||
"maximum": 100,
|
||||
"minimum": 1,
|
||||
"title": "Model Limit",
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
{
|
||||
"in": "query",
|
||||
"name": "agent_ids",
|
||||
|
|
@ -5243,7 +5383,15 @@
|
|||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/SpendAnalyticsPaginatedResponse"
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/components/schemas/SpendAnalyticsPaginatedResponse"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/schemas/BoundedDailyActivityResponse"
|
||||
}
|
||||
],
|
||||
"title": "Response Get Agent Daily Activity Aggregated Agent Daily Activity Aggregated Get"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -88,7 +88,11 @@ class BoundedAnalyticsDatabase:
|
|||
if _PostgresError.model_validate(error.meta or {}).code not in ("57014", "55P03"):
|
||||
raise
|
||||
raise AnalyticsCapacityError("Analytics exceeded its query budget. Try again shortly") from error
|
||||
except (TransactionExpiredError, TransactionNotStartedError, asyncio.TimeoutError) as error:
|
||||
except (
|
||||
TransactionExpiredError,
|
||||
TransactionNotStartedError,
|
||||
asyncio.TimeoutError, # pyright: ignore[reportDeprecated] # Python 3.10 uses a distinct asyncio timeout class
|
||||
) as error:
|
||||
raise AnalyticsCapacityError("Analytics exceeded its connection budget. Try again shortly") from error
|
||||
finally:
|
||||
self._admission.release()
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ const ModelTopKeys = ({
|
|||
fetchTopApiKeys(modelName)
|
||||
.then((response) => {
|
||||
if (cancelled) return;
|
||||
setSettled({
|
||||
const nextState = {
|
||||
modelName,
|
||||
fetchTopApiKeys,
|
||||
rows: response.api_keys.map((row) => ({
|
||||
|
|
@ -168,12 +168,14 @@ const ModelTopKeys = ({
|
|||
tokens: row.metrics.total_tokens,
|
||||
})),
|
||||
failed: false,
|
||||
});
|
||||
};
|
||||
setSettled(nextState);
|
||||
})
|
||||
.catch((error) => {
|
||||
if (cancelled) return;
|
||||
console.error(`Failed to fetch top keys for ${modelName}:`, error);
|
||||
setSettled({ modelName, fetchTopApiKeys, rows: [], failed: true });
|
||||
const failedState = { modelName, fetchTopApiKeys, rows: [], failed: true };
|
||||
setSettled(failedState);
|
||||
});
|
||||
return () => {
|
||||
cancelled = true;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue