Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

dbms_vector.utl_to_generate_text + Cohere; problem: transfer timeout

LemarDec 5 2024

Hello,

Oracle23ai on-premises
apex 24.1.0

I am testing dbms_vector.utl_to_generate_text with cohere.

FUNCTION cohere_params_json
 (p_ai_model IN VARCHAR2 default 'command-r-plus-08-2024',
  p_ai_temp  IN NUMBER DEFAULT 0.5) RETURN JSON IS
  l_params_obj    json_object_t := json_object_t();
BEGIN
  l_params_obj.put('provider', 'cohere');
  l_params_obj.put('credential_name', 'COHERE_CRED_VECTOR0');
  l_params_obj.put('url', 'https://api.cohere.ai/v1/generate');
  l_params_obj.put('model', p_ai_model);
  l_params_obj.put('temperature', p_ai_temp);
  RETURN json(l_params_obj.to_String());

 l_cohere_params := cohere_params_json (p_ai_model => p_qr_model, p_ai_temp => p_qr_temp);
 l_ai_response   := dbms_vector.utl_to_generate_text (data => l_prompt, params => l_cohere_params);

it seems that the server accepts the call (reports an error in case of an incorrect parameter value), but then....

I tried /v1; /v2, /generate,/chat …

ORA-29273: HTTP request failed
ORA-06512: at "SYS.UTL_HTTP", line 1352
ORA-29276: transfer timeout

My second test is direct API Call, it works well

 x_response := apex_web_service.make_rest_request
   (p_url                  => 'https://api.cohere.com/v2/chat', 
    p_http_method          => 'POST', 
    p_body                 => p_json_payload,
    p_transfer_timeout     => 30, 
    p_credential_static_id => 'Cohere_AI_Apex'); -- APEX Credential

Any idea how to.....

Thanks

Comments
Post Details
Added on Dec 5 2024
0 comments
160 views