langchain-duel
This package connects Duel Agents to LangChain.
Duel Agents routes each prompt against multiple models and bills the cheapest
answer that still wins. The proxy is OpenAI wire compatible, so ChatDuel
builds on langchain-openai and just points at the Duel proxy with sensible
defaults.
Installation
pip install -U langchain-duel
Set your Duel API key (create one at duelagents.com/dashboard/settings):
export DUEL_API_KEY="duel_<prefix>_<secret>"
Chat models
from langchain_duel import ChatDuel
llm = ChatDuel(model="duel-auto", temperature=0)
print(llm.invoke("Explain concurrent agents in one sentence.").content)
duel-auto lets the router pick the model. You can also pass a specific model
name (for example gpt-4o-mini or claude-3-5-haiku-latest) and Duel will
route to that provider.
Streaming
for chunk in llm.stream("Write a haiku about routing."):
print(chunk.content, end="", flush=True)
Configuration
| Argument | Env var | Default |
|---|---|---|
api_key |
DUEL_API_KEY |
required |
base_url |
DUEL_PROXY_URL |
https://duelagents.com/v1 |
model |
- | duel-auto |
License
MIT
Metadata
Release files for langchain-duel 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| langchain_duel-0.1.0.tar.gz | 3.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| langchain_duel-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.7 kB
Release files / langchain_duel-0.1.0.tar.gz
| Download URL | langchain_duel-0.1.0.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
463b0ba53ad14bba905a70a1f3d94aa778f2e2faccbe00ab9897bab1c53ad2e1
|
|
BLAKE2b-256 checksum How to use checksums |
49d318e4632a3926ea875543d60699353d74e81753690b80c931bf975725ed37
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / langchain_duel-0.1.0-py3-none-any.whl
| Download URL | langchain_duel-0.1.0-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6cd2f12ac385ef776783550511f78e8f66b480b873b06e8f6635086eca38133d
|
|
BLAKE2b-256 checksum How to use checksums |
821087fe5006deac6a112967e2d9e65ecf228bffb7db347c20a2dfd784dd3fa1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Security for langchain-duel 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.