Skip to main content

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 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

langchainkit-0.2.1.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

langchainkit-0.2.1-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file langchainkit-0.2.1.tar.gz.

File metadata

  • Download URL: langchainkit-0.2.1.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for langchainkit-0.2.1.tar.gz
Algorithm Hash digest
SHA256 f957e96d220a056579fd6eb909486887d22897c568a293820bf6e3a69598e9a4
MD5 1604b02fe9699f1e5a21e879a6bb0c44
BLAKE2b-256 541aebd0750d0065739e694b09b1517f84b506ce1c5681f6e5e7d805ac6b93c4

See more details on using hashes here.

File details

Details for the file langchainkit-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: langchainkit-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for langchainkit-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 da75b12c15fc70d0d9bfad6a2fc21e174b3481f0022ea12f33c208c971e43a3f
MD5 1293e8afa4837e318cd99436b6c57f39
BLAKE2b-256 561a10e8526c1221a0c283c46fe0243e63d26905d8c807662035785da54bbf0a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page