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

File metadata

File hashes

Hashes for llama_index_embeddings_oci_data_science-0.2.1.tar.gz
Algorithm Hash digest
SHA256 0d634f1e96720d6f731f28a9f6f0b222f8dbe53bdd0478cd028250b0303bf03f
MD5 1250def67a3f27476694c4b7db71b573
BLAKE2b-256 5214bafd064a198a20c84a318ff41a385487b159393b80b9851945097a026cb1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llama_index_embeddings_oci_data_science-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dc9d422acf6a0f01bbeb9847fb108fd51ed8a5fc198c47aef80d723f5282a400
MD5 f3b20d3eef0f27070e66c6d6626a85c4
BLAKE2b-256 5854e02532d95c1481b17719718cf6a9807eaa6d6b842a64d2eeb0e2c7f710c6

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