LangChainKit makes it easier to work with Qwen3 models via vLLM, and simplifies the process of prompting LLMs to return structured outputs using LangChain and Langfuse.
Project description
LangChainKit
LangChainKit simplifies the process of prompting LLMs to return structured outputs using LangChain and LangFuse.
🚀 Features
-
🔧 Simplified Qwen3 + vLLM integration
Automatically configureenable_thinkingand other complex settings for Qwen3 models when using vLLM. -
🧠 Structured Output via LangChain
Easily prompt the LLM to generate structured outputs, including batch prompting support, with minimal setup. -
📊 LangFuse Integration
Track and evaluate LLM performance using LangFuse, without writing boilerplate code.
Installation
pip install langchainkit
Quick Start
Configuration
Set up your environment variables in .env file:
DEEPSEEK_API_KEY=your deepseek api key
MOONSHOT_API_KEY=...
OPENROUTER_API_KEY=...
ARK_API_KEY=...
DASHSCOPE_API_KEY=...
LOCAL_VLLM_BASE_URL=http://172.20.14.28:8000/v1
LOCAL_VLLM_API_KEY=...
LANGFUSE_SECRET_KEY=...
LANGFUSE_PUBLIC_KEY=...
LANGFUSE_HOST=...
from langchainkit import GeneralLLM,prompt_parsing
from pydantic import BaseModel
from dotenv import load_dotenv
load_dotenv() # load .env file
llm = GeneralLLM.deepseek_chat()
class Response(BaseModel):
answer: str
confidence: float
result = prompt_parsing(
model=Response,
failed_model=Response(answer="no_answer", confidence=0.0),
query="What is the capital of France?",
llm=llm,
use_langfuse=False
)
print(result.answer) # "Paris"
print(result.confidence) # 1.0
result = prompt_parsing(
model=Response,
failed_model=Response(answer="no_answer", confidence=0.0),
query=["What is the capital of France?",
"What is the capital of Germany?",
"What is the capital of Italy?"],
llm=llm,
use_langfuse=False
)
for each in result:
print(each.answer)
print(each.confidence)
# Paris
# 0.95
# Berlin
# 0.95
# Rome
# 1.0
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
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 langchainkit-0.1.6.tar.gz.
File metadata
- Download URL: langchainkit-0.1.6.tar.gz
- Upload date:
- Size: 12.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f851a1eb55b006e1bd6b4afda02063b6712394750700c703f80da647f256128
|
|
| MD5 |
1878c6f5b0319020bfcb4900e6faa6a6
|
|
| BLAKE2b-256 |
5ae39894b3bf648584c738d914f0040a873f179a0db994d4fa9c990b16a42d85
|
File details
Details for the file langchainkit-0.1.6-py3-none-any.whl.
File metadata
- Download URL: langchainkit-0.1.6-py3-none-any.whl
- Upload date:
- Size: 12.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1f29cc6826132b4df2ae67e19cde1abcd7c143487a0d7893e7b4cb173a45971
|
|
| MD5 |
edb5240a20ae813ebe2ed73a1a078c19
|
|
| BLAKE2b-256 |
026fda035e63eaf90296b9559016a6dc2ec5b436a714349b91534dc8b2c90e86
|