Skip to main content

langchain-openalex

LangChain tools and a retriever for OpenAlex, the free and open index of the world's scholarly research: 250M+ papers, books, datasets and preprints across every field, with authors, institutions, journals and citations. Maintained by the OpenAlex team.

Install

pip install -U langchain-openalex

It works without a key. Requests without a key share a small free daily budget per IP address; a free API key from openalex.org/settings/api gives you your own:

export OPENALEX_API_KEY="your-key"

Tools

from langchain_openalex import OpenAlexGetWork, OpenAlexSearch

search = OpenAlexSearch(max_results=5)
search.invoke({"query": "kelp forest decline", "from_year": 2020, "open_access_only": True})

lookup = OpenAlexGetWork()
lookup.invoke({"identifier": "10.1038/s41586-021-03819-2"})
Tool What it does
OpenAlexSearch (openalex_search) Keyword search over titles, abstracts and full text, with optional year range, open-access, work-type filters and sort (relevance, most cited, newest).
OpenAlexGetWork (openalex_get_work) One work by DOI, OpenAlex ID (W...), pmid: or pmcid:. Free.

Each work comes back as a flat record: openalex_id, doi, title, publication_year, publication_date, type, authors, source (journal or repository), cited_by_count, is_open_access, open_access_url and abstract.

With an agent:

from langchain.agents import create_agent

agent = create_agent("anthropic:claude-sonnet-5-5", tools=[search, lookup])
agent.invoke(
    {"messages": [("user", "What are the most cited recent papers on kelp forest decline?")]}
)

Retriever

from langchain_openalex import OpenAlexRetriever

retriever = OpenAlexRetriever(k=5, from_year=2020)
docs = retriever.invoke("microplastics in drinking water")
# page_content = title + abstract; metadata = the other fields above

More

This package uses OpenAlex's search and lookup endpoints. OpenAlex can do much more (authors, institutions, funders, citation graphs, grouping and counting); see the docs index for agents at help.openalex.org/llms.txt. OpenAlex data is CC0.

Issues and pull requests welcome.

Metadata

Release files for langchain-openalex 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-openalex 0.1.0
File Size Uploaded Provenance
langchain_openalex-0.1.0.tar.gz 9.2 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 19.1 kB

Release files / langchain_openalex-0.1.0.tar.gz

Download URL langchain_openalex-0.1.0.tar.gz
Size 9.2 kB
Tags Source
SHA-256 checksum
How to use checksums
9deb68a5252068374930e2f0679fb1b825a77adf03384ad58fc8db52010ec903
BLAKE2b-256 checksum
How to use checksums
3d27b4a4fb3f266ca96a4333db997809b34f83fe2146e2d690043b54146714c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

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

Download URL langchain_openalex-0.1.0-py3-none-any.whl
Size 9.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
de0adc7c662abc5fdffc1958c1fcd97e04209a09d1dc06da1e76dda7b340aa67
BLAKE2b-256 checksum
How to use checksums
e347e27139907af92b970cc28b2dca5597bc172a45c5391d7fe45d7963585525
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for langchain-openalex 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.

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