Skip to content

adm_ai_rag_workflow_api

This document contains the API documentation for the adm_ai_rag_workflow_api package.

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:

NameDirectionTypeDescription
p_collection_idinadm_ai_rag_collections.rag_collection_id%typeThe ID of the RAG collection to synchronize

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:

NameDirectionTypeDescription
p_collection_idinadm_ai_rag_collections.rag_collection_id%typeThe ID of the RAG collection to process
p_limitinnumber default nullMax number of files per run (defaults to AI_CHUNK_FILE_LIMIT)

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:

NameDirectionTypeDescription
p_collection_idinadm_ai_rag_collections.rag_collection_id%type default nullRestrict to one collection (null = all)
p_limitinnumber default nullMax jobs per run (defaults to AI_CHUNK_FILE_LIMIT)

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:

NameDirectionTypeDescription
p_stageinvarchar2One of the c_stage_* constants
p_collection_idinadm_ai_rag_collections.rag_collection_id%type default nullRestrict 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


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:

NameDirectionTypeDescription
p_collection_idinadm_ai_rag_collections.rag_collection_id%type default nullRestrict to one collection (null = all)
p_limitinnumber default nullMax jobs per run (defaults to AI_CHUNK_FILE_LIMIT)