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 MachineLibraryToolkit
agent = create_agent(
"anthropic:claude-sonnet-5-5",
tools=MachineLibraryToolkit().get_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.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| langchain_machinelibrary-0.1.1.tar.gz | 5.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| langchain_machinelibrary-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.1 kB
Release files / langchain_machinelibrary-0.1.1.tar.gz
| Download URL | langchain_machinelibrary-0.1.1.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
059252d798f086894905157910300904f8532a66abdb3e7d34399b2b5a231e15
|
|
BLAKE2b-256 checksum How to use checksums |
04503afd5d254a1c29fc6c04f6d8e788d4e32e051cfd2fad7e1316c84c19f497
|
| 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.1-py3-none-any.whl
| Download URL | langchain_machinelibrary-0.1.1-py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
96232619c66c76d2c213cc311869136b427aa70858943162b94d114e3d47de03
|
|
BLAKE2b-256 checksum How to use checksums |
ba0e008ec21b73e0233f2ebbfbfbd9d272854ce881de02bdeb7d92801bed00ae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.7
|