mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-10 22:41:41 +00:00
fix(vertex-ai): classify Lyria model metadata
This commit is contained in:
parent
e9e2fbb438
commit
bd5123564c
4 changed files with 56 additions and 3 deletions
|
|
@ -58,6 +58,11 @@ OBJECT_KEYS: dict[str, JsonSchema] = {
|
|||
}
|
||||
|
||||
ARRAY_KEYS: dict[str, JsonSchema] = {
|
||||
"supported_audio_formats": {
|
||||
"type": "array",
|
||||
"description": "Audio container formats the model can return.",
|
||||
"items": {"type": "string", "enum": ["mp3", "wav"]},
|
||||
},
|
||||
"supported_endpoints": {
|
||||
"type": "array",
|
||||
"description": "OpenAI-style API routes this model can be called through, e.g. /v1/chat/completions.",
|
||||
|
|
@ -116,6 +121,10 @@ ARRAY_KEYS: dict[str, JsonSchema] = {
|
|||
}
|
||||
|
||||
INTEGER_KEYS: dict[str, JsonSchema] = {
|
||||
"max_audio_per_prompt": {
|
||||
**NONNEG_INTEGER,
|
||||
"description": "Maximum number of audio outputs accepted or generated per prompt.",
|
||||
},
|
||||
"max_tokens": {
|
||||
**NONNEG_INTEGER,
|
||||
"description": "Legacy field: max output tokens if the provider specifies it, else max input tokens.",
|
||||
|
|
@ -141,6 +150,14 @@ INTEGER_KEYS: dict[str, JsonSchema] = {
|
|||
}
|
||||
|
||||
NUMBER_KEYS: dict[str, JsonSchema] = {
|
||||
"audio_seconds_per_prediction": {
|
||||
**NONNEG_NUMBER,
|
||||
"description": "Audio duration, in seconds, produced by one prediction.",
|
||||
},
|
||||
"max_audio_length_hours": {
|
||||
**NONNEG_NUMBER,
|
||||
"description": "Maximum generated audio duration, expressed in hours.",
|
||||
},
|
||||
"regional_processing_uplift_multiplier_eu": {
|
||||
"type": "number",
|
||||
"minimum": 1,
|
||||
|
|
@ -231,6 +248,10 @@ def string_key_schemas(modes: tuple) -> dict[str, JsonSchema]:
|
|||
},
|
||||
"comment": STRING,
|
||||
"audio_transcription_config": STRING,
|
||||
"vertex_ai_audio_api": {
|
||||
"type": "string",
|
||||
"enum": ["lyria_predict", "lyria_interactions"],
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -500,7 +500,7 @@ class VertexAILyriaTextToSpeechConfig(VertexAITextToSpeechConfig):
|
|||
optional_params: dict,
|
||||
voice: str | dict | None = None,
|
||||
drop_params: bool = False,
|
||||
kwargs: dict = {},
|
||||
kwargs: dict | None = None,
|
||||
) -> tuple[str | None, dict]:
|
||||
mapped_params = dict(optional_params)
|
||||
base_model = model.removeprefix("vertex_ai/")
|
||||
|
|
|
|||
|
|
@ -343,8 +343,7 @@ class VertexPassthroughLoggingHandler:
|
|||
json_response=json_response
|
||||
)
|
||||
response_cost: Final = (
|
||||
VertexPassthroughLoggingHandler._get_audio_prediction_unit_cost(model=model)
|
||||
or 0.0
|
||||
VertexPassthroughLoggingHandler._get_audio_prediction_unit_cost(model=model) or 0.0
|
||||
) * prediction_count
|
||||
|
||||
logging_obj.model = model
|
||||
|
|
|
|||
|
|
@ -53,6 +53,11 @@
|
|||
"type": "number",
|
||||
"minimum": 0
|
||||
},
|
||||
"audio_seconds_per_prediction": {
|
||||
"type": "number",
|
||||
"minimum": 0,
|
||||
"description": "Audio duration, in seconds, produced by one prediction."
|
||||
},
|
||||
"audio_transcription_config": {
|
||||
"type": "string"
|
||||
},
|
||||
|
|
@ -363,6 +368,16 @@
|
|||
"type": "string",
|
||||
"description": "LiteLLM provider slug; one of https://docs.litellm.ai/docs/providers."
|
||||
},
|
||||
"max_audio_length_hours": {
|
||||
"type": "number",
|
||||
"minimum": 0,
|
||||
"description": "Maximum generated audio duration, expressed in hours."
|
||||
},
|
||||
"max_audio_per_prompt": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"description": "Maximum number of audio outputs accepted or generated per prompt."
|
||||
},
|
||||
"max_input_tokens": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
|
|
@ -603,6 +618,17 @@
|
|||
"type": "string",
|
||||
"description": "URL of the provider pricing/model page this entry was taken from."
|
||||
},
|
||||
"supported_audio_formats": {
|
||||
"type": "array",
|
||||
"description": "Audio container formats the model can return.",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"mp3",
|
||||
"wav"
|
||||
]
|
||||
}
|
||||
},
|
||||
"supported_endpoints": {
|
||||
"type": "array",
|
||||
"description": "OpenAI-style API routes this model can be called through, e.g. /v1/chat/completions.",
|
||||
|
|
@ -826,6 +852,13 @@
|
|||
"uses_embed_content": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"vertex_ai_audio_api": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"lyria_predict",
|
||||
"lyria_interactions"
|
||||
]
|
||||
},
|
||||
"web_search_billing_unit": {
|
||||
"type": "string",
|
||||
"description": "Whether web search is billed per query or per prompt.",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue