Skip to main content

PyPI version License: Apache 2.0 Downloads LinkedIn

LangChain LLM7 Integration

Official LangChain compatibility layer for LLM7 API services.

Installation

pip install langchain-llm7

Features

  • 🚀 Native integration with LangChain's BaseChatModel interface
  • ⚡ Support for both streaming and non-streaming responses
  • 🔧 Customizable model parameters (temperature, max_tokens, stop sequences)
  • 📊 Token usage metadata tracking
  • 🛠 Robust error handling and retry mechanisms

Usage

Basic Implementation

from langchain_llm7 import ChatLLM7
from langchain_core.messages import HumanMessage

# Initialize with default parameters
llm = ChatLLM7()

# Basic invocation
response = llm.invoke([HumanMessage(content="Hello!")])
print(response.content)

Streaming Responses

# Enable streaming
llm = ChatLLM7(streaming=True)

for chunk in llm.stream([HumanMessage(content="Tell me about quantum computing")]):
    print(chunk.content, end="", flush=True)

Advanced Configuration

# Custom model configuration
llm = ChatLLM7(
    model="llama-3.3-70b-instruct-fp8-fast",
    temperature=0.7,
    max_tokens=500,
    stop=["\n", "Observation:"],
    timeout=45
)

Parameters

Parameter Description Default
model Model version to use "gpt-4o-mini-2024-07-18"
base_url API endpoint URL "https://api.llm7.io/v1"
temperature Sampling temperature (0.0-2.0) 1.0
max_tokens Maximum number of tokens to generate None
timeout Request timeout in seconds 120
stop Stop sequences for response generation None
streaming Enable streaming response mode False

Error Handling

The library provides detailed error messages for:

  • API communication failures
  • Invalid message formats
  • Unsupported message types
  • Response parsing errors
try:
    llm.invoke([{"invalid": "message"}])
except ValueError as e:
    print(f"Error: {e}")

Testing

To run the test suite:

pip install pytest
pytest tests/

Documentation

For complete documentation see:

Contributing

Contributions are welcome! Please open an issue or submit a PR:

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Contact

Eugene Evstafev

LinkedIn Profile

Metadata

Release files for langchain-llm7 2025.4.101205

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

Source distribution (sdist)

Source distribution for langchain-llm7 2025.4.101205
File Size Uploaded Provenance
langchain_llm7-2025.4.101205.tar.gz 10.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for langchain-llm7 2025.4.101205
File Interpreter ABI Platform
langchain_llm7-2025.4.101205-py3-none-any.whl Python 3 none any Details

Total release size: 22.6 kB

Release files / langchain_llm7-2025.4.101205.tar.gz

Download URL langchain_llm7-2025.4.101205.tar.gz
Size 10.7 kB
Tags Source
SHA-256 checksum
How to use checksums
52260919b8a1939ccdeef496a3d43e6e173065e1d9a92b813ade0ceee85a7ef0
BLAKE2b-256 checksum
How to use checksums
5d866139c8e6b5c38cbf51ab4f4f54cff623f377a0ec4bd64cebdb1f11d6dd39
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.11

Release files / langchain_llm7-2025.4.101205-py3-none-any.whl

Download URL langchain_llm7-2025.4.101205-py3-none-any.whl
Size 11.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9ff6b57c80ae13b504f60cdfcc10d1c184f19b60ca1965c94da1687fd24aabbc
BLAKE2b-256 checksum
How to use checksums
5bc275919d4a64e8970090cbd61a9899c4265c1f2e1c1cfc58cfb665b95b7de5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.11

Security for langchain-llm7 2025.4.101205

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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