Skip to main content

llama-index embeddings OCI Data Science integration

Project description

LlamaIndex Embeddings Integration: Oracle Cloud Infrastructure (OCI) Data Science Service

Oracle Cloud Infrastructure (OCI) Data Science is a fully managed, serverless platform for data science teams to build, train, and manage machine learning models in Oracle Cloud Infrastructure.

It offers AI Quick Actions, which can be used to deploy embedding models in OCI Data Science. AI Quick Actions target users who want to quickly leverage the capabilities of AI. They aim to expand the reach of foundation models to a broader set of users by providing a streamlined, code-free, and efficient environment for working with foundation models. AI Quick Actions can be accessed from the Data Science Notebook.

Detailed documentation on how to deploy embedding models in OCI Data Science using AI Quick Actions is available here and here.

Installation

Install the required packages:

pip install oracle-ads llama-index-core llama-index-embeddings-oci-data-science

The oracle-ads is required to simplify the authentication within OCI Data Science.

Authentication

The authentication methods supported for LlamaIndex are equivalent to those used with other OCI services and follow the standard SDK authentication methods, specifically API Key, session token, instance principal, and resource principal. More details can be found here. Make sure to have the required policies to access the OCI Data Science Model Deployment endpoint.

Usage

import ads
from llama_index.embeddings.oci_data_science import OCIDataScienceEmbedding

ads.set_auth(auth="security_token", profile="<replace-with-your-profile>")

embedding = OCIDataScienceEmbedding(
    endpoint="https://<MD_OCID>/predict",
)

e1 = embeddings.get_text_embedding("This is a test document")
print(e1)

e2 = embeddings.get_text_embedding_batch([
        "This is a test document",
        "This is another test document"
    ])
print(e2)

Async

import ads
from llama_index.embeddings.oci_data_science import OCIDataScienceEmbedding

ads.set_auth(auth="security_token", profile="<replace-with-your-profile>")

embedding = OCIDataScienceEmbedding(
    endpoint="https://<MD_OCID>/predict",
)

e1 = await embeddings.aget_text_embedding("This is a test document")
print(e1)

e2 = await embeddings.aget_text_embedding_batch([
        "This is a test document",
        "This is another test document"
    ])
print(e2)

More examples

https://docs.llamaindex.ai/en/stable/examples/embeddings/oci_data_science/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file llama_index_embeddings_oci_data_science-0.2.0.tar.gz.

File metadata

File hashes

Hashes for llama_index_embeddings_oci_data_science-0.2.0.tar.gz
Algorithm Hash digest
SHA256 a3c28a7b26a949f04beea634c48e48909e7e192fd760ffcf20318dd922cac24b
MD5 5934d039fbec43c325d2f6157e68c89d
BLAKE2b-256 fe15359ffec2b8136c47bab768cf0a9a89108c1bd62ffa0163bfce4c2c7c23d5

See more details on using hashes here.

File details

Details for the file llama_index_embeddings_oci_data_science-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_embeddings_oci_data_science-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a14af0920d56c0ee91d663839888d82d1bbdb7301a5b88afc64ccfa4347b564e
MD5 86b4bf98015fa7593346bf9069d5bc6a
BLAKE2b-256 e16614b02d1e8d7bcce0c6a0672e29739a41a91a65e674831633b05a566ec116

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page