Package: evals
OpenAI EvalsEvals provide a framework for evaluating large language models (LLMs) or systems built using LLMs. We offer an existing registry of evals to test different dimensions of OpenAI models and the ability to write your own custom evals for use cases you care about. You can also use your data to build private evals which represent the common LLMs patterns in your workflow without exposing any of that data publicly.If you are building with LLMs, creating high quality evals is one of the most impactful things you can do. Without evals, it can be very difficult and time intensive to understand how different model versions might effect your use case. In the words ofOpenAI's President Greg Brockman:SetupTo run evals, you will need to set up and specify yourOpenAI API key. After you obtain an API key, specify it using theOPENAI_API_KEYenvironment variable. Please be aware of thecostsassociated with using the API when running evals. You can also run and create evals usingWeights & Biases.Minimum Required Version: Python 3.9Downloading evalsOur Evals registry is stored usingGit-LFS. Once you have downloaded and installed LFS, you can fetch the evals (from within your local copy of the evals repo) with:cdevals
gitlfsfetch--all
gitlfspullThis will populate all the pointer files underevals/registry/data.You may just want to fetch data for a select eval. You can achieve this via:gitlfsfetch--include=evals/registry/data/${youreval}gitlfspullMaking evalsIf you are going to be creating evals, we suggest cloning this repo directly from GitHub and installing the requirements using the following command:pipinstall-e.Using-e, changes you make to your eval will be reflected immediately without having to reinstall.Optionally, you can install the formatters for pre-committing with:pipinstall-e.[formatters]Then runpre-commit installto install pre-commit into your git hooks. pre-commit will now run on every commit.If you want to manually run all pre-commit hooks on a repository, runpre-commit run --all-files. To run individual hooks usepre-commit run <hook_id>.Running evalsIf you don't want to contribute new evals, but simply want to run them locally, you can install the evals package via pip:pipinstallevalsYou can find the full instructions to run existing evals in:run-evals.mdand our existing eval templates in:eval-templates.md. For more advanced use cases like prompt chains or tool-using agents, you can use our:Completion Function Protocol.We provide the option for you to log your eval results to a Snowflake database, if you have one or wish to set one up. For this option, you will further have to specify theSNOWFLAKE_ACCOUNT,SNOWFLAKE_DATABASE,SNOWFLAKE_USERNAME, andSNOWFLAKE_PASSWORDenvironment variables.Writing evalsWe suggest getting starting by:Walking through the process for building an eval:build-eval.mdExploring an example of implementing custom eval logic:custom-eval.md.Writing your own completion functions:completion-fns.mdPlease note that we are currently not accepting Evals with custom code! While we ask you to not submit such evals at the moment, you can still submit modelgraded evals with custom modelgraded YAML files.If you think you have an interesting eval, please open a pull request with your contribution. OpenAI staff actively review these evals when considering improvements to upcoming models.FAQDo you have any examples of how to build an eval from start to finish?Yes! These are in theexamplesfolder. We recommend that you also read throughbuild-eval.mdin order to gain a deeper understanding of what is happening in these examples.Do you have any examples of evals implemented in multiple different ways?Yes! In particular, seeevals/registry/evals/coqa.yaml. We have implemented small subsets of theCoQAdataset for various eval templates to help illustrate the differences.When I run an eval, it sometimes hangs at the very end (after the final report). What's going on?This is a known issue, but you should be able to interrupt it safely and the eval should finish immediately after.There's a lot of code, and I just want to spin up a quick eval. Help? OR,I am a world-class prompt engineer. I choose not to code. How can I contribute my wisdom?If you follow an existingeval templateto build a basic or model-graded eval, you don't need to write any evaluation code at all! Just provide your data in JSON format and specify your eval parameters in YAML.build-eval.mdwalks you through these steps, and you can supplement these instructions with the Jupyter notebooks in theexamplesfolder to help you get started quickly. Keep in mind, though, that a good eval will inevitably require careful thought and rigorous experimentation!DisclaimerBy contributing to Evals, you are agreeing to make your evaluation logic and data under the same MIT license as this repository. You must have adequate rights to upload any data used in an Eval. OpenAI reserves the right to use this data in future service improvements to our product. Contributions to OpenAI Evals will be subject to our usual Usage Policies:https://platform.openai.com/docs/usage-policies.