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 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.
🚀 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
Basic Usage
from dotenv import load_dotenv
load_dotenv() # load .env file
from langchainkit import LocalLLM
llm = LocalLLM.qwen3_14b_awq_think()
res= llm.invoke('hello')
print(res.content) # Hello! How can I assist you today? 😊
Structured Output
from langchainkit import prompt_parsing
from pydantic import BaseModel
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
)
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
)
for each in result:
print(each.answer)
print(each.confidence)
# Paris
# 0.95
# Berlin
# 0.95
# Rome
# 1.0
Configuration
Set up your environment variables in .env file:
LOCAL_VLLM_BASE_URL=http://172.20.14.28:8000/v1
LOCAL_VLLM_API_KEY=your vLLM api key
LANGFUSE_SECRET_KEY=your langfuse secret key
LANGFUSE_PUBLIC_KEY=your langfuse public key
LANGFUSE_HOST=your langfuse host
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.3.tar.gz.
File metadata
- Download URL: langchainkit-0.1.3.tar.gz
- Upload date:
- Size: 7.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 |
958fc939472ab46ac7fb6160c92428b47ff6715508adc60d1425557d49bcdb12
|
|
| MD5 |
833c7397f6d63416f11c237a938514cf
|
|
| BLAKE2b-256 |
d2305a1abdb5cc13bab47c069441ca176a328eb553e09a97e67cd639c04feb27
|
File details
Details for the file langchainkit-0.1.3-py3-none-any.whl.
File metadata
- Download URL: langchainkit-0.1.3-py3-none-any.whl
- Upload date:
- Size: 7.9 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 |
fae24a5c0f479be7df019b44a69edfa37b053956c60feb44555bc0b11171773d
|
|
| MD5 |
cdfa0263ab8c9a70658081eab7b2721c
|
|
| BLAKE2b-256 |
3435371f110cc9e1e0e45de340f39bc134e66534879f13057f6008f8c29cb475
|