Skip to main content

EVALMY.AI Python library

Project description

EVALMY.AI

Python client library for EVALMY.AI, a public service for evaluating GPT answers based on semantics.

This service enables cost-effective, reliable, and consistent automated testing of GenAI solutions like RAGs and others.

Using EVALMY.AI, you can accelerate your development process, reduce testing costs and enhance the reliability of your AI applications.

Example

You are developing a RAG (Retrieval-Augmented Generation) to answer simple geographical questions. It's essential to test its performance both during development and after release to ensure the model maintains its accuracy. For this purpose, you create a set of test questions along with their respective correct answers.

1. What is the capital of France?               --> Paris
2. What are three longest rivers in the world?  --> Nile, Amazon, Yanktze
3. Which continent is the second smallest?      --> Europe

Your RAG provides following answers:

1. The capital of France is Paris.
2. Nile, Mississippi and Amazon.
3. The second smallest continent in the world is Australia.

Pretty well but not yet perfect.

Reading through long sets of AI-generated answers can become tedious and monotonous, especially if the test set remains unchanged. This costs time and can lead to people making errors.

Fortunately, AI can handle the task for us. With the help of EVALMY.AI, simply send us the questions along with the expected and actual answers, and you'll receive the results effortlessly.

CONTRADICTIONS IN TEXTS:
1. Score: 1.0, 
Reasoning: "Both texts identify the capital of France correctly."

2. Score: 0.5,
Severity: Large
Reasoning: "Different rivers listed as the three longest." 

3. Score: 0.0, 
Severity: Critical
Reasoning: Different continents identified as the second smallest.

Instalation

The evalmyai requires python 3.8 or higher.

python -m pip install evalmyai 

Simple usage

from evalmyai import Evaluator

data = {
    "expected": "Jane is twelve.",
    "actual": "Jane is 12 yrs, 7 mths and 3 days old."
}

ev = Evaluator(...) # see authentication later

result = ev.evaluate(data)

print(result['contradictions'])

The result of the evaluation is as follows:

{
    "contradictions": {
        "scores": {
            "score": 1.0
        },
        "reasoning": {
            "statements": [
                {
                    "severity": "negligible",
                    "summary": "Different descriptions of Jane's age.",
                    "reasoning": "The statement from <TEXT 1> 'Jane is twelve.' is a general statement about Jane's age, indicating that she is twelve years old. The statement from <TEXT 2> 'Jane is 12 yrs, 7 mths and 3 days old.' provides a more precise age, including years, months, and days. There is no contradiction between these statements as the second text simply provides more detail about Jane's age, but does not conflict with the first text's assertion that she is twelve years old."
                }
            ]
        }
    }
}

Authentication

First, you need your EVALMY.AI service token, which you can get here.

The service runs on your own instance of GPT, either in Azure or directly on an OpenAI endpoint you provide.

Due to capacity limits per organization, we cannot provide an GPT endpoint directly.

Azure

If you use an Azure endpoint, the configuration should look like this:

from evalmyai import AzureAuth, Evaluator

token = "YOUR_EVALMYAI_TOKEN_expected_to_be_64_characters_long_CHANGE_IT!"

auth_azure = AzureAuth(
    api_key="cd0...101",
    azure_endpoint="https://...azure.com/",
    api_version="2023-07-01-preview",
    azure_deployment="...",
)

ev = Evaluator(auth_azure, token)

OpenAI

In case you use OpenAI endpoint, the configuration should look like this:

from evalmyai import OpenAIAuth, Evaluator

token = "YOUR_EVALMYAI_TOKEN_expected_to_be_64_characters_long_CHANGE_IT!"

auth_open_ai = OpenAIAuth(
    api_key= "...",
    model= "gpt-4" # select your model, we strongly recommend GPT-4.
)

ev = Evaluator(auth_open_ai, token)

The EVLAMY.AI tutorial with practical exmaples can be found here.

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

evalmyai-0.1.0a12.tar.gz (21.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

evalmyai-0.1.0a12-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

Details for the file evalmyai-0.1.0a12.tar.gz.

File metadata

  • Download URL: evalmyai-0.1.0a12.tar.gz
  • Upload date:
  • Size: 21.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.7

File hashes

Hashes for evalmyai-0.1.0a12.tar.gz
Algorithm Hash digest
SHA256 49395d13bc6c8e2c9ea6765d3c3ad007d1c2151319bd6f17c0b5858afacca7dc
MD5 a0fe2c5531341cb1dc0829d5965ec7c5
BLAKE2b-256 136ade248bd22bd821ec5f6bc1fdb2a8aa385b55240a5ffebb184a6bc075c591

See more details on using hashes here.

File details

Details for the file evalmyai-0.1.0a12-py3-none-any.whl.

File metadata

  • Download URL: evalmyai-0.1.0a12-py3-none-any.whl
  • Upload date:
  • Size: 18.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.7

File hashes

Hashes for evalmyai-0.1.0a12-py3-none-any.whl
Algorithm Hash digest
SHA256 4218e8fe40dd73e00bfd593196bc040111a47f18cc2d4bbc26edf7f55b0bafa0
MD5 d118ee387514b6ba93aa65bc817cdb4a
BLAKE2b-256 30f39caf279f9d29b5d65dd49d633d25d945776b3792d2e99b223f109ae4053b

See more details on using hashes here.

Supported by

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