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 Distribution

muopdb_python_client-0.0.9.tar.gz (15.9 kB view details)

Uploaded Source

Built Distribution

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

muopdb_python_client-0.0.9-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

Details for the file muopdb_python_client-0.0.9.tar.gz.

File metadata

  • Download URL: muopdb_python_client-0.0.9.tar.gz
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for muopdb_python_client-0.0.9.tar.gz
Algorithm Hash digest
SHA256 77e1dab4e3d66bb96436257128712335333a9e7282bc082c89a6ea5497573194
MD5 64488de1f61604edd491e8748c52f87e
BLAKE2b-256 2d8730fa5eee424987c2e1ff2fb0960ed744ec627050536739ad8bbfbf67f1c0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for muopdb_python_client-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 672ff6a4ecea8d7eaa1af465ca87e5a1ae0d3f0a155485b16404bd4f9b1972f9
MD5 0c0ac1873ea710192064f8d59791de78
BLAKE2b-256 5971fbef9e089fd0bf10f38bcee86ea7f09cffc664ba6f4b6f790c9a367fee9a

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