adm_ai_rag_workflow_api
This document contains the API documentation for the adm_ai_rag_workflow_api package.
Functions and Procedures
Section titled “Functions and Procedures”sync_rag_collection_files
Section titled “sync_rag_collection_files”Synchronizes adm_ai_rag_collection_files with current documents in the RAG collection.
- Inserts new entries for documents matching the collection criteria
- Updates entries to use the latest version for documents with new versions
- Deletes entries for documents no longer matching the collection criteria
Signature:
procedure sync_rag_collection_files ( p_collection_id in adm_ai_rag_collections.rag_collection_id%type);Parameters:
| Name | Direction | Type | Description |
|---|---|---|---|
p_collection_id | in | adm_ai_rag_collections.rag_collection_id%type | The ID of the RAG collection to synchronize |
process_collection_text_extraction
Section titled “process_collection_text_extraction”Extracts text of collection files into adm_document_versions.index_content. Files stored in the database are processed directly from their blob; object storage files are downloaded first (only when the AI_TEXT_EXTRACTION setting is enabled).
Signature:
procedure process_collection_text_extraction ( p_collection_id in adm_ai_rag_collections.rag_collection_id%type, p_limit in number default null);Parameters:
| Name | Direction | Type | Description |
|---|---|---|---|
p_collection_id | in | adm_ai_rag_collections.rag_collection_id%type | The ID of the RAG collection to process |
p_limit | in | number default null | Max number of files per run (defaults to AI_CHUNK_FILE_LIMIT) |
process_text_extraction_jobs
Section titled “process_text_extraction_jobs”Processes queued TEXT_EXTRACTION jobs: sends each file to the collection’s configured LLM (llm_text_extraction) via adm_ai_rag_extract_api and stores the result in adm_document_versions.index_content. Bounded retries via the job queue; failures never fall back to the built-in extractor. No-op unless a collection uses llm_text_extraction and AI_TEXT_EXTRACTION is enabled.
Signature:
procedure process_text_extraction_jobs ( p_collection_id in adm_ai_rag_collections.rag_collection_id%type default null, p_limit in number default null);Parameters:
| Name | Direction | Type | Description |
|---|---|---|---|
p_collection_id | in | adm_ai_rag_collections.rag_collection_id%type default null | Restrict to one collection (null = all) |
p_limit | in | number default null | Max jobs per run (defaults to AI_CHUNK_FILE_LIMIT) |
pending_work_count
Section titled “pending_work_count”How much work one stage of the pipeline has waiting: queue jobs of one type that are still inside their attempt budget, files awaiting built-in text extraction, or files awaiting chunking.
Answers the same question as each stage’s own driving query, and lives here so that there is one definition of “eligible” rather than one per caller. ADM_AI_RAG_QUEUE_JOB uses it to decide whether another batch is worth starting and whether the last one got anywhere; it is equally useful for a monitoring query on queue lag.
Signature:
function pending_work_count ( p_stage in varchar2, p_collection_id in adm_ai_rag_collections.rag_collection_id%type default null) return number;Parameters:
| Name | Direction | Type | Description |
|---|---|---|---|
p_stage | in | varchar2 | One of the c_stage_* constants |
p_collection_id | in | adm_ai_rag_collections.rag_collection_id%type default null | Restrict to one collection (null = all), and required for the two file-driven stages, which always run against one collection |
Returns: number - Number of units of work waiting; 0 when the stage has nothing to do
process_remove_jobs
Section titled “process_remove_jobs”Processes queued REMOVE jobs: deletes the vectors of files that have left a collection from the collection’s vector store (Qdrant or the native Oracle store) and their rows from adm_ai_rag_chunks. The adm_ai_rag_collection_files row is left at is_active = ‘N’.
Searches already ignore inactive files, so this is about the store not growing forever - and about the queue, where REMOVE jobs used to sit at PENDING with nothing to consume them.
Signature:
procedure process_remove_jobs ( p_collection_id in adm_ai_rag_collections.rag_collection_id%type default null, p_limit in number default null);Parameters:
| Name | Direction | Type | Description |
|---|---|---|---|
p_collection_id | in | adm_ai_rag_collections.rag_collection_id%type default null | Restrict to one collection (null = all) |
p_limit | in | number default null | Max jobs per run (defaults to AI_CHUNK_FILE_LIMIT) |