Skip to main content

DigitalOcean AI embeddings integration for LlamaIndex.

Project description

DigitalOcean Embeddings for LlamaIndex

This package provides a DigitalOceanEmbeddings implementation for LlamaIndex that calls DigitalOcean AI embeddings endpoints.

Quickstart

  1. Install:

    pip install llama-index-digitalocean-embeddings
    
  2. Set environment variable:

    • DIGITALOCEAN_TOKEN: DigitalOcean Personal Access Token with AI access.

    • Getting a DigitalOcean token

      Your DIGITALOCEAN_TOKEN is a Personal Access Token you create in the DigitalOcean Control Panel:

      a. Log in to https://cloud.digitalocean.com. b. Go to Settings → API → Personal Access Tokens. c. Click Generate New Token, choose the scopes you need (for embeddings, typically CRUD for GenAI and read for project), give the token a name, and click Generate. d. Copy the token and set it in your shell:

      export DIGITALOCEAN_TOKEN=your_token_here
      

      For more detailed, step‑by‑step guidance, see the official DigitalOcean documentation.

  3. Use:

    import os
    from llama_index.digitalocean.embeddings import DigitalOceanEmbeddings
    from llama_index.core import VectorStoreIndex, Document
    
    # Read your token however you like (for example from an env var) and
    # pass it explicitly to the embedding class:
    token = os.environ["DIGITALOCEAN_TOKEN"]
    
    embed_model = DigitalOceanEmbeddings(model="text-embedding-3-small", api_token=token)
    docs = [Document(text="Hello from DigitalOcean")]
    index = VectorStoreIndex.from_documents(docs, embed_model=embed_model)
    print(index.as_query_engine().query("What was the greeting?"))
    

Configuration

  • model: Embedding model name (e.g., text-embedding-3-small, text-embedding-3-large).
  • api_token: DIGITALOCEAN_TOKEN.

License

Apache-2.0.

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

llama_index_digitalocean_embeddings-0.1.7.tar.gz (12.6 kB view details)

Uploaded Source

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_digitalocean_embeddings-0.1.7.tar.gz.

File metadata

File hashes

Hashes for llama_index_digitalocean_embeddings-0.1.7.tar.gz
Algorithm Hash digest
SHA256 89a1c08d270b143f9381a1fcd1ddca84435046c3e396274447bc3e835069ae04
MD5 fee65e2c223334a789b641ff6eba3980
BLAKE2b-256 a24e3eb4a4e3a6efe565be4bf47a89d164db7541225509157e07b985a5d29f80

See more details on using hashes here.

File details

Details for the file llama_index_digitalocean_embeddings-0.1.7-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_digitalocean_embeddings-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 957cac74d4863881dba89a7207d38f6c47222e333ad89d1ad2891d1ea887c64d
MD5 9bb29f34449d837709b56efda02d9555
BLAKE2b-256 8ef73d9632fee165797284a1285dbea3fab69c6f631e1fbe3e76c1525cfb960b

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