Skip to main content

langchain-llamay

LangChain integration for llamay, a local LLM runtime for macOS, Windows and Linux.

pip install -U langchain-llamay

Start a server

Download llamay from llamay.com/download, then:

llamay serve -m qwen2.5:7b

llamay downloads a model it does not have yet, including GGUF repositories on Hugging Face (hf.co/<owner>/<repo>:<quant>), and listens on http://localhost:11435. Set LLAMAY_HOST to reach a server elsewhere.

Chat

from langchain_llamay import ChatLlamay

llm = ChatLlamay(model="qwen2.5:7b")
print(llm.invoke("Why is the sky blue?").content)

Tool calling, structured output and streaming work as they do in langchain-ollama, which this package builds on: llamay serves Ollama's API.

One thing Ollama lacks does work here: tool_choice. llamay constrains the answer to a call when one is required, so even a small model calls the tool it is told to.

def get_weather(city: str) -> str:
    """Get the weather for a city."""
    return "sunny"


llm.bind_tools([get_weather], tool_choice="get_weather").invoke("Hello!").tool_calls
# [{'name': 'get_weather', 'args': {'city': ...}, ...}]

tool_choice takes "auto", "none", "any" or True (call one of the tools), a tool's name, or an OpenAI or Anthropic tool_choice object.

from pydantic import BaseModel


class City(BaseModel):
    name: str
    country: str


llm.with_structured_output(City).invoke("Name a city in Japan.")

Embeddings

Start the server with an encoder beside the chat model:

llamay serve -m qwen2.5:7b -embed all-minilm:latest
from langchain_llamay import LlamayEmbeddings

embeddings = LlamayEmbeddings(model="all-minilm:latest")
vector = embeddings.embed_query("hello")

Tests

uv run --group test pytest tests/unit_tests
# with `llamay serve -m qwen2.5:0.5b -embed all-minilm:latest` running:
uv run --group test pytest tests/integration_tests

Metadata

Release files for langchain-llamay 0.1.0

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-llamay 0.1.0
File Size Uploaded Provenance Actions
langchain_llamay-0.1.0.tar.gz 6.5 kB Without provenance Details for langchain_llamay-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for langchain-llamay 0.1.0
File Interpreter ABI Platform Actions
langchain_llamay-0.1.0-py3-none-any.whl Python 3 none any Details for langchain_llamay-0.1.0-py3-none-any.whl

Total release size: 14.0 kB

Release files / langchain_llamay-0.1.0.tar.gz

Download URL langchain_llamay-0.1.0.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
647a424cde907457790e6b816e97177d8f85185f4140e4aae10800070c461fbb
BLAKE2b-256 checksum
How to use checksums
f5eeb7af5eff626b9f6c16c6b25ddcf30e080635ef624cc1b2ddf506cb31021f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.13

Release files / langchain_llamay-0.1.0-py3-none-any.whl

Download URL langchain_llamay-0.1.0-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a2f711e73c2bcbdf0989ebdeae71f3da3b731a95d6d158e57997b11ad6440884
BLAKE2b-256 checksum
How to use checksums
807575d4785fbf5b0ea470c534517df5116e8c5e672266eaf89e5ce5fab16c10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.13

Security for langchain-llamay 0.1.0

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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