CREATE_VOCABULARY

Use the DBMS_VECTOR_CHAIN.CREATE_VOCABULARY chunker helper procedure to load your own token vocabulary file into the database.

Purpose

To create custom token vocabulary that is recognized by the tokenizer used by your vector embedding model.

A vocabulary contains a set of tokens (words and word pieces) that are collected during a model’s statistical training process. You can supply this data to the chunker to help in accurately selecting the text size that approximates the maximum input limit imposed by the tokenizer of your embedding model.

Usage Notes

Syntax

DBMS_VECTOR_CHAIN.CREATE_VOCABULARY(
    PARAMS      IN JSON default NULL
);

PARAMS

Specify the input parameters in JSON format:

{
    table_name,
    column_name,
    vocabulary_name,
    format,
    cased
}

Table 22 Parameter Details

Parameter Description Required Default Value
table_name Name of the table (along with the optional table owner) in which you want to load the vocabulary file Yes No value
column_name Column name in the vocabulary table in which you want to load the vocabulary file Yes No value
vocabulary_name User-specified name of the vocabulary, along with the optional owner name (if other than the current owner) Yes No value
format
  • xlm for SentencePiece tokenization

  • bert for WordPiece tokenization

  • gpt2 for BPE tokenization

Yes No value
cased Character-casing of the vocabulary, that is, vocabulary to be treated as cased or uncased No false

Example

DECLARE
  params clob := '{"table_name"       : "doc_vocabtab",
                   "column_name"      : "token",
                   "vocabulary_name"  : "doc_vocab",
                   "format"           : "bert",
                   "cased"            : false}';

BEGIN
  dbms_vector_chain.create_vocabulary(json(params));
END;
/

End-to-end example:

To run an end-to-end example scenario using this procedure, see Create and Use Custom Vocabulary.

Related Topics