Skip to main content

LangChainKit

LangChainKit simplifies the process of prompting LLMs to return structured outputs using LangChain and LangFuse.


🚀 Features

  • 🔧 Simplified Qwen3 + vLLM integration
    Automatically configure enable_thinking and 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

  • LangChain for the core framework
  • vLLM for high-throughput LLM inference
  • Langfuse for observability and monitoring

Metadata

Release files for langchainkit 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langchainkit 0.2.2
File Size Uploaded
langchainkit-0.2.2.tar.gz 12.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for langchainkit 0.2.2
File Interpreter ABI Platform
langchainkit-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 25.0 kB

Release files / langchainkit-0.2.2.tar.gz

Download URL langchainkit-0.2.2.tar.gz
Size 12.4 kB
Tags Source
SHA-256 checksum
How to use checksums
098116c11077624d70df0f77500a3e0b685b374ecac70796efa1dab145a22084
BLAKE2b-256 checksum
How to use checksums
1923c47797ad95ff6c8deef68bcb665d01d9b2a00b915670df6360ff107c12ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / langchainkit-0.2.2-py3-none-any.whl

Download URL langchainkit-0.2.2-py3-none-any.whl
Size 12.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b2f4867744c45b6737cb25bf0b6b97220e5795b9c019f6f59d7c968135fe1225
BLAKE2b-256 checksum
How to use checksums
d89c2fb26a1d9f4d54fca06457aae961222ddc7473ec405ab406d55264dfae82
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files

0.2.1

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page