
    AHj              !       
   U d dl Z d dlZd dlZd dlmZ d dlmZmZmZm	Z	m
Z
mZmZmZ d dlZd dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d d	lmZ d d
lmZ d dlmZ d dl m!Z!m"Z" d dl#m$Z$m%Z%m&Z& d dl'm(Z( d dl)m*Z*m+Z+ d dl,m-Z-  e       Z.ee/d<   e+	 	 	 	 	 	 	 	 	 	 dLde0dee0   dee"   dee0   dee0   dee0   deee0ef      deee0ef      deee0ef      de&fd       Z1e	 	 	 	 	 	 	 	 	 	 dLde0dee0   dee"   dee0   dee0   dee0   de2dee0   deee0ef      deee0ef      deee0ef      de
d    d!edeeee&f   fd"       Z3e	 	 	 	 	 	 	 	 	 	 dLd#d$de0dee0   dee"   dee0   dee0   dee0   de2dee0   deee0ef      deee0ef      deee0ef      de
d#   d!ede&fd%       Z3e+	 	 	 	 	 	 	 	 	 	 dLde0dee0   dee"   dee0   dee0   dee0   deee0ef      deee0ef      deee0ef      dee&eeee&f   f   fd&       Z3e+	 	 	 	 	 	 dMd'e0dee4   dee0   d(ee0   deee0ef      deee0ef      deee0ef      dee5eeee5f   f   fd)       Z6e+	 	 	 	 	 	 dMd'e0dee4   dee0   d(ee0   deee0ef      deee0ef      deee0ef      de5fd*       Z7e+	 	 	 	 	 dNd'e0de0deee0ef      deee0ef      deee0ef      de&fd+       Z8e	 	 	 	 	 dNd'e0de0de2dee0   deee0ef      deee0ef      deee0ef      d,e
d    d!edeeee&f   fd-       Z9e	 	 	 	 	 dNd#d.d'e0de0de2dee0   deee0ef      deee0ef      deee0ef      d,e
d#   d!ede&fd/       Z9e+	 	 	 	 	 dNd'e0de0deee0ef      deee0ef      deee0ef      dee&eeee&f   f   fd0       Z9e+	 	 	 	 	 	 	 	 	 dOd1ee0   d2ee2   d3ee0   d4ee0   deee0ef      deee0ef      deee0ef      de	e&   fd5       Z:e	 	 	 	 	 	 	 	 dPd1ee0   d2ee2   d3ee0   de2dee0   deee0ef      deee0ef      deee0ef      d6e
d    d!edeeee	e&   f   fd7       Z;e	 	 	 	 	 	 	 	 dPd#d8d1ee0   d2ee2   d3ee0   de2dee0   deee0ef      deee0ef      deee0ef      d6e
d#   d!ede	e&   fd9       Z;e+	 	 	 	 	 	 	 	 dPd1ee0   d2ee2   d3ee0   deee0ef      deee0ef      deee0ef      dee	e&   eeee	e&   f   f   fd:       Z;e+	 	 	 	 	 dNd'e0deee0ef      deee0ef      deee0ef      de&f
d;       Z<e	 	 	 	 	 dNd'e0de2dee0   deee0ef      deee0ef      deee0ef      d<e
d    d!edeeee&f   fd=       Z=e	 	 	 	 	 dNd#d>d'e0de2dee0   deee0ef      deee0ef      deee0ef      d<e
d#   d!ede&fd?       Z=e+	 	 	 	 	 dNd'e0deee0ef      deee0ef      deee0ef      dee&eeee&f   f   f
d@       Z=e+	 	 	 	 	 dNdAe0dBedeee0ef      deee0ef      deee0ef      de$fdC       Z>e+	 	 	 	 	 dNdAe0dBedeee0ef      deee0ef      deee0ef      dee$eeee$f   f   fdD       Z?e+	 	 	 	 	 dNdEe0deee0ef      deee0ef      deee0ef      de$f
dF       Z@e+	 	 	 	 	 dNdEe0deee0ef      deee0ef      deee0ef      dee$eeee$f   f   f
dG       ZAe+	 	 	 	 	 dNd'e0de0deee0ef      deee0ef      deee0ef      de&fdH       ZBe+	 	 	 	 	 dNd'e0de0deee0ef      deee0ef      deee0ef      dee&eeee&f   f   fdI       ZCe+	 	 	 	 	 dNd'e0de0de0deee0ef      deee0ef      deee0ef      de&fdJ       ZDe+	 	 	 	 	 dNd'e0de0de0deee0ef      deee0ef      deee0ef      dee&eeee&f   f   fdK       ZEy)Q    N)partial)Any	CoroutineDictListLiteralOptionalUnionoverload)DEFAULT_VIDEO_ENDPOINT_MODEL)request_timeout)get_llm_provider)Logging)BaseVideoConfig)BaseLLMHTTPHandler)base_llm_http_handler)GenericLiteLLMParams)	CallTypes	FileTypes)CharacterObject VideoCreateOptionalRequestParamsVideoObject)decode_video_id_with_provider)ProviderConfigManagerclient)VideoGenerationRequestUtilsllm_http_handlerpromptmodelinput_referencesecondssizeuserextra_headersextra_query
extra_bodyreturnc                 &  K   t               }	 t        j                         }d|d<   |4t        j                  |xs t
        |j                  dd            \  }}}}t        t        f| |||||||||	|
d|}t        j                         }t        |j                  |      }|j                  d|       d{   }t        j                  |      r| d{   }|S |}|S 7 )7 # t        $ r}t        j                  |||||      d}~ww xY ww)a)  
    Asynchronously calls the `video_generation` function with the given arguments and keyword arguments.

    Parameters:
    - `prompt` (str): Text prompt that describes the video to generate
    - `model` (Optional[str]): The video generation model to use
    - `input_reference` (Optional[FileTypes]): Optional image reference that guides generation
    - `seconds` (Optional[str]): Clip duration in seconds
    - `size` (Optional[str]): Output resolution formatted as width x height
    - `user` (Optional[str]): A unique identifier representing your end-user
    - `timeout` (int): Request timeout in seconds
    - `custom_llm_provider` (Optional[str]): The LLM provider to use
    - `extra_headers` (Optional[Dict[str, Any]]): Additional headers
    - `extra_query` (Optional[Dict[str, Any]]): Additional query parameters
    - `extra_body` (Optional[Dict[str, Any]]): Additional body parameters
    - `kwargs` (dict): Additional keyword arguments

    Returns:
    - `response` (VideoResponse): The response returned by the `video_generation` function.
    T
async_callNapi_baser   r*   )r   r   r    r!   r"   r#   timeoutcustom_llm_providerr$   r%   r&   r   r-   original_exceptioncompletion_kwargsextra_kwargs)localsasyncioget_event_looplitellmr   r   getr   video_generationcontextvarscopy_contextrunrun_in_executoriscoroutine	Exceptionexception_type)r   r   r    r!   r"   r#   r,   r-   r$   r%   r&   kwargs
local_varsloop_funcctxfunc_with_contextinit_responseresponsees                        K/root/tools/cai/cai_env/lib/python3.12/site-packages/litellm/videos/main.pyavideo_generationrJ      sD    J J,
%%'#| &+2+C+C;;#
D9,(A"Aq
 
+ 3'#!
 
  &&(#CGGT2"2249JKK}-**H  %H L +
  
$$ 3 (
 	

sY   DB*C& 8C"9C& C$C& DC& !D"C& $C& &	D/D		DDr,   r-   rJ   Tr?   c                     y N r   r   r    r!   r"   r#   r,   r-   r$   r%   r&   rJ   r?   s                rI   r7   r7   w       "     F)rJ   c                     y rL   rM   rN   s                rI   r7   r7      rO   rP   c                    t               }	 |j                  d      }|j                  dd      }|j                  dd      du }|j                  dd      }|2t        |t              rt        j                  |      }t        di |}|S t        di |}t        |xs t        |      \  }}}}t        j                  |t        j                  |      	      }|t        d
|       |j!                  |       t#        j$                  |      }t#        j&                  |||      }|j)                  |||t+        |      d|i||       t,        j.                  j0                  |_        t5        j6                  || |||||||
|xs t8        ||j                  d            S # t:        $ r'}t        j<                  |xs t        ||||      d}~ww xY w)\
    Maps the https://api.openai.com/v1/videos endpoint.

    Currently supports OpenAI
    litellm_logging_objlitellm_call_idNr)   FTmock_response)r   r-   r   providerz&video generation is not supported for )r    video_generation_provider_config video_generation_optional_paramsr?   r   r#   optional_paramslitellm_paramsr-   r   )r   r   rY   (video_generation_optional_request_paramsr-   r]   logging_objr$   r&   r,   	_is_asyncr   r.   rM   )r2   popr6   
isinstancestrjsonloadsr   r   r   r   r   get_provider_video_configr5   LlmProviders
ValueErrorupdater   -get_requested_video_generation_optional_param$get_optional_params_video_generationupdate_from_kwargsdictr   create_videovalue	call_typer   video_generation_handlerDEFAULT_REQUEST_TIMEOUTr=   r>   )r   r   r    r!   r"   r#   r,   r-   r$   r%   r&   r?   r@   rT   rU   r`   rV   rG   r]   rB   rY   rZ   video_generation_request_paramsrH   s                           rI   r7   r7      s   , JZ
17<Q1R)/4Et)LJJ|U3t;	 

?D9$-- $

= 9"3]3HO .77+;77 3,
("Aq ";;))*=>
 	) ,389L8MN  	&! (UU 	) (LL1Q1Q 	( 	.. !@A!?1 !4 	/ 
	
 )2(>(>(D(D% %==-M5T 3)+'!66::h'
 	
  
$$77 3 (
 	

s   A<F! 	DF! !	G*"GGvideo_idvariantc                    t               }	 |j                  d      }	|j                  dd      }
|j                  dd      du }| t        |       }|j                  d      xs d}t	        di |}t        j                  dt        j                  |      	      }|t        d
|       |j                  |       d| i}|	j                  |d|j                  d      t        |      d|
i||       t        j                  | ||||	|xs t        ||j                  d      ||
      S # t         $ r}t        j"                  d||||      d}~ww xY w)aN  
    Download video content from OpenAI's video API.

    Args:
        video_id (str): The identifier of the video whose content to download.
        api_key (Optional[str]): The API key to use for authentication.
        api_base (Optional[str]): The base URL for the API.
        timeout (Optional[float]): The timeout for the request in seconds.
        custom_llm_provider (Optional[str]): The LLM provider to use. If not provided, will be auto-detected.
        variant (Optional[str]): Which downloadable asset to return. Defaults to the MP4 video.
        extra_headers (Optional[Dict[str, Any]]): Additional headers to include in the request.
        extra_query (Optional[Dict[str, Any]]): Additional query parameters.
        extra_body (Optional[Dict[str, Any]]): Additional body parameters.

    Returns:
        bytes: The raw video content as bytes.

    Example:
        ```python
        import litellm

        video_bytes = litellm.video_content(
            video_id="video_123"
        )

        with open("video.mp4", "wb") as f:
            f.write(video_bytes)
        ```
    rT   rU   Nr)   FTr-   openairW   z,video support download is not supported for rt    r#   r[   r   )
rt   video_content_provider_configr-   r]   r_   r,   r$   r   r`   ru   r.   rM   )r2   r6   ra   r   r   r   rf   r5   rg   rh   ri   rl   rm   r   video_content_handlerrr   r=   r>   )rt   r,   r-   ru   r$   r%   r&   r?   r@   rT   rU   r`   decodedr]   video_provider_configvideo_content_request_paramsrH   s                    rI   video_contentr~     s   T JC
17<Q1R)/4Et)LJJ|U3t;	 &3H=G")++.C"D"P .77
 ";;))*=>
 	 !(>?R>ST  	&! .
$
 	..F# !=>!?. !4 	/ 
	
 %::*? 3)+66'::h'
 	
  
$$ 3 (
 	

s   DD( (	E1EEc                   K   t               }	 t        j                         }	d|d<   | t        |       }
|
j	                  d      xs d}t        t        f| ||||||d|}t        j                         }t        |j                  |      }|	j                  d|       d{   }t        j                  |      r| d{   }|S |}|S 7 )7 # t        $ r}t        j                  d||||      d}~ww xY ww)	ai  
    Asynchronously download video content.

    Parameters:
    - `video_id` (str): The identifier of the video whose content to download
    - `timeout` (Optional[float]): The timeout for the request in seconds
    - `custom_llm_provider` (Optional[str]): The LLM provider to use
    - `extra_headers` (Optional[Dict[str, Any]]): Additional headers
    - `extra_query` (Optional[Dict[str, Any]]): Additional query parameters
    - `extra_body` (Optional[Dict[str, Any]]): Additional body parameters
    - `kwargs` (dict): Additional keyword arguments

    Returns:
    - `bytes`: The raw video content as bytes
    Tr)   Nr-   rw   )rt   r,   r-   ru   r$   r%   r&   rx   r.   )r2   r3   r4   r   r6   r   r~   r8   r9   r:   r;   r<   r=   r5   r>   )rt   r,   r-   ru   r$   r%   r&   r?   r@   rA   r{   rC   rD   rE   rF   rG   rH   s                    rI   avideo_contentr     s#    8 J&
%%'#| &3H=G")++.C"D"P

 3'#!

 

 &&(#CGGT2"2249JKK}-**H  %H L +
  
$$ 3 (
 	

sY   C9BC  C
!C ?C C C9C 	C9
C C 	C6C11C66C9c                   K   t               }	 t        j                         }	d|d<   t        t        f| ||||||d|}
t        j                         }t        |j                  |
      }|	j                  d|       d{   }t        j                  |      r| d{   }|S |}|S 7 )7 # t        $ r}t        j                  d||||      d}~ww xY ww)a  
    Asynchronously calls the `video_remix` function with the given arguments and keyword arguments.

    Parameters:
    - `video_id` (str): The identifier of the completed video to remix
    - `prompt` (str): Updated text prompt that directs the remix generation
    - `timeout` (int): Request timeout in seconds
    - `custom_llm_provider` (Optional[str]): The LLM provider to use
    - `extra_headers` (Optional[Dict[str, Any]]): Additional headers
    - `extra_query` (Optional[Dict[str, Any]]): Additional query parameters
    - `extra_body` (Optional[Dict[str, Any]]): Additional body parameters
    - `kwargs` (dict): Additional keyword arguments

    Returns:
    - `response` (VideoObject): The response returned by the `video_remix` function.
    Tr)   rt   r   r,   r-   r$   r%   r&   Nrx   r.   )r2   r3   r4   r   video_remixr8   r9   r:   r;   r<   r=   r5   r>   rt   r   r,   r-   r$   r%   r&   r?   r@   rA   rC   rD   rE   rF   rG   rH   s                   rI   avideo_remixr     s     : J!
%%'#|

 3'#!

 

 &&(#CGGT2"2249JKK}-**H  %H L +
  
$$ 3 (
 	

Y   CA0B, >B(?B, B*B, #C$B, 'C(B, *B, ,	C5CCCr   c                     y rL   rM   	rt   r   r,   r-   r$   r%   r&   r   r?   s	            rI   r   r          rP   )r   c                     y rL   rM   r   s	            rI   r   r   #  r   rP   c                 t   t               }	 |j                  d      }	|j                  dd      }
|j                  dd      du }|j                  dd      }|2t        |t              rt        j                  |      }t        di |}|S | t        |       }|j                  d      xs d	}t        di |}t        j                  dt        j                  |      
      }|t        d|       |j                  |       | |d}|	j!                  |d|j                  d      t#        |      d|
i||       t$        j&                  j(                  |	_        t-        j.                  | |||||	|||xs t0        ||j                  d            S # t2        $ r}t        j4                  d||||      d}~ww xY w)zm
    Maps the https://api.openai.com/v1/videos/{video_id}/remix endpoint.

    Currently supports OpenAI
    rT   rU   Nr)   FTrV   r-   rw   rW   z!video remix is not supported for rt   r   rx   r#   r[   r   )rt   r   video_remix_provider_configr-   r]   r_   r$   r&   r,   r`   r   r.   rM   )r2   ra   r6   rb   rc   rd   re   r   r   r   r   rf   r5   rg   rh   ri   rl   rm   r   r   ro   rp   r   video_remix_handlerrr   r=   r>   )rt   r   r,   r-   r$   r%   r&   r?   r@   rT   rU   r`   rV   rG   r{   r]   r   video_remix_request_paramsrH   s                      rI   r   r   5  s   $ JN
17<Q1R)/4Et)LJJ|U3t;	 

?D9$-- $

= 9"3]3HO &3H=G")++.C"D"P .77
 ";;))*=>
 	$ '.@AT@UVWW&! !,
" 	..F# !;<!?, !4 	/ 
	
 )2(=(=(C(C% %88(C 3)+'!66::h'
 	
  
$$ 3 (
 	

s   A<F 	DF 	F7F22F7afterlimitorderapi_keyc	                   K   t               }
	 t        j                         }d|	d<   |,t        j                  d|
j                  dd            \  }}}}t        t        f| ||||||||d	|	}t        j                         }t        |j                  |      }|j                  d|       d{   }t        j                  |      r| d{   }|S |}|S 7 )7 # t        $ r}t        j                  d|||
|	      d}~ww xY ww)	a  
    Asynchronously calls the `video_list` function with the given arguments and keyword arguments.

    Parameters:
    - `after` (Optional[str]): Identifier for the last item from the previous pagination request
    - `limit` (Optional[int]): Number of items to retrieve
    - `order` (Optional[str]): Sort order of results by timestamp. Use asc for ascending order or desc for descending order
    - `api_key` (Optional[str]): The API key to use for authentication
    - `timeout` (int): Request timeout in seconds
    - `custom_llm_provider` (Optional[str]): The LLM provider to use
    - `extra_headers` (Optional[Dict[str, Any]]): Additional headers
    - `extra_query` (Optional[Dict[str, Any]]): Additional query parameters
    - `extra_body` (Optional[Dict[str, Any]]): Additional body parameters
    - `kwargs` (dict): Additional keyword arguments

    Returns:
    - `response` (Dict[str, Any]): The response returned by the `video_list` function.
    Tr)   Nrx   r*   r+   )	r   r   r   r   r,   r-   r$   r%   r&   r.   )r2   r3   r4   r5   r   r6   r   
video_listr8   r9   r:   r;   r<   r=   r>   )r   r   r   r   r,   r-   r$   r%   r&   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   s                      rI   avideo_listr     s7    B J)
%%'#| &+2+C+C:>>*d#C,(A"Aq 
 3'#!
 
 &&(#CGGT2"2249JKK}-**H  %H L +
  
$$ 3 (
 	

sY   DB C .C/C CC DC DC C 	D%C??DDr   c                     y rL   rM   
r   r   r   r,   r-   r$   r%   r&   r   r?   s
             rI   r   r          rP   )r   c                     y rL   rM   r   s
             rI   r   r     r   rP   c                 ^   t               }		 |j                  d      }
|j                  dd      }|j                  dd      du }|j                  dd      }|>t        |t              rt        j                  |      }|D cg c]  }t        di | c}S |d}t        di |}t        j                  dt        j                  |      	      }|t        d
|       |	j                  |       | ||d}|
j                  |d|j                  d      t!        |      d|i||       t"        j$                  j&                  |
_        t+        j,                  | ||||||
|||xs t.        ||j                  d            S c c}w # t0        $ r}t        j2                  d|||	|      d}~ww xY w)rS   rT   rU   Nr)   FTrV   rw   rW   z video list is not supported for )r   r   r   rx   r#   r[   r   )r   r   r   video_list_provider_configr-   r]   r_   r$   r%   r,   r`   r   r.   rM   )r2   r6   ra   rb   rc   rd   re   r   r   r   rf   r5   rg   rh   ri   rl   rm   r   r   ro   rp   r   video_list_handlerrr   r=   r>   )r   r   r   r,   r-   r$   r%   r&   r?   r@   rT   rU   r`   rV   itemr]   r   video_list_request_paramsrH   s                      rI   r   r     s   & JM
17<Q1R)/4Et)LJJ|U3t;	 

?D9$-- $

= 94ABDK'$'BB &"* .77
 ";;))*=>
 	# &-?@S?TUVV&! +
! 	..F# !:;!?+ !4 	/ 
	
 )2(<(<(B(B% %77'A 3)+'#66::h'
 	
[ Cx  
$$ 3 (
 	

s1   A4F  E?F C)F ?F 	F,F''F,c           
        K   t               }	 t        j                         }d|d<   t        t        f| |||||d|}	t        j                         }
t        |
j                  |	      }|j                  d|       d{   }t        j                  |      r| d{   }|S |}|S 7 )7 # t        $ r}t        j                  d||||      d}~ww xY ww)a  
    Asynchronously retrieve video status from OpenAI's video API.

    Parameters:
    - `video_id` (str): The identifier of the video whose status to retrieve
    - `model` (Optional[str]): The model to use. If not provided, will be auto-detected
    - `timeout` (int): Request timeout in seconds
    - `custom_llm_provider` (Optional[str]): The LLM provider to use
    - `extra_headers` (Optional[Dict[str, Any]]): Additional headers
    - `extra_query` (Optional[Dict[str, Any]]): Additional query parameters
    - `extra_body` (Optional[Dict[str, Any]]): Additional body parameters
    - `kwargs` (dict): Additional keyword arguments

    Returns:
    - `response` (VideoObject): The response returned by the `video_status` function.
    Tr)   )rt   r,   r-   r$   r%   r&   Nrx   r.   )r2   r3   r4   r   video_statusr8   r9   r:   r;   r<   r=   r5   r>   )rt   r,   r-   r$   r%   r&   r?   r@   rA   rC   rD   rE   rF   rG   rH   s                  rI   avideo_statusr   t  s     8 J 
%%'#|	
 3'#!	
 	
 &&(#CGGT2"2249JKK}-**H  %H L +
  
$$ 3 (
 	

Y   CA/B+ =B'>B+ B)B+ "C#B+ &C'B+ )B+ +	C4CCCr   c                     y rL   rM   rt   r,   r-   r$   r%   r&   r   r?   s           rI   r   r          rP   )r   c                     y rL   rM   r   s           rI   r   r     r   rP   c                 p   t               }	 |j                  d      }|j                  dd      }	|j                  dd      du }
|j                  dd      }|2t        |t              rt        j                  |      }t        di |}|S | t        |       }|j                  d      xs d	}t        di |}t        j                  dt        j                  |      
      }|t        d|       |j                  |       d| i}|j!                  |d|j                  d      t#        |      d|	i||       t$        j&                  j(                  |_        t-        j.                  | |||||||xs t0        |
|j                  d      
      S # t2        $ r}t        j4                  d||||      d}~ww xY w)a  
    Retrieve video status from OpenAI's video API.

    Args:
        video_id (str): The identifier of the video whose status to retrieve.
        timeout (int): The timeout for the request in seconds.
        custom_llm_provider (Optional[str]): The LLM provider to use. If not provided, will be auto-detected.
        extra_headers (Optional[Dict[str, Any]]): Additional headers to include in the request.
        extra_query (Optional[Dict[str, Any]]): Additional query parameters.
        extra_body (Optional[Dict[str, Any]]): Additional body parameters.

    Returns:
        VideoObject: The video status information.

    Example:
        ```python
        import litellm

        # Get video status
        video_status = litellm.video_status(
            video_id="video_123"
        )

        print(f"Video status: {video_status.status}")
        print(f"Progress: {video_status.progress}%")
        ```
    rT   rU   Nr)   FTrV   r-   rw   rW   z"video status is not supported for rt   rx   r#   r[   r   )
rt   video_status_provider_configr-   r]   r_   r$   r&   r,   r`   r   r.   rM   )r2   r6   ra   rb   rc   rd   re   r   r   r   r   rf   r5   rg   rh   ri   rl   rm   r   video_retrievero   rp   r   video_status_handlerrr   r=   r>   )rt   r,   r-   r$   r%   r&   r?   r@   rT   rU   r`   rV   rG   r{   r]   r   video_status_request_paramsrH   s                     rI   r   r     s   N JL
17<Q1R)/4Et)LJJ|U3t;	 

?D9$-- $

= 9"3]3HO &3H=G")++.C"D"P .77
 ";;))*=>
 	% (/ABUAVWXX&! -
#
 	..F# !<=!?- !4 	/ 
	
 )2(@(@(F(F% %99)E 3)+'!66::h'
 	
  
$$ 3 (
 	

s   A<F 	DF 	F5F00F5namevideoc                   K   t               }	 t        j                         }	d|d<   |d}t        t        f| ||||||d|}
t        j                         }t        |j                  |
      }|	j                  d|       d{   }t        j                  |      r| d{   }|S |}|S 7 )7 # t        $ r}t        j                  d||||      d}~ww xY ww)zo
    Asynchronously create a character from an uploaded video file.
    Maps to POST /v1/videos/characters
    Tr)   Nrw   )r   r   r,   r-   r$   r%   r&   rx   r.   )r2   r3   r4   r   video_create_characterr8   r9   r:   r;   r<   r=   r5   r>   )r   r   r,   r-   r$   r%   r&   r?   r@   rA   rC   rD   rE   rF   rG   rH   s                   rI   avideo_create_characterr   N  s     J$
%%'#|&"*"

 3'#!

 

 &&(#CGGT2"2249JKK}-**H  %H L +
  
$$ 3 (
 	

sY   CA4B0 B,B0 !B."B0 'C(B0 +C,B0 .B0 0	C9CCCc                 .   t               }	 |j                  d      }	|j                  dd      }
|j                  dd      du }|j                  dd      }|0t        |t              rt        j                  |      }t        di |S |d}t        di |}t        j                  dt        j                  |      	      }|t        d
|       |j                  |       d| i}|	j                  d|j                  d      t!        |      d|
i||       t"        j$                  j&                  |	_        t+        j,                  | |||||	||xs t.        ||j                  d      
      S # t0        $ r}t        j2                  d||||      d}~ww xY w)z`
    Create a character from an uploaded video file.
    Maps to POST /v1/videos/characters
    rT   rU   Nr)   FTrV   rw   rW   z,video create character is not supported for r   rx   r#   r   r#   r\   r]   r-   r   )
r   r   r|   r-   r]   r_   r$   r,   r`   r   r.   rM   )r2   ra   r6   rb   rc   rd   re   r   r   r   rf   r5   rg   rh   ri   update_environment_variablesrm   r   r   ro   rp   r   video_create_character_handlerrr   r=   r>   )r   r   r,   r-   r$   r%   r&   r?   r@   rT   rU   r`   rV   r]   provider_configrequest_paramsrH   s                    rI   r   r     s    J=
17<Q1R)/4Et)LJJ|U3t;	

?D9$-- $

= 9"3]33&"*-77 ";;))*=>
 	 ">?R>ST  	&! &~88F# 0-Q.Q 3 	9 	
 )2(H(H(N(N%$CC"1 3)+'66::h'
 	
  
$$ 3 (
 	

s   A:E, C$E, ,	F5FFcharacter_idc           
        K   t               }	 t        j                         }d|d<   t        t        f| |||||d|}	t        j                         }
t        |
j                  |	      }|j                  d|       d{   }t        j                  |      r| d{   }|S |}|S 7 )7 # t        $ r}t        j                  d||||      d}~ww xY ww)zi
    Asynchronously retrieve a character by ID.
    Maps to GET /v1/videos/characters/{character_id}
    Tr)   )r   r,   r-   r$   r%   r&   Nrx   r.   )r2   r3   r4   r   video_get_characterr8   r9   r:   r;   r<   r=   r5   r>   )r   r,   r-   r$   r%   r&   r?   r@   rA   rC   rD   rE   rF   rG   rH   s                  rI   avideo_get_characterr     s      J 
%%'#|	
% 3'#!	
 	
 &&(#CGGT2"2249JKK}-**H  %H L +
  
$$ 3 (
 	

r   c                 ,   t               }	 |j                  d      }|j                  dd      }	|j                  dd      du }
|j                  dd      }|0t        |t              rt        j                  |      }t        di |S |d}t        di |}t        j                  dt        j                  |      	      }|t        d
|       |j                  |       d| i}|j                  d|j                  d      t!        |      d|	i||       t"        j$                  j&                  |_        t+        j,                  | ||||||xs t.        |
|j                  d      	      S # t0        $ r}t        j2                  d||||      d}~ww xY w)zZ
    Retrieve a character by ID.
    Maps to GET /v1/videos/characters/{character_id}
    rT   rU   Nr)   FTrV   rw   rW   z)video get character is not supported for r   rx   r#   r   r   )	r   r|   r-   r]   r_   r$   r,   r`   r   r.   rM   )r2   ra   r6   rb   rc   rd   re   r   r   r   rf   r5   rg   rh   ri   r   rm   r   r   ro   rp   r   video_get_character_handlerrr   r=   r>   )r   r,   r-   r$   r%   r&   r?   r@   rT   rU   r`   rV   r]   r   r   rH   s                   rI   r   r     s    J<
17<Q1R)/4Et)LJJ|U3t;	

?D9$-- $

= 9"3]33&"*-77 ";;))*=>
 	 ";<O;PQ  	&! .=88F# 0-Q.Q 3 	9 	
 )2(E(E(K(K%$@@%"1 3)+'66::h'

 
	
  
$$ 3 (
 	

s   A:E+ C#E+ +	F4FFc                   K   t               }	 t        j                         }	d|d<   t        t        f| ||||||d|}
t        j                         }t        |j                  |
      }|	j                  d|       d{   }t        j                  |      r| d{   }|S |}|S 7 )7 # t        $ r}t        j                  d||||      d}~ww xY ww)zS
    Asynchronously create a video edit job.
    Maps to POST /v1/videos/edits
    Tr)   r   Nrx   r.   )r2   r3   r4   r   
video_editr8   r9   r:   r;   r<   r=   r5   r>   r   s                   rI   avideo_editr   U  s      J!
%%'#|

 3'#!

 

 &&(#CGGT2"2249JKK}-**H  %H L +
  
$$ 3 (
 	

r   c                 n   t               }	 |j                  d      }	|j                  dd      }
|j                  dd      du }|j                  dd      }|0t        |t              rt        j                  |      }t        di |S | t        |       }|j                  d      xs d	}t        di |}t        j                  dt        j                  |      
      }|t        d|       |j                  |       | |d}|	j!                  d|j                  d      t#        |      d|
i||       t$        j&                  j(                  |	_        t-        j.                  || ||||	|||xs t0        ||j                  d            S # t2        $ r}t        j4                  d||||      d}~ww xY w)zD
    Create a video edit job.
    Maps to POST /v1/videos/edits
    rT   rU   Nr)   FTrV   r-   rw   rW   z video edit is not supported for r   rx   r#   r   r   )r   rt   r|   r-   r]   r_   r$   r&   r,   r`   r   r.   rM   )r2   ra   r6   rb   rc   rd   re   r   r   r   r   rf   r5   rg   rh   ri   r   rm   r   r   ro   rp   r   video_edit_handlerrr   r=   r>   )rt   r   r,   r-   r$   r%   r&   r?   r@   rT   rU   r`   rV   r{   r]   r   r   rH   s                     rI   r   r     s    J=
17<Q1R)/4Et)LJJ|U3t;	

?D9$-- $

= 9///&3H=G")++.C"D"P-77 ";;))*=>
 	 "?@S?TUVV&!,4G88F# 0-Q.Q 3 	9 	
 )2(<(<(B(B%$77"1 3)+'!66::h'
 	
  
$$ 3 (
 	

s   A:F DF 	F4F//F4c                   K   t               }		 t        j                         }
d|d<   t        t        f| |||||||d|}t        j                         }t        |j                  |      }|
j                  d|       d{   }t        j                  |      r| d{   }|S |}|S 7 )7 # t        $ r}t        j                  d|||	|      d}~ww xY ww)zY
    Asynchronously create a video extension.
    Maps to POST /v1/videos/extensions
    Tr)   )rt   r   r!   r,   r-   r$   r%   r&   Nrx   r.   )r2   r3   r4   r   video_extensionr8   r9   r:   r;   r<   r=   r5   r>   )rt   r   r!   r,   r-   r$   r%   r&   r?   r@   rA   rC   rD   rE   rF   rG   rH   s                    rI   avideo_extensionr     s       J"
%%'#|
 3'#!
 
 &&(#CGGT2"2249JKK}-**H  %H L +
  
$$ 3 (
 	

sY   CA1B- ?B) B- B+B- $C%B- (C)B- +B- -	C6CCCc                 r   t               }		 |j                  d      }
|j                  dd      }|j                  dd      du }|j                  dd      }|0t        |t              rt        j                  |      }t        di |S | t        |       }|j                  d      xs d	}t        di |}t        j                  dt        j                  |      
      }|t        d|       |	j                  |       | ||d}|
j!                  d|j                  d      t#        |      d|i||       t$        j&                  j(                  |
_        t-        j.                  || |||||
|||xs t0        ||j                  d            S # t2        $ r}t        j4                  d|||	|      d}~ww xY w)zJ
    Create a video extension.
    Maps to POST /v1/videos/extensions
    rT   rU   Nr)   FTrV   r-   rw   rW   z%video extension is not supported for )rt   r   r!   rx   r#   r   r   )r   rt   r!   r|   r-   r]   r_   r$   r&   r,   r`   r   r.   rM   )r2   ra   r6   rb   rc   rd   re   r   r   r   r   rf   r5   rg   rh   ri   r   rm   r   r   ro   rp   r   video_extension_handlerrr   r=   r>   )rt   r   r!   r,   r-   r$   r%   r&   r?   r@   rT   rU   r`   rV   r{   r]   r   r   rH   s                      rI   r   r     s     JD
17<Q1R)/4Et)LJJ|U3t;	

?D9$-- $

= 9///&3H=G")++.C"D"P-77 ";;))*=>
 	 "78K7LM  	&!  
 	88F# 0-Q.Q 3 	9 	
 )2(A(A(G(G%$<<"1 3)+'!66::h'
 	
  
$$ 3 (
 	

s   A:F DF 	F6F11F6)
NNNNNX  NNNN)NNNNNN)r   NNNN)	NNNNr   NNNN)NNNr   NNNN)Fr3   r8   rd   	functoolsr   typingr   r   r   r   r   r	   r
   r   r5   litellm.constantsr   r   rr   1litellm.litellm_core_utils.get_llm_provider_logicr   *litellm.litellm_core_utils.litellm_loggingr   LiteLLMLoggingObj+litellm.llms.base_llm.videos.transformationr   *litellm.llms.custom_httpx.llm_http_handlerr   litellm.mainr   litellm.types.routerr   litellm.types.utilsr   r   litellm.types.videos.mainr   r   r   litellm.types.videos.utilsr   litellm.utilsr   r   litellm.videos.utilsr   r   __annotations__rc   rJ   intr7   floatbytesr~   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rM   rP   rI   <module>r      s       Q Q Q  : H N S G I . 5 4 
 E 7 < (:'; $ ;   +/! /3,0+/Q
Q
C=Q
 i(Q
 c]	Q

 3-Q
 3-Q
 DcN+Q
 $sCx.)Q
 c3h(Q
 Q
 Q
n 
  +/!)-.2,0+/C= i( c]	
 3- 3-  "# DcN+ $sCx.) c3h( t}  sC$% 
& 
  +/!)-.2,0+/ ).C= i( c]	
 3- 3-  "# DcN+ $sCx.) c3h( u~   
*   +/! /3,0+/p
p
C=p
 i(p
 c]	p

 3-p
 3-p
 DcN+p
 $sCx.)p
 c3h(p
 ;	#sK"789:p
 p
f   $)-! /3,0+/m
m
e_m
 "#m
 c]	m
 DcN+m
 $sCx.)m
 c3h(m
 5)CeO,-.m
 m
b   $)-! /3,0+/B
B
e_B
 "#B
 c]	B
 DcN+B
 $sCx.)B
 c3h(B
 B
 B
L   /3,0+/>
>
>
 DcN+>
 $sCx.)>
 c3h(>
 >
 >
H 
 )-.2,0+/  "#	
 DcN+ $sCx.) c3h( $-  sC$% 
 
 )-.2,0+/ $)  "#	
 DcN+ $sCx.) c3h( %.   
"   /3,0+/`
`
`
 DcN+`
 $sCx.)`
 c3h(`
 ;	#sK"789:`
 `
H ! /3,0+/J
C=J
C=J
 C=J
 c]	J
 DcN+J
 $sCx.)J
 c3h(J
 
+J
 J
` 
)-.2,0+/C=C= C= 	
 "# DcN+ $sCx.) c3h(   sCk**+ 
  
)-.2,0+/ #(C=C= C= 	
 "# DcN+ $sCx.) c3h(   
+ 
$  /3,0+/`
C=`
C=`
 C=`
 DcN+`
 $sCx.)`
 c3h(`
 4iS${2C(CDEF`
 `
H   /3,0+/<
<
 DcN+<
 $sCx.)<
 c3h(<
 <
 <
D 
 )-.2,0+/ "# DcN+	
 $sCx.) c3h( 4=  sC$% 
 
 )-.2,0+/ %* "# DcN+	
 $sCx.) c3h( 5>   
    /3,0+/s
s
 DcN+s
 $sCx.)s
 c3h(s
 ;	#sK"789:s
 s
l  .2,0+/3

3
3

 DcN+3
 $sCx.)3
 c3h(3
 3
 3
l  .2,0+/L

L
L

 DcN+L
 $sCx.)L
 c3h(L
 ?Ic3&?@@AL
 L
^  .2,0+/.
.
 DcN+	.

 $sCx.).
 c3h(.
 .
 .
b  .2,0+/J
J
 DcN+	J

 $sCx.)J
 c3h(J
 ?Ic3&?@@AJ
 J
Z  .2,0+/0
0
0

 DcN+0
 $sCx.)0
 c3h(0
 0
 0
f  .2,0+/L
L
L

 DcN+L
 $sCx.)L
 c3h(L
 ;	#sK"7889L
 L
^ 
 .2,0+/2
2
2
 2
 DcN+2
 $sCx.)2
 c3h(2
 2
 2
j 
 .2,0+/T
T
T
 T
 DcN+T
 $sCx.)T
 c3h(T
 ;	#sK"7889T
 T
rP   