Skip to main content

Integ test framework for LLMs.

Project description

Michina

From the quechua word for "pasture".

Unit testing and integration testing for LLMs.

Features

  • [openai] Can run in a Github Actions for workflow

Todo

  • Add monitoring

Versions

v0.2.1 -> v0.2.2

Fixing typo.

v0.1.1 -> v0.2.0

This change allows you to configure the OpenAI model version to use.

The API was like this

from src.prompts import check_for_political_content, respond_to_customer
from michina.checks import ToneCheck, ConsistencyCheck

"""
This is a consistency check. It tests whether your prompt's output 
is consistent with the goal of the test itself.
"""
def test_check_for_political_content_consistent():
    message = "I want to buy a campaign poster for Obama."
    statement = check_for_political_content(message)
    response = ConsistencyCheck.check(message, statement)
    assert response.judgment > 0.5

and now it's like this

from src.prompts import check_for_political_content, respond_to_customer
from michina.checks import ToneCheck, ConsistencyCheck
from os import environ as env

michina_config = {
    'model': 'gpt-3.5-turbo',
    'temperature': 0,
    'openai_api_key': env["OPENAI_API_KEY"],
}

consistency = ConsistencyCheck(**michina_config)

def test_check_for_political_content_consistent():
    message = "I want to buy a campaign poster for Obama."
    statement = check_for_political_content(message)
    response = consistency.check(message, statement)
    assert response.judgment > 0.5

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

michina-0.2.2.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

michina-0.2.2-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file michina-0.2.2.tar.gz.

File metadata

  • Download URL: michina-0.2.2.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.4 Darwin/22.5.0

File hashes

Hashes for michina-0.2.2.tar.gz
Algorithm Hash digest
SHA256 e5872b43b90f2a43eede21fe4871620b9bf5906d7f927707bf9446b493407a17
MD5 1a1b437714995a271b2c78043b313aac
BLAKE2b-256 ac8505cde11bcdc4db788c7f9fc67187244c895739f99032750897e6329503d8

See more details on using hashes here.

File details

Details for the file michina-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: michina-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.4 Darwin/22.5.0

File hashes

Hashes for michina-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e42ae2ecb676ba619a72592e70a428b37343e8f6057f7e2a6fe6b1dfe1c2691b
MD5 2b3ea52dbac0a1dca2eca38d81021385
BLAKE2b-256 1a037a7f1e1c7c6dc0d895eed6d79d80345eb0c78448cc0b8487f785686bdf71

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page