langkit


Namelangkit JSON
Version 0.0.31 PyPI version JSON
download
home_pagehttps://docs.whylabs.ai/docs/large-language-model-monitoring
SummaryA language toolkit for monitoring LLM interactions
upload_time2024-03-05 20:18:10
maintainer
docs_urlNone
authorWhyLabs.ai
requires_python>=3.8,<4
licenseApache-2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            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](https://whylogs.readthedocs.io/en/latest).

> 💡 Want to experience LangKit? Go to this [notebook](https://github.com/whylabs/langkit/blob/main/langkit/examples/Intro_to_Langkit.ipynb)!

## Table of Contents 📖

- [Motivation](#motivation-)
- [Features](#features-)
- [Installation](#installation-)
- [Usage](#usage-)
- [Modules](#modules-)

## 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:

- [Text Quality](https://github.com/whylabs/langkit/blob/main/langkit/docs/features/quality.md)
  - readability score
  - complexity and grade scores
- [Text Relevance](https://github.com/whylabs/langkit/blob/main/langkit/docs/features/relevance.md)
  - Similarity scores between prompt/responses
  - Similarity scores against user-defined themes
- [Security and Privacy](https://github.com/whylabs/langkit/blob/main/langkit/docs/features/security.md)
  - patterns - count of strings matching a user-defined regex pattern group
  - jailbreaks - similarity scores with respect to known jailbreak attempts
  - prompt injection - similarity scores with respect to known prompt injection attacks
  - refusals - similarity scores with respect to known LLM refusal of service responses
- [Sentiment and Toxicity](https://github.com/whylabs/langkit/blob/main/langkit/docs/features/sentiment.md)
  - sentiment analysis
  - toxicity analysis

## Installation 💻

To install LangKit, use the Python Package Index (PyPI) as follows:

```
pip install langkit[all]
```

## 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.

```python
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](https://whylabs.ai/safeguard-large-language-models?utm_source=github&utm_medium=referral&utm_campaign=langkit) or they can be further analyzed by the user on their own accord.

More examples are available [here](https://github.com/whylabs/langkit/tree/main/langkit/examples).

## Modules 📦

You can have more information about the different modules and their metrics [here](https://github.com/whylabs/langkit/blob/main/langkit/docs/modules.md).

            

Raw data

            {
    "_id": null,
    "home_page": "https://docs.whylabs.ai/docs/large-language-model-monitoring",
    "name": "langkit",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<4",
    "maintainer_email": "",
    "keywords": "",
    "author": "WhyLabs.ai",
    "author_email": "langkit@whylabs.ai",
    "download_url": "https://files.pythonhosted.org/packages/2f/15/f57eb4cd41bdfeb908f833b86fb55a67beddeb0883321da28e41114cef1d/langkit-0.0.31.tar.gz",
    "platform": null,
    "description": "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](https://whylogs.readthedocs.io/en/latest).\n\n> \ud83d\udca1 Want to experience LangKit? Go to this [notebook](https://github.com/whylabs/langkit/blob/main/langkit/examples/Intro_to_Langkit.ipynb)!\n\n## Table of Contents \ud83d\udcd6\n\n- [Motivation](#motivation-)\n- [Features](#features-)\n- [Installation](#installation-)\n- [Usage](#usage-)\n- [Modules](#modules-)\n\n## Motivation \ud83c\udfaf\n\nProductionizing 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.\n\n## Features \ud83d\udee0\ufe0f\n\nThe currently supported metrics include:\n\n- [Text Quality](https://github.com/whylabs/langkit/blob/main/langkit/docs/features/quality.md)\n  - readability score\n  - complexity and grade scores\n- [Text Relevance](https://github.com/whylabs/langkit/blob/main/langkit/docs/features/relevance.md)\n  - Similarity scores between prompt/responses\n  - Similarity scores against user-defined themes\n- [Security and Privacy](https://github.com/whylabs/langkit/blob/main/langkit/docs/features/security.md)\n  - patterns - count of strings matching a user-defined regex pattern group\n  - jailbreaks - similarity scores with respect to known jailbreak attempts\n  - prompt injection - similarity scores with respect to known prompt injection attacks\n  - refusals - similarity scores with respect to known LLM refusal of service responses\n- [Sentiment and Toxicity](https://github.com/whylabs/langkit/blob/main/langkit/docs/features/sentiment.md)\n  - sentiment analysis\n  - toxicity analysis\n\n## Installation \ud83d\udcbb\n\nTo install LangKit, use the Python Package Index (PyPI) as follows:\n\n```\npip install langkit[all]\n```\n\n## Usage \ud83d\ude80\n\nLangKit 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.\n\n```python\nimport whylogs as why\nfrom langkit import llm_metrics\n\nresults = why.log({\"prompt\": \"Hello!\", \"response\": \"World!\"}, schema=llm_metrics.init())\n```\n\nThe 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](https://whylabs.ai/safeguard-large-language-models?utm_source=github&utm_medium=referral&utm_campaign=langkit) or they can be further analyzed by the user on their own accord.\n\nMore examples are available [here](https://github.com/whylabs/langkit/tree/main/langkit/examples).\n\n## Modules \ud83d\udce6\n\nYou can have more information about the different modules and their metrics [here](https://github.com/whylabs/langkit/blob/main/langkit/docs/modules.md).\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "A language toolkit for monitoring LLM interactions",
    "version": "0.0.31",
    "project_urls": {
        "Homepage": "https://docs.whylabs.ai/docs/large-language-model-monitoring"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1ae6c7e550831ee412cad8b7abc6b664cd6e37b67acd40f0824010b07606e2ce",
                "md5": "1afeebceeaf71fad3d0f227b497487f0",
                "sha256": "052b9a0a710bb2a4319cf407771fa4441cbdc4c5f01d483bdc4545bc94571913"
            },
            "downloads": -1,
            "filename": "langkit-0.0.31-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1afeebceeaf71fad3d0f227b497487f0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4",
            "size": 1221108,
            "upload_time": "2024-03-05T20:18:06",
            "upload_time_iso_8601": "2024-03-05T20:18:06.652363Z",
            "url": "https://files.pythonhosted.org/packages/1a/e6/c7e550831ee412cad8b7abc6b664cd6e37b67acd40f0824010b07606e2ce/langkit-0.0.31-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2f15f57eb4cd41bdfeb908f833b86fb55a67beddeb0883321da28e41114cef1d",
                "md5": "efa1eb6a738af87d98bd46149f422013",
                "sha256": "91d60086a43d0642326e08b591f95105067bcfc7b46788cf41920161e05f9153"
            },
            "downloads": -1,
            "filename": "langkit-0.0.31.tar.gz",
            "has_sig": false,
            "md5_digest": "efa1eb6a738af87d98bd46149f422013",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4",
            "size": 1180526,
            "upload_time": "2024-03-05T20:18:10",
            "upload_time_iso_8601": "2024-03-05T20:18:10.323011Z",
            "url": "https://files.pythonhosted.org/packages/2f/15/f57eb4cd41bdfeb908f833b86fb55a67beddeb0883321da28e41114cef1d/langkit-0.0.31.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-05 20:18:10",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "langkit"
}
        
Elapsed time: 0.24283s