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.1.tar.gz (9.6 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.1-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: muopdb_python_client-0.0.1.tar.gz
  • Upload date:
  • Size: 9.6 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.1.tar.gz
Algorithm Hash digest
SHA256 6cfb676ba4db174dc53fe73b336b4c17e2979d35ce29131762a2454602ea15d4
MD5 026c8d93a4b26c9c7d566d870840db01
BLAKE2b-256 942a52be7a5f57d82a3d076eb7c3f928f4b8a56c6315a2870c89e3e01f555fbe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for muopdb_python_client-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 401352f36f5ff4f24ae1b42e08d261bb2175ebac435f79f5d9a731868525db49
MD5 1581143ed731b936d796ea66b45fc456
BLAKE2b-256 7ebb4667c24596d64ca59b74049f9bbc7ee88908538857d646063b10736dad33

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