SDKs
Available

Python

Install the loams package, make the first call, and run a hybrid query from Python.

One Loams object over one Loams instance, speaking the unified Connect API through connectrpc. Pin loams~=0.1.0 to stay on the 0.1 line.

Examples: github.com/ostrium-labs/loams-python · Source: sdks/python

Install

pip install loams

Quickstart

import os
from loams import Loams

loams = Loams(
    os.environ.get("LOAMS_ENDPOINT", "http://127.0.0.1:8080"),
    api_key=os.environ.get("LOAMS_API_KEY"),
)
print(loams.instance.version())

Four modules hang off the client: loams.instance, loams.live (whose package is unstable), loams.tables and loams.system.

  • Auth. Pass api_key for a script or CI job; it does not expire. Pass auth for everything else: env_token(), oidc_exchange() or your own TokenSource. Passing both raises.
  • Protocol. protocol is "connect" (default), "grpc" or "grpc-web". proto_json=True sends the proto3 JSON that curl sends; the default is protobuf.
  • Consistency. session_consistency=False by default, so every read is strong on its own. Set it to True to hold a session consistency token across calls.

Hybrid search from Python

The hybrid query builder and bulk ingest are not in the SDK yet; it refuses them by name. Call the REST API directly:

import json, urllib.request

body = {
    "from": "collections.kb",
    "retrieve": [
        {"vector": {"field": "embedding", "query": [1.0, 0.0, 0.0], "k": 10}},
        {"text": {"field": "body", "query": "refund", "k": 10}},
    ],
    "filter": {"term": {"tenant": "a"}},
    "fuse": {"method": "rrf", "k": 60},
    "limit": 3,
}
req = urllib.request.Request(
    "http://127.0.0.1:8080/v1/namespaces/demo/query",
    data=json.dumps(body).encode(), headers={"content-type": "application/json"},
)
print(json.load(urllib.request.urlopen(req)))

For SQL with Arrow results, use Flight SQL through ADBC; the SDK's flight, arrow and polars extras exist for the bulk paths that land next.

Development

uv sync --all-extras --dev     # from sdks/python
uv run pytest -q

On this page