⚡♾️ FastREPL
Fast Run-Eval-Polish Loop for LLM Applications.
This project is still in the early development stage. Have questions? Let's chat!
Quickstart
Let's say we have this existing system:
import openai
context = """
The first step is to decide what to work on. The work you choose needs to have three qualities: it has to be something you have a natural aptitude for, that you have a deep interest in, and that offers scope to do great work.
In practice you don't have to worry much about the third criterion. Ambitious people are if anything already too conservative about it. So all you need to do is find something you have an aptitude for and great interest in.
"""
def run_qa(question: str) -> str:
return openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=[
{
"role": "system",
"content": f"Answer in less than 30 words. Use the following context if needed: {context}",
},
{"role": "user", "content": question},
],
)["choices"][0]["message"]["content"]
We already have a fixed context. Now, let's ask some questions. local_runner is used here to run it locally with threads and progress tracking. We will have remote_runner to run the same in the cloud.
contexts = [[context]] * len(questions)
# https://huggingface.co/datasets/repllabs/questions_how_to_do_great_work
questions = [
"how to do great work?.",
"How can curiosity be nurtured and utilized to drive great work?",
"How does the author suggest finding something to work on?",
"How did Van Dyck's painting differ from Daniel Mytens' version and what message did it convey?",
]
runner = fastrepl.local_runner(fn=run_qa)
ds = runner.run(args_list=[(q,) for q in questions], output_feature="answer")
ds = ds.add_column("question", questions)
ds = ds.add_column("contexts", contexts)
# fastrepl.Dataset({
# features: ['answer', 'question', 'contexts'],
# num_rows: 4
# })
Now, let's use one of our evaluators to evaluate the dataset. Note that we are running it 5 times to ensure we obtain consistent results.
evaluator = fastrepl.RAGEvaluator(node=fastrepl.RAGAS(metric="Faithfulness"))
ds = fastrepl.local_runner(evaluator=evaluator, dataset=ds).run(num=5)
# ds["result"]
# [[0.25, 0.0, 0.25, 0.25, 0.5],
# [0.5, 0.5, 0.5, 0.75, 0.875],
# [0.66, 0.66, 0.66, 0.66, 0.66],
# [1.0, 1.0, 1.0, 1.0, 1.0]]
Seems like we are getting quite good results. If we increase the number of samples a bit, we can obtain a reliable evaluation of the entire system. We will keep working on bringing better evaluations.
Detailed documentation is here.
Contributing
Any kind of contribution is welcome.
- Development: Please read CONTRIBUTING.md and tests.
- Bug reports: Use Github Issues.
- Feature request and questions: Use Github Discussions.
Metadata
Release files for fastrepl 0.0.25
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 |
|---|---|---|---|---|
| fastrepl-0.0.25.tar.gz | 26.1 kB | Without provenance | Details for fastrepl-0.0.25.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fastrepl-0.0.25-py3-none-any.whl | Python 3 | none | any | Details for fastrepl-0.0.25-py3-none-any.whl |
Total release size: 63.2 kB
Release files / fastrepl-0.0.25.tar.gz
| Download URL | fastrepl-0.0.25.tar.gz |
|---|---|
| Size | 26.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f052acc54db5cf4e46ceaffc33b63189f502f73442e6c56586eb3b50dff30221
|
|
BLAKE2b-256 checksum How to use checksums |
55e347b44b11380a9182f04be03f5284d69b66d5b14350acb2b560be2e86dde1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.6.1 CPython/3.11.6 Linux/6.2.0-1014-azure
|
Release files / fastrepl-0.0.25-py3-none-any.whl
| Download URL | fastrepl-0.0.25-py3-none-any.whl |
|---|---|
| Size | 37.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d589f8178c9d0b6c733a7185a34c729d537befaa275e38fea81ed53f59710e5c
|
|
BLAKE2b-256 checksum How to use checksums |
7151e1ccbe683bc98858c0ae40fd87b487a67d53c56390c21b9f1fcb248446c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.6.1 CPython/3.11.6 Linux/6.2.0-1014-azure
|
Security for fastrepl 0.0.25
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.