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.1.0.tar.gz.

File metadata

File hashes

Hashes for llama_index_embeddings_oci_data_science-0.1.0.tar.gz
Algorithm Hash digest
SHA256 614b5ebbf9c8a7faa74c3587271edb1af7b5363bcedcee231701da952147736d
MD5 fb890185f6ff20bd411e1a9d3e551a9f
BLAKE2b-256 851a8c0c915ff85832a5b9f5d9f570956e6b0e314cb84c415429d52b98147d95

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llama_index_embeddings_oci_data_science-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d89c8e1db0ce24bcfd97e90a8c80b330a89e782f8d0572f468d8c2dd7f659535
MD5 46d3f05252d81fb9a020d2c46bfb0611
BLAKE2b-256 c6f990206d28fc87e4b338b2deb453a4746f32574ccaa61c2fe26ff7fc185a6c

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