<h1 align="center">
<a href="https://prompts.chat">
> 💡 Want to experience LangKit? Go to this [notebook](https://github.com/whylabs/langkit/blob/main/langkit/examples/Intro_to_Langkit.ipynb)!
Sign in to like and favorite skills
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.
💡 Want to experience LangKit? Go to this notebook!
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.
The currently supported metrics include:
To install LangKit, use the Python Package Index (PyPI) as follows:
pip install langkit[all]
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.
import whylogs as why from langkit import llm_metrics results = why.log({"prompt": "Hello!", "response": "World!"}, schema=llm_metrics.init())
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. This profile can be visualized and monitored in the WhyLabs platform or they can be further analyzed by the user on their own accord.
More examples are available here.
You can have more information about the different modules and their metrics here.