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.6.tar.gz (13.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.6-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: muopdb_python_client-0.0.6.tar.gz
  • Upload date:
  • Size: 13.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.6.tar.gz
Algorithm Hash digest
SHA256 d899b7844e765fab1aedbac1d7ef44848db709754688db96a379dd0bb22ec1fe
MD5 d165fc0b7bfa1f1224da5d7126ac8160
BLAKE2b-256 5b111d890280722f24162f825ad50cfc4fdc42a044415341b15ee7d6294897a5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for muopdb_python_client-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 12b81abf607bc53870246df14f534b2f135f2bceb5f76d73dc04dc98faced6aa
MD5 706b3a7b0067f6ab700ece95e82275ad
BLAKE2b-256 2c6f6c21a87bac37eeb6e052cc4c3d37fc504792c3d946ae5e599293bc8cf205

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