Langval is a language model evaluation tool for evaluating the toxicity, accuracy, hallucination, and bias of language models.
Project description
Langval
Langval is a language model evaluation tool for evaluating the toxicity, accuracy, hallucination, and bias of language models.
Installation
pip install langval
Usage
from langchain_openai import ChatOpenAI
import langval
from langval import TestCase
from langval.eval import BaseEval
from langval.eval.langchain import LangchainEval
from langval.model import Validation
llm = ChatOpenAI(model="gpt-4o-mini", temperature=0.3)
_eval = LangchainEval(
llm, validation=Validation(toxicity=0.2, accuracy=0.9, hallucination=0.2, bias=0.1)
)
class TestEval(TestCase):
@property
def eval(self) -> BaseEval:
return _eval
@classmethod
def setUpClass(cls) -> None:
cls.model = llm
@langval.assess(model=llm, question="What is the capital of France?")
def test_eval(self):
return "paris"
@langval.assess("What is the capital of India?")
def test_001(self):
return "New delhi"
@classmethod
def tearDownClass(cls):
del cls.model
Contributing
Contributions are welcome! Please read the contributing guidelines for more information.
License
langval is licensed under the MIT License.
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
langval-0.0.3.tar.gz
(56.5 kB
view details)
Built Distribution
File details
Details for the file langval-0.0.3.tar.gz
.
File metadata
- Download URL: langval-0.0.3.tar.gz
- Upload date:
- Size: 56.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c2b039ab5e4eb99a84eda73aa67009045b820d9766bdcf660227f8fa3b2330b |
|
MD5 | 7dde99b4f82f09a88aab859f931200c5 |
|
BLAKE2b-256 | 0a455df1a1f3fbadb790846208e10df389458e8512dd07ed436aa9ff6973825c |
File details
Details for the file langval-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: langval-0.0.3-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf176fdf8760bf954002fb1b16cee25674ff90e52fdb922e1e2aa15c0c30518b |
|
MD5 | 34e38e14ea9f48807aa5e3c4bbfce5ab |
|
BLAKE2b-256 | 12150dd2e070ff4943e6adac5f7ff62184380e3d45d6fd7897280fbfa009a084 |