mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 19:24:27 +00:00
* rename OpenAI -> openai * fix file rename * fix rename changes * fix organization of openai/transcription * fix import OA fine tuning API * fix openai ft handler * fix handler import
15 lines
506 B
Python
15 lines
506 B
Python
from collections.abc import Iterable
|
|
from typing import List
|
|
|
|
|
|
def is_tokens_or_list_of_tokens(value: List):
|
|
# Check if it's a list of integers (tokens)
|
|
if isinstance(value, list) and all(isinstance(item, int) for item in value):
|
|
return True
|
|
# Check if it's a list of lists of integers (list of tokens)
|
|
if isinstance(value, list) and all(
|
|
isinstance(item, list) and all(isinstance(i, int) for i in item)
|
|
for item in value
|
|
):
|
|
return True
|
|
return False
|