Skip to main content

langchain-machinelibrary

Machine Library for LangChain: a retriever and agent tools for citable search across scholarly papers, books, patents, standards and Wikipedia (plus Reddit, Telegram and Discord). Results carry a canonical source_uri, so answers can cite sources a reader can open and check.

Install

pip install langchain-machinelibrary
export MACHINELIBRARY_API_KEY=ml_...   # https://machinelibrary.ai/keys

Retriever (RAG)

from langchain_machinelibrary import MachineLibraryRetriever

retriever = MachineLibraryRetriever(k=5)
for doc in retriever.invoke("perovskite solar cell stability under humidity"):
    print(doc.metadata["title"], doc.metadata["source"])
    print(doc.page_content)

Agent tools

from langchain.agents import create_agent
from langchain_machinelibrary import machinelibrary_tools

agent = create_agent(
    "anthropic:claude-sonnet-5-5",
    tools=machinelibrary_tools(),
    system_prompt="Answer from Machine Library sources and cite each claim's source_uri.",
)
agent.invoke({"messages": [{"role": "user", "content": "What limits lithium-metal anodes?"}]})
Tool Use
machinelibrary_search Find documents; returns passages and source_uri
machinelibrary_search_in_document Find passages supporting a claim inside one document
machinelibrary_fetch_document Read bounded full text when the body is needed

Billing and limits

Each search or read is charged to the key's account; see pricing. Retrieved text is evidence to review, not proof that a generated answer is correct. Coverage is broad but not exhaustive.

Metadata

Release files for langchain-machinelibrary 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-machinelibrary 0.1.0
File Size Uploaded
langchain_machinelibrary-0.1.0.tar.gz 5.5 kB Details

Built distribution (wheel)

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

Total release size: 11.9 kB

Release files / langchain_machinelibrary-0.1.0.tar.gz

Download URL langchain_machinelibrary-0.1.0.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d5040abbb41f41be79d67a1bba878b4c75cebf670800291799800a11580e45de
BLAKE2b-256 checksum
How to use checksums
929760bf626a509c5e849cb6a4c1628309b115bfff945f888ba28c37487aaf95
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.7

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

Download URL langchain_machinelibrary-0.1.0-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
17bed2aa6e3abd0bbee82f104630e9aa1bfc60aa6a0455fff020cfd68df8b1ba
BLAKE2b-256 checksum
How to use checksums
80fb20c0ef683eb749b3acaf590538ced2e9e9cb81c4bd6887d56defa1f0e869
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.7

Release history Release notifications | RSS feed

0.1.1

2 release files

This release

0.1.0 This release

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