An integration package connecting Duel Agents and LangChain
Project description
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
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 langchain_duel-0.1.0.tar.gz.
File metadata
- Download URL: langchain_duel-0.1.0.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
463b0ba53ad14bba905a70a1f3d94aa778f2e2faccbe00ab9897bab1c53ad2e1
|
|
| MD5 |
f5a6edeafcac895f9e78f5d574d241b5
|
|
| BLAKE2b-256 |
49d318e4632a3926ea875543d60699353d74e81753690b80c931bf975725ed37
|
File details
Details for the file langchain_duel-0.1.0-py3-none-any.whl.
File metadata
- Download URL: langchain_duel-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6cd2f12ac385ef776783550511f78e8f66b480b873b06e8f6635086eca38133d
|
|
| MD5 |
09201e1f813a65115112067fe4b8b115
|
|
| BLAKE2b-256 |
821087fe5006deac6a112967e2d9e65ecf228bffb7db347c20a2dfd784dd3fa1
|