def video()

in devai-cli/src/devai/commands/review.py [0:0]


def video(file, prompt):
    """
    This function performs a video analysis using the Generative Model API.

    Args:
        file (str): path to video.
        prompt (str): question about video.
    """

    qry = get_prompt('review_query')

    if qry is None:
        qry=f'''
        INSTRUCTIONS:
        {prompt}
        '''

    with open(file, "rb") as f:
        video_data = f.read()

    video = Part.from_data(
        data=video_data,
        mime_type="video/mp4",
    )

    contents = [qry, video]

    code_chat_model = GenerativeModel(MODEL_NAME)
    with telemetry.tool_context_manager(USER_AGENT):
        responses = code_chat_model.generate_content(contents, stream=True)

    for response in responses:
        print(response.text, end="")