Skip to main content

Python client for MuopDB

Project description

MuopDB Python Client

Installation

First, install the dependencies:

pip install -r requirements.txt

Usage

This is a Python client for muopDB.

To generate Python code from proto files to support gRPC protocol:

python -m grpc_tools.protoc \
  --proto_path=muopdb_python_client/protos \
  --python_out=muopdb_python_client/protos \
  --grpc_python_out=muopdb_python_client/protos \
  muopdb.proto

Then run the following command to patch the import errors in the generated files:

sed -i '' 's/^import muopdb_pb2/from . import muopdb_pb2/' muopdb_python_client/protos/muopdb_pb2_grpc.py

Testing

To run the tests:

  • Unit tests:
pytest -v -s --cov=muopdb_python_client tests/unit
  • Integration tests:
pytest -v -s --cov=muopdb_python_client tests/integration

Grpc Debugging

Check the available grpc services and methods from a specific grpc server (e.g. localhost:9002) using grpcurl:

brew install grpcurl
grpcurl -plaintext localhost:9002 list

To view the grpc services and methods in a GUI:

brew install grpcui
grpcui -plaintext localhost:9002

References:

Vectorizer Usage

The MuopDB Python client supports multiple embedding providers out of the box. You can select which provider to use by setting environment variables appropriately. Below is a quick reference on how to configure each provider.

1. Supported Providers

  • OpenAI
  • Gemini (Google GenAI)
  • Claude (via voyageai client)
  • Ollama (Local LLM embeddings, e.g., ollama or fallback via HTTP)

2. Environment Variables

  1. VECTOR_SERVICE
    • Description: Chooses which provider to use.
    • Allowed values: openai, gemini, claude, ollama.
    • Default: openai.
    • Example:
      export VECTOR_SERVICE=gemini
      
  2. API Keys
    • OpenAI: OPENAI_API_KEY
      • Typically looks like sk-...
    • Gemini: GEMINI_API_KEY
    • Claude: CLAUDE_API_KEY
      • If you’re using voyageai, set VOYAGE_API_KEY (some distributions also require CLAUDE_API_KEY).
    • Ollama: OLLAMA_API_KEY
      • May not be strictly required if running Ollama locally without authentication.

Example (bash):

export VECTOR_SERVICE=openai
export OPENAI_API_KEY="sk-1234..."

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

muopdb_python_client-0.0.5-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for muopdb_python_client-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 8f02af7487034c6ca6bf5adff45061076aa49090a094a26dc84773e570546a3c
MD5 b0c7bc832221c30a79be4d9a2161c670
BLAKE2b-256 a97c2a92a589cbc37debdcf83d0a547e5a70752e5b66d059185eb9ac8b03e2e0

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