Skip to content

nhsengland/evalsense

Repository files navigation

Warning

This project is a work in progress. Critical components may be missing, inoperative or incomplete, and the API can undergo major changes without any notice. Please check back later for a more stable version.

EvalSense: LLM Evaluation

status: experimental PyPI package version license: MIT EvalSense status Guide status Python TypeScript React

Python v3.12 uv Ruff Checked with pyright ESLint

About

This repository holds a Python package enabling systematic evaluation of large language models (LLMs) on open-ended generation tasks. It also includes supplementary documentation and assets related to the NHS England project on LLM evaluation, such as the code for an interactive LLM evaluation guide (located in the guide/ directory). You can find more information about the project in the original project proposal.

Note: Only public or fake data are shared in this repository.

Project Stucture

  • The main code for the EvalSense Python package can be found under evalsense/.
  • The accompanying documentation is available in the docs/ folder.
  • Code for the interactive LLM evaluation guide is located under guide/.
  • Jupyter notebooks with the evaluation experiments and examples are located under notebooks/.

Getting Started

Installation

You can install the project using pip by running the following command:

pip install evalsense

This will install the latest released version of the package from PyPI.

Depending on your use-case, you may want to install additional optional dependencies from the following groups:

  • interactive: For running experiments interactively in Jupyter notebooks (only needed if you don't already have the necessary libraries installed).
  • transformers: For using models and metrics requiring the Hugging Face Transformers library.
  • vllm: For using models and metrics requiring vLLM.
  • local: For installing all local model dependencies (currently includes transformers and vllm).
  • all: For installing all optional dependencies.

For example, if you want to install EvalSense with all optional dependencies, you can run:

pip install "evalsense[all]"

If you want to use EvalSense with Jupyter notebooks (interactive) and Hugging Face Transformers (transformers), you can run:

pip install "evalsense[interactive,transformers]"

and similarly for other combinations.

Installation for Development

To install the project for local development, you can follow the steps below:

To clone the repo:

git clone [email protected]:nhsengland/evalsense.git

To setup the Python environment for the project:

  • Install uv if it's not installed already
  • uv sync --all-extras
  • source .venv/bin/activate
  • pre-commit install

To setup the Node environment for the LLM evaluation guide (located under guide/):

  • Install node if it's not installed already
  • Change to the guide/ directory (cd guide)
  • npm install
  • npm run start to run the development server

See also the separate README.md for the guide.

Usage

For an example illustrating the usage of EvalSense, please check the Demo notebook under the notebooks/ folder.

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/amazing-feature)
  3. Commit your Changes (git commit -m 'Add some amazing feature')
  4. Push to the Branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

See CONTRIBUTING.md for detailed guidance.

License

Unless stated otherwise, the codebase is released under the MIT Licence. This covers both the codebase and any sample code in the documentation.

See LICENSE for more information.

The documentation is © Crown copyright and available under the terms of the Open Government 3.0 licence.

Contact

This project is currently maintained by @adamdejl. If you have any questions, suggestions for new features or want to report a bug, please open an issue. For security concerns, please file a private vulenrability report.

To find out more about the NHS England Data Science visit our project website or get in touch at [email protected].

Acknowledgements

We thank the Inspect AI development team for their work on the Inspect AI library, which serves as a basis for the EvalSense library.