A new package that helps developers integration-test AI and LLM applications by validating structured outputs. It takes a user's test scenario or prompt as input, sends it to an LLM, and uses pattern
Project description
LLM Test Helper (llmtestr)
llmtestr is a Python package designed to assist developers in integration-testing AI and Language Model applications by validating structured outputs. It provides a simple interface to send a prompt or test scenario to an LLM, then verifies that the response matches predefined patterns using pattern matching mechanisms. This helps ensure that your LLM outputs adhere to expected formats such as code snippets, JSON structures, or tagged responses, making it easier to catch formatting errors, regressions, or inconsistencies during development and testing.
Installation
Install the package via pip:
pip install llmtestr
Usage
Here's a basic example of how to use llmtestr in your Python code:
from llmtestr import llmtestr
response = llmtestr(user_input="Your test prompt here")
print(response)
Function Parameters
user_input(str): The prompt or test scenario you want to evaluate.llm(Optional[BaseChatModel]): An optionallangchainLLM instance to use. If not provided,llmtestrdefaults to usingChatLLM7.api_key(Optional[str]): Your API key forLLM7. If not provided, it will attempt to fetch from the environment variableLLM7_API_KEY.
Underlying LLM
By default, llmtestr uses the ChatLLM7 class from langchain_llm7, which you can find on PyPI: langchain_llm7. You can also pass your custom LLM instance based on the langchain interface for different providers like OpenAI, Anthropic, Google, etc.
Examples:
Using OpenAI:
from langchain_openai import ChatOpenAI
from llmtestr import llmtestr
llm = ChatOpenAI()
response = llmtestr(user_input="Test prompt", llm=llm)
Using Anthropic:
from langchain_anthropic import ChatAnthropic
from llmtestr import llmtestr
llm = ChatAnthropic()
response = llmtestr(user_input="Test prompt", llm=llm)
Using Google Generative AI:
from langchain_google_genai import ChatGoogleGenerativeAI
from llmtestr import llmtestr
llm = ChatGoogleGenerativeAI()
response = llmtestr(user_input="Test prompt", llm=llm)
Rate Limits & API Keys
The default free tier for LLM7 provides sufficient rate limits for most development needs. To get higher limits, you can:
- Set the environment variable
LLM7_API_KEY. - Pass your API key directly:
response = llmtestr(user_input="Test prompt", api_key="your_api_key")
Register for a free API key at https://token.llm7.io/.
Support & Issues
For issues, bugs, or feature requests, please visit the GitHub repo issues page: https://github.com/chigwell/llmtestr/issues.
Author
Eugene Evstafev
Email: hi@euegne.plus
GitHub: chigwell
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 llmtestr-2025.12.21135641.tar.gz.
File metadata
- Download URL: llmtestr-2025.12.21135641.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b95f10eb4d4e615c0ed0eadcdf1098a0b960f8707bf08e9ea091d42290dd1f9
|
|
| MD5 |
a542e787f438d3f3889e760db8c134ae
|
|
| BLAKE2b-256 |
c50e5c0fbf3431c82dff72988d3861d5cd08bd88be33d33ad98d88d62f1e0cb2
|
File details
Details for the file llmtestr-2025.12.21135641-py3-none-any.whl.
File metadata
- Download URL: llmtestr-2025.12.21135641-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fec635a301250525a50fc8f725e5b754f79e99d328be6b0396359975b25c894c
|
|
| MD5 |
740df9bafa7888838dd9397873055b46
|
|
| BLAKE2b-256 |
960f676f9b279a578b8c320d20ab7ad7f67ade38ae1918b9d2786d17178c3340
|