3tears-models


توضیحات

LangChain-native AI model factories with capability metadata, circuit breakers, and usage tracking for the 3tears platform
ویژگی مقدار
سیستم عامل -
نام فایل 3tears-models-0.89.0
نام 3tears-models
نسخه کتابخانه 0.89.0
نگهدارنده []
ایمیل نگهدارنده []
نویسنده pace
ایمیل نویسنده -
آدرس صفحه اصلی -
آدرس اینترنتی https://pypi.org/project/3tears-models/
مجوز -
# 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. ```bash 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), and clients for self-hosted ComfyUI and SwarmUI servers (`ComfyUIClient`, `SwarmUIClient`: your own graph or parameters, reads retried, work never sent twice). - **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. The factory's default breaker is per provider and per API key, so one caller's failing key never fast-fails another key on the same provider. - **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 ```python 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](LICENSE).


نیازمندی

مقدار نام
- 3tears-media-contracts<0.90.0,>=0.89.0
- 3tears-observe<0.90.0,>=0.89.0
- 3tears-tool-schema<0.90.0,>=0.89.0
- anthropic>=0.116
- jsonschema>=4.26
- langchain-anthropic>=1.4
- langchain-core>=0.3
- langchain-openai>=1.1
- langchain-openrouter>=0.2.9
- openrouter<1.0,>=0.9.2
- pydantic>=2.0
- uuid-utils
xtr 3tears-langgraph<0.90.0,>=0.89.0;
xtr anyio>=4.0;
xtr claude-agent-sdk<0.3,>=0.2.163;
xtr langchain-claude-code>=0.1.0;
xtr mcp<3,>=1.27;
xtr httpx>=0.27;
xtr prometheus-client>=0.20;
xtr opentelemetry-api<2,>=1.20;
xtr langchain-voyageai>=0.3;
xtr httpx>=0.27;


زبان مورد نیاز

مقدار نام
>=3.14 Python


نحوه نصب


نصب پکیج whl 3tears-models-0.89.0:

    pip install 3tears-models.whl


نصب پکیج tar.gz 3tears-models-0.89.0:

    pip install 3tears-models.tar.gz