Skip to main content

mistral plugin for embcli

Project description

embcli-mistral

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

Reference

Installation

pip install embcli-mistral

Quick Start

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

cat .env
MISTRAL_API_KEY=<YOUR_MISTRAL_KEY>

Try out the Embedding Models

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

# list all available models.
emb models
MistralEmbeddingModel
    Vendor: mistral
    Models:
    * mistral-embed (aliases: )
    Model Options:

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

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

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 mistral-embed -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 mistral-embed -c catcafe -f <path-to-your-documents>

# search for a query in the indexed documents.
emb search -m mistral-embed -c catcafe -q "Who's the naughtiest one?"
Found 5 results:
Score: 0.6517009284006381, Document ID: 76, Text: Frankie: Frankie is a boisterous and playful cat, full of charm and mischief. He loves to zoom around the house and engage in energetic play sessions, especially with crinkly toys. Frankie is also very affectionate, often seeking out his humans for cuddles and purrs after his bursts of energy, a fun-loving friend.
Score: 0.6514949046818957, 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.6456183753007453, Document ID: 20, Text: Pepper: Pepper is a feisty and energetic grey tabby with a spicy personality. She is quick-witted and loves to engage in playful stalking and pouncing games. Pepper is also fiercely independent but will show her affection with sudden bursts of purring and head-butts, keeping her humans on their toes.
Score: 0.645051423128062, Document ID: 97, Text: Alfie: Alfie is a cheerful and mischievous little cat, always getting into playful trouble with a charming innocence. He loves exploring small spaces and batting at dangling objects. Alfie is incredibly affectionate, quick to purr and eager for cuddles, a delightful bundle of joy and entertainment for his humans.
Score: 0.6441489894320535, Document ID: 40, Text: Jack: Jack is a charming and roguish cat, often a black and white tuxedo, full of personality. He is clever and resourceful, always finding new ways to entertain himself. Jack enjoys playful interactions and can be quite vocal, always ready with a friendly meow or a playful swat at a toy.

Development

See the main README for general development instructions.

Run Tests

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

MISTRAL_API_KEY=<YOUR_MISTRAL_KEY> RUN_MISTRAL_TESTS=1 uv run --package embcli-mistral pytest packages/embcli-mistral/tests/

Run Linter and Formatter

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

Run Type Checker

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

Build

uv build --package embcli-mistral

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_mistral-0.0.5.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

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

embcli_mistral-0.0.5-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for embcli_mistral-0.0.5.tar.gz
Algorithm Hash digest
SHA256 d6f268f18965a467ac09b88e47d430549874b9730a3612a4ad18fa6a6a0dbef0
MD5 8e65c45bf22f4ee1bbbf7b92d6b85582
BLAKE2b-256 ec6df460b9fba8a864cdc499f191d3f741ed071bc5950585996069ce364085c6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for embcli_mistral-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 a670b2cdc083000c07e7fdaf07e83f77b1ddc2465a8e55055b679f005335ba96
MD5 eccaa2ee38ef4958e57251629812a1e0
BLAKE2b-256 da0fa89b37ff2f7ca3df8128322024b40e9ec4c9e2bbae42db1b5a63d9541aa1

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