langchain-machinelibrary
Machine Library for LangChain: a retriever and agent
tools for citable search across scholarly papers, books, patents, standards and
Wikipedia. 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.
Search profiles (0.2.0)
Search scope and ranking defaults come from the server's API profile, which
currently searches Library documents. Clients do not select indexes. The
index option (and LlamaIndex's social option) has been removed; call
search(query, limit=...) in Python or search(query, { limit }) in JavaScript.
For unified Library and Social search through MCP, connect to
https://mcp.machinelibrary.ai and call machinelibrary_search.
Metadata
Release files for langchain-machinelibrary 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| langchain_machinelibrary-0.2.0.tar.gz | 5.7 kB | Without provenance | Details for langchain_machinelibrary-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| langchain_machinelibrary-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for langchain_machinelibrary-0.2.0-py3-none-any.whl |
Total release size: 12.3 kB
Release files / langchain_machinelibrary-0.2.0.tar.gz
| Download URL | langchain_machinelibrary-0.2.0.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c0a86af21eb6d810e985f5800037effd3399cdc278a37dc02271c1bf61903578
|
|
BLAKE2b-256 checksum How to use checksums |
a74e874dc099d1d4b5ee989a9a92b61d3e1f426321d5cd57575b25fbaae33c63
|
| 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.2.0-py3-none-any.whl
| Download URL | langchain_machinelibrary-0.2.0-py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fc540f16b48ab5927f60051135ed89338368e460d64aa2791c4679b5d6ec00e9
|
|
BLAKE2b-256 checksum How to use checksums |
d9f36f23d4d13e6f2d253a1a222124b481ecf0a168c10847306022855c92348d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.7
|
Security for langchain-machinelibrary 0.2.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.