Shared utilities for the NthLayer ecosystem
Project description
nthlayer-common
Shared utilities for the NthLayer ecosystem. Model-agnostic LLM interface — one function, any provider.
Install
pip install nthlayer-common
Usage
from nthlayer_common import llm_call
result = llm_call(
system="You are a triage agent...",
user="Evaluate this incident...",
)
print(result.text)
Provider support
Two API formats cover the entire market:
| Provider | Model format | API |
|---|---|---|
| Anthropic | anthropic/claude-sonnet-4-20250514 |
Messages API |
| OpenAI | openai/gpt-4o |
Chat Completions |
| Ollama | ollama/llama3.1 |
Chat Completions |
| Azure | azure/my-deployment |
Chat Completions |
| Together | together/meta-llama/Llama-3-70b |
Chat Completions |
| Groq | groq/llama-3.1-70b-versatile |
Chat Completions |
| Mistral | mistral/mistral-large-latest |
Chat Completions |
| vLLM | vllm/my-model |
Chat Completions |
| LM Studio | lmstudio/my-model |
Chat Completions |
Configuration
NTHLAYER_MODEL="anthropic/claude-sonnet-4-20250514" # default
NTHLAYER_LLM_TIMEOUT="60" # seconds
ANTHROPIC_API_KEY="sk-ant-..." # for anthropic/* models
OPENAI_API_KEY="sk-..." # for openai/*, together/*, groq/*, etc.
OPENAI_API_BASE="http://localhost:11434/v1" # override endpoint URL
Also includes
strip_markdown_fences(text)— clean LLM response parsingclamp(value, low=0.0, high=1.0)— value clamping utilityLLMResponse— dataclass withtext,model,provider,input_tokens,output_tokensLLMError— structured error withprovider,model,causecontext
No third-party LLM libraries
One dependency: httpx. No LiteLLM, no SDKs. Raw HTTP calls to provider APIs.
License
Apache 2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nthlayer_common-0.1.2.tar.gz.
File metadata
- Download URL: nthlayer_common-0.1.2.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
963190391c6a53d3eeb2c0543d723b5577e5241dd825b4a29e6ea4ceccfd16b3
|
|
| MD5 |
f28a00c5e5e330f944899eb65d9d3ea2
|
|
| BLAKE2b-256 |
6ba5d3087c29c862e10615e0687006e6f699720302ba8f42d35ad6e6fcffdfdf
|
Provenance
The following attestation bundles were made for nthlayer_common-0.1.2.tar.gz:
Publisher:
release.yml on rsionnach/nthlayer-common
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nthlayer_common-0.1.2.tar.gz -
Subject digest:
963190391c6a53d3eeb2c0543d723b5577e5241dd825b4a29e6ea4ceccfd16b3 - Sigstore transparency entry: 1201018607
- Sigstore integration time:
-
Permalink:
rsionnach/nthlayer-common@409d8233844afa9e8df6c3fe21d4a1f1e9041835 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/rsionnach
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@409d8233844afa9e8df6c3fe21d4a1f1e9041835 -
Trigger Event:
release
-
Statement type:
File details
Details for the file nthlayer_common-0.1.2-py3-none-any.whl.
File metadata
- Download URL: nthlayer_common-0.1.2-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
79a50108fd32309c7ffda79dadfaad17c4e803bffe46d370827a681825cb19af
|
|
| MD5 |
2c3fc19d9eac561a9dce98a1576031f1
|
|
| BLAKE2b-256 |
c0fb18330aeb502350732faf8cd9b6e0149268039ea05d73e0403c0dcba88f9e
|
Provenance
The following attestation bundles were made for nthlayer_common-0.1.2-py3-none-any.whl:
Publisher:
release.yml on rsionnach/nthlayer-common
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nthlayer_common-0.1.2-py3-none-any.whl -
Subject digest:
79a50108fd32309c7ffda79dadfaad17c4e803bffe46d370827a681825cb19af - Sigstore transparency entry: 1201018610
- Sigstore integration time:
-
Permalink:
rsionnach/nthlayer-common@409d8233844afa9e8df6c3fe21d4a1f1e9041835 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/rsionnach
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@409d8233844afa9e8df6c3fe21d4a1f1e9041835 -
Trigger Event:
release
-
Statement type: