declare
    l_response clob;
    l_role varchar2(16);
    l_content clob;
    l_usage   clob;
    l_prompt  clob;
begin
    l_prompt := 'この画像に写っている動物の名前と生息地および生態を教えてください。';
    utl_openai_vision.chat_completions(
        p_text      => l_prompt
        ,p_image    => :body
        ,p_mimetype => :content_type
        ,p_max_tokens => 1000
        ,p_role     => l_role
        ,p_content  => l_content
        ,p_usage    => l_usage
        ,p_response => l_response
        ,p_credential_static_id => 'OPENAI_API_KEY'
    );
    :status := 200;
    htp.p(l_content);
exception
    when others then
        htp.p(l_response);
        :status := 400;
end;