LLM Tests
Project description
LLM Tests
Summary
This package aims to make LLM testing easier and repeatable.
The primary intention is for testing LLM memory solutions like RAG, but the functionality can be used for other purposes as well. Including tool testing.
Test files are stored as JSON using the following template.
The following example explains most of the functionality of the template.
{
"setups": [
{
"summary": "An optional summary of the prior conversations",
"prior_conversations": [
[{
"role": "user",
"content": "My name is User"
},
{
"role": "assistant",
"content": "Hi User"
}
],
[{
"role": "user",
"content": "Do you know my name"
},
{
"role": "assistant",
"content": "This is a new context, I can only remember across contexts with external tools"
}]
]
}
],
"tests" : [
{
"summary": "An optional summary for this test",
"case_sensitive": false,
"ignoring_thinking": true,
"messages": [{
"role": "system",
"content": "Respond only with the word Hello"
}],
"expected_response": "Hello"
},
{
"messages": [{
"role": "system",
"content": "Respond only with the user's name"
}],
"expected_response": "User"
}
]
}
# Here is a simple inefficient example
import llmtests
import ollama
def chatfn(messages):
resp = ollama.chat(model='deepseek-r1:8b', messages=messages)
return resp["message"]
def resetMemory(context_reset, memory_reset):
if memory_reset:
# Reset Database. E.g. wipe everything
pass
if context_reset:
pass
# Reset context of current conversation
results = llmtests.test_all(chatfn, resetMemory)
report = llmtests.test_results_as_text_report(results)
print("Score:",report["pass_count"],"/",report["test_count"])
if report["failed_report"]:
print("Failed tests")
print(report["failed_report"])
else:
print("No failed tests")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file llmtests-0.0.16.281.tar.gz.
File metadata
- Download URL: llmtests-0.0.16.281.tar.gz
- Upload date:
- Size: 18.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8769b6023f1d2bbfc92b587647b9f301bdd919a087baae1fc06127b28d5b46a1
|
|
| MD5 |
75154810ff9eed1c2f2c58ea5a08cf88
|
|
| BLAKE2b-256 |
5ada6c4a1a48800a5f4c514cd6a386684f3efd53f37fa4f92a73cb435dd56ac6
|
Provenance
The following attestation bundles were made for llmtests-0.0.16.281.tar.gz:
Publisher:
publish-to-pypi.yml on mr-randall/llmtests
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
llmtests-0.0.16.281.tar.gz -
Subject digest:
8769b6023f1d2bbfc92b587647b9f301bdd919a087baae1fc06127b28d5b46a1 - Sigstore transparency entry: 467354250
- Sigstore integration time:
-
Permalink:
mr-randall/llmtests@3ce820abb544a7d35690ffa752d8d2c53347f7b7 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/mr-randall
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@3ce820abb544a7d35690ffa752d8d2c53347f7b7 -
Trigger Event:
push
-
Statement type:
File details
Details for the file llmtests-0.0.16.281-py3-none-any.whl.
File metadata
- Download URL: llmtests-0.0.16.281-py3-none-any.whl
- Upload date:
- Size: 18.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8cbc6e87ba37e0b26a9589ff69d9b9f6514b897f8060009626a3ff8a24d14540
|
|
| MD5 |
368346eb34e54d06f28c0226327a9e91
|
|
| BLAKE2b-256 |
2a6eb1b2a3f3b25b5cae1bba3b4ce351bfc0f73322e2b00b6afe6afa3a12734e
|
Provenance
The following attestation bundles were made for llmtests-0.0.16.281-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on mr-randall/llmtests
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
llmtests-0.0.16.281-py3-none-any.whl -
Subject digest:
8cbc6e87ba37e0b26a9589ff69d9b9f6514b897f8060009626a3ff8a24d14540 - Sigstore transparency entry: 467354276
- Sigstore integration time:
-
Permalink:
mr-randall/llmtests@3ce820abb544a7d35690ffa752d8d2c53347f7b7 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/mr-randall
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@3ce820abb544a7d35690ffa752d8d2c53347f7b7 -
Trigger Event:
push
-
Statement type: