mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-06 02:48:13 +00:00
fix get_tags_from_request_body
This commit is contained in:
parent
02758ebc28
commit
96449b319c
1 changed files with 12 additions and 3 deletions
|
|
@ -263,8 +263,17 @@ def get_tags_from_request_body(request_body: dict) -> List[str]:
|
|||
"""
|
||||
metadata_variable_name = get_metadata_variable_name_from_kwargs(request_body)
|
||||
metadata = request_body.get(metadata_variable_name, {})
|
||||
tags_in_metadata: List[str] = metadata.get("tags", [])
|
||||
tags_in_request_body: List[str] = request_body.get("tags", [])
|
||||
combined_tags: List[str] = tags_in_metadata + tags_in_request_body
|
||||
tags_in_metadata: Any = metadata.get("tags", [])
|
||||
tags_in_request_body: Any = request_body.get("tags", [])
|
||||
combined_tags: List[str] = []
|
||||
|
||||
######################################
|
||||
# Only combine tags if they are lists
|
||||
######################################
|
||||
if isinstance(tags_in_metadata, list):
|
||||
combined_tags.extend(tags_in_metadata)
|
||||
if isinstance(tags_in_request_body, list):
|
||||
combined_tags.extend(tags_in_request_body)
|
||||
######################################
|
||||
return [tag for tag in combined_tags if isinstance(tag, str)]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue