Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

313 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GenScAI

Generative AI tools and recipes for science and research.

GitHub License Python Version from PEP 621 TOML uv Ruff

GenScAI is a hands-on toolkit for applying large language models to scientific workflows, with a focus on infectious disease research and modeling. It pairs a reusable Python package with runnable notebooks and example applications so researchers can retrieve literature, extract structured information, classify and cluster papers, build knowledge graphs, and prototype LLM agents using local or hosted models.

Features

  • Literature retrieval from sources such as medRxiv and configurable APIs.
  • Information extraction recipes using OpenAI, LangChain, and LangExtract.
  • Embeddings and clustering with general-purpose and science-specific models (SPECTER, SPECTER2, NV-Embed).
  • Document classification with training, evaluation, and cross-model validation pipelines.
  • Knowledge graph construction via GraphRAG and LangChain.
  • Agents and tools built on smolagents and the Model Context Protocol (MCP).
  • Relevance-gated research corpus (genscai.corpus.Corpus): search → relevance-gate → persist → read as ready-made AIMU agent tools over a vector store.
  • Local model support through Ollama, Hugging Face Transformers, and quantization recipes.
  • Example chatbot (streamlit/genscai_chatbot.py) for exploring infectious disease modeling frameworks (LASER, Starsim) and the research literature.

Requirements

  • Python 3.10+
  • Ollama (optional, for running LLMs locally)
  • An NVIDIA GPU and CUDA drivers (optional, for accelerated local inference)

Installation

With uv (recommended)

uv venv
source .venv/bin/activate
uv sync --all-extras

--all-extras installs the main, development, notebook, and CUDA dependency groups. To install only the dependencies you need:

uv pip install -e .                 # core package
uv pip install -e '.[dev]'          # ruff, pytest
uv pip install -e '.[notebooks]'    # ipykernel, ipywidgets
uv pip install -e '.[cuda]'         # NVIDIA GPU support

With pip

python3 -m venv .venv
source .venv/bin/activate
pip install -e .                    # add '[dev]', '[notebooks]', or '[cuda]' as needed

Getting started

Open the notebooks (each use-case folder has a notebooks/ and/or scripts/ subdir):

jupyter lab

New here? Start with 00 - getting started/notebooks/01 - Environment Setup.ipynb, then work through the use-case folders in order.

To preview a chatbot wired to the project's scientific tools (research-article search, disease-modeling framework docs), launch the example Streamlit app instead:

streamlit run streamlit/genscai_chatbot.py

Project layout

Each scientific use case is a top-level folder containing its own notebooks/ and/or scripts/. The reusable Python package, datasets, generated artifacts, and tests are shared at the root.

genscai/
├── genscai/                   Reusable Python package (retrieval, classification, research, corpus, knowledge_base, simulation, tools)
├── 00 - getting started/      Environment setup
├── 01 - data collection/      Retrieve abstracts/articles (MIDAS, medRxiv, arXiv)
├── 02 - text analysis/        Information extraction, embeddings, classification
├── 03 - knowledge graphs/     Knowledge-graph construction and querying (GraphRAG, LangChain)
├── 04 - semantic search/      medRxiv vector index + retrieval-augmented generation (RAG)
├── 05 - model optimization/   Quantization and fine-tuning
├── 06 - agents/               Agent + MCP tool demos
├── 07 - literature research/  Agentic literature research across six frameworks
├── 08 - disease simulation/   Compartmental-model intervention-planning agent
├── 09 - evaluation/           Benchmarking
├── streamlit/                 Example Streamlit applications (the GenScAI chatbot)
├── data/                      Sample and training datasets
├── output/                    Generated artifacts (vector DB, model weights)
├── tests/                     Package tests
└── pyproject.toml

Use cases

Each top-level folder is a use case with its own README listing its notebooks and scripts.

Within a folder, notebooks are numbered from 01 and meant to be worked through in order.

Literature research (agent frameworks)

The 07 - literature research/ folder implements one identical use case — agentic literature research over medRxiv/bioRxiv with a relevance-gated local document store and a critic feedback loop — six ways across agent frameworks plus a "batteries-included" build from the project's own genscai.corpus.Corpus helper (on AIMU), all on local Ollama models. Read them side by side. Requires uv sync --all-extras. See its README.

Disease simulation

The 08 - disease simulation/ folder holds an adaptive intervention-planning agent (scripts/01_intervention_agent.py) that drives the compartmental model in genscai/simulation.py.

Development

Run linting and tests:

ruff check .
pytest

License

Released under the Apache License 2.0.

References

About

Gen AI Recipes for Science and Research

Topics

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages