Class OracleEmbeddingModel
java.lang.Object
dev.langchain4j.model.embedding.DimensionAwareEmbeddingModel
dev.langchain4j.model.oracle.OracleEmbeddingModel
- All Implemented Interfaces:
EmbeddingModel
Embed documents
Use dbms_vector_chain.utl_to_embeddings to get embeddings.
You can specify which provider to use such as an ONNX model
or a third-party provider via a REST call.
Some example preferences
To use an ONNX model:
{
"provider": "database",
"model": "database"
}
To use a third-party provider:
{
"provider": "ocigenai",
"credential_name": "OCI_CRED",
"url": "https://inference.generativeai.us-chicago-1.oci.oraclecloud.com/20231130/actions/embedText",
"model": "cohere.embed-english-light-v3.0"
}
-
Field Summary
Fields inherited from class DimensionAwareEmbeddingModel
dimension
-
Constructor Summary
ConstructorsConstructorDescriptionOracleEmbeddingModel
(Connection conn, String pref) Create an embedding modelOracleEmbeddingModel
(Connection conn, String pref, String proxy) Create an embedding model with a proxy -
Method Summary
Modifier and TypeMethodDescriptionembedAll
(List<TextSegment> textSegments) get embeddings for a list of text segmentsboolean
static boolean
loadOnnxModel
(Connection conn, String dir, String onnxFile, String modelName) load an ONNX model located on the server into the databasevoid
setBatching
(boolean batching) Methods inherited from class DimensionAwareEmbeddingModel
dimension, knownDimension
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface EmbeddingModel
embed, embed
-
Constructor Details
-
OracleEmbeddingModel
Create an embedding model -
OracleEmbeddingModel
Create an embedding model with a proxy
-
-
Method Details
-
setBatching
public void setBatching(boolean batching) -
getBatching
public boolean getBatching() -
loadOnnxModel
public static boolean loadOnnxModel(Connection conn, String dir, String onnxFile, String modelName) throws SQLException load an ONNX model located on the server into the database- Parameters:
conn
- connectiondir
- directory alias from create directoryonnxFile
- ONNX filemodelName
- model name- Throws:
SQLException
-
embedAll
get embeddings for a list of text segments- Parameters:
textSegments
- the text segments to embed.- Returns:
- the embeddings.
-