Convert Text String to Embedding Within and Outside Oracle Database
Perform a text-to-embedding transformation by accessing either a vector embedding model in ONNX format (stored in the database) or a third-party vector embedding model.
You can vectorize text strings like this for chatbots or information-retrieval applications, where you want to convert a user's input text string to a query vector on the fly and then query a vector index with this query vector for a fast similarity search.
Determine which API to use:
-
If you want to access a third-party embedding model, then you can use the
UTL_TO_EMBEDDING
PL/SQL API (note the singular "embedding") from either theDBMS_VECTOR
orDBMS_VECTOR_CHAIN
package.This scenario uses the
DBMS_VECTOR.UTL_TO_EMBEDDING
API. -
If you are accessing an embedding model in ONNX format that you have loaded into the database, then you can use both
VECTOR_EMBEDDING
andUTL_TO_EMBEDDING
.
Both UTL_TO_EMBEDDING
and VECTOR_EMBEDDING
directly return a VECTOR
type (not an array).
WARNING:
Certain features of the database may allow you to access services offered separately by third-parties, for example, through the use of JSON specifications that facilitate your access to REST APIs.
Your use of these features is solely at your own risk, and you are solely responsible for complying with any terms and conditions related to use of any such third-party services. Notwithstanding any other terms and conditions related to the third-party services, your use of such database features constitutes your acceptance of that risk and express exclusion of Oracle's responsibility or liability for any damages resulting from such access.
hello
" as the input:
Related Topics
Parent topic: Generate Embeddings: SQL and PL/SQL Examples