Skip to content

adm_ai_rag_extract_api

LLM-based file text extraction for RAG collections.

An alternative to the built-in adm_storage_index_api.extract_text_from_blob: the file is sent to a multimodal LLM (via UC AI file input) which returns a clean textual transcription. Used by adm_ai_rag_workflow_api when a collection configures an llm_text_extraction section. Lives in the AI pack because it depends on uc_ai (the base adm_storage_index_api must stay uc_ai-free).

NOTE: file input requires a provider/model that supports it (Anthropic, Gemini, OpenAI). UC AI’s OCI provider does not currently support file input.

Sends a file to an LLM and returns its extracted text content. Raises on empty or truncated (finish_reason = ‘length’) output so a partial transcription is never stored as index_content.

Signature:

function extract_text_via_llm (
p_file_blob in blob,
p_mime_type in varchar2,
p_provider in varchar2,
p_model in varchar2,
p_config in json_object_t default null,
p_prompt in clob default null
) return clob;

Parameters:

NameDirectionTypeDescription
p_file_blobinblobThe file content
p_mime_typeinvarchar2The file MIME type (e.g. ‘application/pdf’)
p_providerinvarchar2UC AI provider (must support file input)
p_modelinvarchar2UC AI model
p_configinjson_object_t default nullOptional UC AI config passthrough (credential, provider block, max tokens)
p_promptinclob default nullOptional override of the default extraction prompt

Returns: clob - The extracted text