Skip to main content

LangChain-native AI model factories with capability metadata, circuit breakers, and usage tracking for the 3tears platform

Project description

3tears-models

LangChain-native AI model factories for the 3tears framework. Build chat and embedding models from a single call, with capability metadata, circuit breakers, error translation, and usage tracking wired in.

pip install 3tears-models

What you get

  • Factories -- create_chat_model() and create_embedding_model() return standard LangChain BaseChatModel / Embeddings instances. No custom runtime protocols to learn.
  • Providers -- Anthropic, OpenAI, OpenRouter, VoyageAI, Whisper, and image backends (OpenAI Images, HuggingFace, A1111, ModelsLab, ComfyUI).
  • Capability registry -- get_capabilities(), register_capabilities(), and per-model overrides describe context windows, vision support, tool support, and tier.
  • Circuit breakers -- CircuitBreaker and CircuitBreakerRegistry trip on repeated provider failures and recover on a timer.
  • Usage tracking -- UsageTracker.record() emits an OpenTelemetry span plus Prometheus instruments, with optional per-application audit and counter sinks.
  • Message hygiene -- preprocess_messages(), enforce_alternating_roles(), filter_invalid_tool_calls(), and streaming chunk helpers (parse_chunk, merge_chunks).

Quickstart

from threetears.models import create_chat_model, create_embedding_model

chat = create_chat_model("claude-sonnet-4-6")
reply = await chat.ainvoke("Summarize three-tier caching in one sentence.")

embedder = create_embedding_model("voyage-3")
vectors = await embedder.aembed_documents(["first doc", "second doc"])

Capabilities, circuit breakers, and usage tracking attach automatically. Reach for the registry and tracker APIs directly when you need to inspect or override them.

License

MIT. See LICENSE.

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

3tears_models-0.17.4.tar.gz (152.1 kB view details)

Uploaded Source

Built Distribution

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

3tears_models-0.17.4-py3-none-any.whl (97.3 kB view details)

Uploaded Python 3

File details

Details for the file 3tears_models-0.17.4.tar.gz.

File metadata

  • Download URL: 3tears_models-0.17.4.tar.gz
  • Upload date:
  • Size: 152.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for 3tears_models-0.17.4.tar.gz
Algorithm Hash digest
SHA256 f33bd8a50e09fafadfabade1c6e4403557e0ad22c2ef288bff390cd6529fe93e
MD5 a0a7240d98a7d7307b3f165c99395167
BLAKE2b-256 4b7dd58ab17fbdbbf5582c950b26199a9707a7abec86ed7dfdebb3a9036f5de3

See more details on using hashes here.

Provenance

The following attestation bundles were made for 3tears_models-0.17.4.tar.gz:

Publisher: release.yml on pacepace/3tears

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file 3tears_models-0.17.4-py3-none-any.whl.

File metadata

  • Download URL: 3tears_models-0.17.4-py3-none-any.whl
  • Upload date:
  • Size: 97.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for 3tears_models-0.17.4-py3-none-any.whl
Algorithm Hash digest
SHA256 0a67ff2cb92505ca12a334d3b4e142af17d0ed287c4a5db918f0a2580ab195b2
MD5 6269364bd98cda4daad7e4c917c8c05e
BLAKE2b-256 1a40a0ace3c4b0a370d78638a067939c2edb57db4bfb68dd6abff4c0899f42d8

See more details on using hashes here.

Provenance

The following attestation bundles were made for 3tears_models-0.17.4-py3-none-any.whl:

Publisher: release.yml on pacepace/3tears

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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