Skip to main content

voyage plugin for embcli

Project description

embcli-voyage

voyage plugin for embcli, a command-line interface for embeddings.

Reference

Installation

pip install embcli-voyage

Quick Start

You need VoyageAI API key to use this plugin. Set VOYAGE_API_KEY environment variable in .env file in the current directory. Or you can give the env file path by -e option.

cat .env
VOYAGE_API_KEY=<YOUR_VOYAGE_KEY>

Try out the Embedding Models

# show general usage of emb command.
emb --help

# list all available models.
emb models
VoyageEmbeddingModel
    Vendor: voyage
    Models:
    * voyage-3-large (aliases: )
    * voyage-3 (aliases: )
    * voyage-3-lite (aliases: )
    * voyage-code-3 (aliases: )
    * voyage-finance-2 (aliases: )
    * voyage-law-2 (aliases: )
    * voyage-code-2 (aliases: )
    Model Options:
    * input_type (str) - Type of the input text. Options: 'None', 'query', 'document' Defaults to 'None'.
    * truncation (bool) - Whether to truncate the input texts to fit within the context length. Defaults to True.
    * output_dimension (int) - The number of dimensions for resulting output embeddings.

# get an embedding for an input text by voyage-3 model.
emb embed -m voyage-3 "Embeddings are essential for semantic search and RAG apps."

# get an embedding for an input text by voyage-3 model with input_type=query.
emb embed -m voyage-3 "Embeddings are essential for semantic search and RAG apps." -o input_type query

# calculate similarity score between two texts by voyage-3 model. the default metric is cosine similarity.
emb simscore -m voyage-3 "The cat drifts toward sleep." "Sleep dances in the cat's eyes."
0.7499687978192594

Document Indexing and Search

You can use the emb command to index documents and perform semantic search. emb uses chroma for the default vector database.

# index example documents in the current directory.
emb ingest-sample -m voyage-3 -c catcafe --corpus cat-names

# or, you can give the path to your documents.
# the documents should be in a CSV file with two columns: id and text. the separator should be comma.
emb ingest -m voyage-3 -c catcafe -f <path-to-your-documents>

# search for a query in the indexed documents.
emb search -m voyage-3 -c catcafe -q "Who's the naughtiest one?"
Found 5 results:
Score: 0.41797321996324216, Document ID: 28, Text: Loki: Loki is a mischievous and clever cat, always finding new ways to entertain himself, sometimes at his humans' expense. He is a master of stealth and surprise attacks on toys. Despite his playful trickery, Loki is incredibly charming and affectionate, easily winning hearts with his roguish appeal.
Score: 0.41704222853043194, Document ID: 46, Text: Bandit: Bandit is a mischievous cat, often with mask-like markings, always on the lookout for his next playful heist of a toy or treat. He is clever and energetic, loving to chase and pounce. Despite his roguish name, Bandit is a loving companion who enjoys a good cuddle after his adventures.
Score: 0.4138587234705962, Document ID: 3, Text: Pippin (Pip): Pippin, or Pip, is a compact dynamo, brimming with mischievous charm and boundless curiosity. He’s an intrepid explorer, always finding new hideouts or investigating forbidden territories with a twinkle in his eye. Quite vocal, Pip will happily chat about his day, his playful antics making him an endearing little rascal.
Score: 0.4102669442076908, Document ID: 66, Text: Vinnie: Vinnie is a cool and confident cat, often a street-smart tabby with a lot of personality. He is resourceful and independent but also enjoys affection from his trusted humans. Vinnie is a survivor with a soft side, offering gruff purrs and head-butts, a charming rogue with a heart of gold.
Score: 0.407675485063674, Document ID: 94, Text: Xena: Xena is a warrior princess of a cat, bold, adventurous, and fiercely protective of her territory and toys. She is highly energetic and loves vigorous play, often surprising with her agility. Despite her tough exterior, Xena is deeply loyal and affectionate to her trusted human companions.

Development

See the main README for general development instructions.

Run Tests

You need to have a Voyage API key to run the tests for the embcli-voyage package. You can set it up as an environment variable:

VOYAGE_API_KEY=<YOUR_VOYAGE_KEY> RUN_VOYAGE_TESTS=1 uv run --package embcli-voyage pytest packages/embcli-voyage/tests/

Run Linter and Formatter

uv run ruff check --fix packages/embcli-voyage
uv run ruff format packages/embcli-voyage

Run Type Checker

uv run --package embcli-voyage pyright packages/embcli-voyage

Build

uv build --package embcli-voyage

License

Apache License 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

embcli_voyage-0.0.5.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

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

embcli_voyage-0.0.5-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file embcli_voyage-0.0.5.tar.gz.

File metadata

  • Download URL: embcli_voyage-0.0.5.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.3

File hashes

Hashes for embcli_voyage-0.0.5.tar.gz
Algorithm Hash digest
SHA256 982bded15419aca4141ea887c7e325bbecf9a98a0a50a4e76c3b88defcfbbfc1
MD5 f3c33b6d1a97ec32f7cde39cd5c38ae3
BLAKE2b-256 6e5701ea9b1606aede4845d744647145080d81500fb880b621d7e1ca70c62e59

See more details on using hashes here.

File details

Details for the file embcli_voyage-0.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for embcli_voyage-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 1142d1e1955cd391c27bf328bb41b69fb32df31aaaf179622b7130a8cb2c6bee
MD5 7346879069579a27239c65ac1df2a770
BLAKE2b-256 8d73c63bfe029ee34619d318e6eddb7ad2c72d7534fa20b040f2aa2e16e3948c

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