A collection of text metric udfs for whylogs profiling and monitoring in WhyLabs
Project description
LangKit
LangKit is an open-source text metrics toolkit for monitoring language models. It offers an array of methods for extracting relevant signals from the input and/or output text, which are compatible with the open-source data logging library whylogs.
The generated profiles can be visualized and monitored in the WhyLabs platform or they can be further analyzed by the user on their own accord.
Motivation
Productionizing language models, including LLMs, comes with a range of risks due to the infinite amount of input combinations, which can elicit an infinite amount of outputs. The unstructured nature of text poses a challenge in the ML observability space - a challenge worth solving, since the lack of visibility on the model's behavior can have serious consequences.
Features
The currently supported metrics include:
- readability
- complexity
- grade
- sentiment
- similarity to a user-defined topic
Installation
To install LangKit, use the Python Package Index (PyPI) as follows:
pip install langkit
Usage
LangKit modules contain UDFs that automatically wire into the collection of UDFs on String features provided by whylogs by default. All we have to do is import the LangKit modules and then instantiate a custom schema as shown in the example below.
from whylogs.experimental.core.metrics.udf_metric import generate_udf_schema
from whylogs.core.schema import DeclarativeSchema
import whylogs as why
from langkit.sentiment import *
from langkit.textstat import *
text_schema = DeclarativeSchema(generate_udf_schema())
results = why.log({"prompt": "hello!", "response": "world!"}, schema=text_schema)
The code above will produce a set of metrics comprised of the default whylogs metrics for text features and all the metrics defined in the imported modules.
More examples available here
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
Hashes for langkit-0.0.1.dev1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9f53f4abef52c20c59a0137354977034c45ad6317bb4545dea3a29c501d78c7 |
|
MD5 | e06391fae66869ba6d9a57dd760e0a25 |
|
BLAKE2b-256 | 49bcfa833c20e490bb1b9a36bbe8bd1ffd884591c2f8e8ec5c4310c6acb05d56 |