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

Uploaded Python 3

File details

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

File metadata

  • Download URL: muopdb_python_client-0.0.7.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.7.tar.gz
Algorithm Hash digest
SHA256 f1d85835f69f319f0ca3e8b6fdbe00ed321ca8b9bbaf0407129f1ae2e2ff7424
MD5 49741dea60e59899039ac28116d4c977
BLAKE2b-256 65d7f0935c0719b36377aafb61a9d398dee327c1422b9c45a95ea1de8c9eb31a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for muopdb_python_client-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 5918fd4004f0fef6948d3c1feec40d22896dedfd27dd6598276f670798915712
MD5 3b027e8c8722bb57c92550644b43b7f5
BLAKE2b-256 0fbe487702e461f91751a5df3428c6574186a5f79f9847d8825853b46dde1147

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