diff --git a/volcenginesdkarkruntime/resources/chat/completions.py b/volcenginesdkarkruntime/resources/chat/completions.py index 6433007c..759d3dc9 100644 --- a/volcenginesdkarkruntime/resources/chat/completions.py +++ b/volcenginesdkarkruntime/resources/chat/completions.py @@ -63,6 +63,14 @@ def _process_messages( "encryption is not supported for image url, " "please use base64 image if you want encryption" ) + elif part.get("type", None) == "video_url": + if part["video_url"]["url"].startswith("data:"): + part["video_url"]["url"] = f(part["video_url"]["url"]) + else: + warnings.warn( + "encryption is not supported for video url, " + "please use base64 video if you want encryption" + ) else: raise TypeError( "encryption is not supported for content type {}".format( diff --git a/volcenginesdkarkruntime/types/chat/chat_completion_content_part_param.py b/volcenginesdkarkruntime/types/chat/chat_completion_content_part_param.py index a75a664d..094fa887 100644 --- a/volcenginesdkarkruntime/types/chat/chat_completion_content_part_param.py +++ b/volcenginesdkarkruntime/types/chat/chat_completion_content_part_param.py @@ -6,9 +6,10 @@ from .chat_completion_content_part_image_param import ( ChatCompletionContentPartImageParam, ) +from .chat_completion_content_part_video_param import ChatCompletionContentPartVideoParam __all__ = ["ChatCompletionContentPartParam"] ChatCompletionContentPartParam = Union[ - ChatCompletionContentPartTextParam, ChatCompletionContentPartImageParam + ChatCompletionContentPartTextParam, ChatCompletionContentPartImageParam, ChatCompletionContentPartVideoParam ] diff --git a/volcenginesdkarkruntime/types/chat/chat_completion_content_part_video_param.py b/volcenginesdkarkruntime/types/chat/chat_completion_content_part_video_param.py new file mode 100644 index 00000000..c90ddf2d --- /dev/null +++ b/volcenginesdkarkruntime/types/chat/chat_completion_content_part_video_param.py @@ -0,0 +1,23 @@ +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["ChatCompletionContentPartVideoParam", "VideoURL"] + + +class VideoURL(TypedDict, total=False): + url: Required[str] + """Either a URL of the video or the base64 encoded video data.""" + + fps: float + """The frame rate of the video.""" + + detail: Literal["low", "high"] + """Specifies the detail level of the video.""" + + +class ChatCompletionContentPartVideoParam(TypedDict, total=False): + video_url: Required[VideoURL] + + type: Required[Literal["video_url"]] + """The type of the content part."""