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.14.0.tar.gz (131.6 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.14.0-py3-none-any.whl (90.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: 3tears_models-0.14.0.tar.gz
  • Upload date:
  • Size: 131.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.1 {"installer":{"name":"uv","version":"0.11.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for 3tears_models-0.14.0.tar.gz
Algorithm Hash digest
SHA256 85fa1c15f1280c43db9209496fc5798d379bc7aa77e21e8f0b9853f77905578b
MD5 64265fe81ed76d648ba7184b6f9e1626
BLAKE2b-256 597cf42ba6a0558d68946e60f17d1da013717cfab34e281c7f36ca64daf8c5a2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: 3tears_models-0.14.0-py3-none-any.whl
  • Upload date:
  • Size: 90.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.1 {"installer":{"name":"uv","version":"0.11.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for 3tears_models-0.14.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4265f32087da999a13b715f65727abab8212f1bbad3d08076f3f2ad54f1cb154
MD5 32eeeb4dc4aee9d0533f6270f0d376a2
BLAKE2b-256 3bf68543d225dae3e38777dabbddc704fb8ec5d0667efcd560cf6608d8cc383c

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