Skip to main content

Inspeq AI SDK

Project description

Inspeq Python SDK : inspeq-py-sdk

Python SDK for Inspeq APIS.

make venv and activate it

for linux based system

python3 -m venv venv
source venv/bin/activate

for windows

python3 -m venv venv
venv\Scripts\activate

Installation

pip install inspeq-py-sdk

Features

Metrices:

  • Factual Consistency: Check if the generated text is consistent with known facts.

  • Grammatical Correctness: Assess the grammatical accuracy of the generated text.

  • Do Not Use Keywords: Identify and evaluate the use of specific keywords or phrases.

  • Fluency: Assess the overall smoothness and fluency of the generated text

  • Answer Relevance: Determine the relevance of the generated text in the context of a given query or

  • Word Limit Test: Check if the generated text adheres to specified word limits.

  • Response Tone: Assess the tone and style of the generated response.

  • Conceptual Similarity: Measure how closely the generated text aligns with the intended conceptual content.

Usage

Get API keys

Get your API keys from Here

Use api key to create your own script.

#import client from Inseq
import os
from dotenv import load_dotenv
from client import Inspeq

# load env file and store your api key variable
load_dotenv()

INSPEQ_SDK_API_KEY=os.getenv("YOUR_INSPEQ_SDK_API_KEY")

#initialization of Inspeq Instance
inspeq_instance = Inspeq(sdk_api_key=INSPEQ_SDK_API_KEY)

# now use this instance to access functions provided by sdk

# Example input data
input_data = {
    "llm_input_query": "your_llm_input_query",
    "llm_input_context": "your_llm_input_context",
    "llm_output": "your_llm_output",
}

'''Note : Do not change the structure of input data keep the structure as it
is. Put your data at places of your_llm_input_context, your_llm_input_query
and your_llm_output to  with the help of our evaluation metrices.

'''
print(inspeq_instance.grammatical_correctness(input_data))
print("\n   grammatical_correctness is:")

All Metrics provided by Inspeq sdk

print("\n  a. factual_consistency is:")
print(inspeq_instance.factual_consistency(input_data))

print("\n b. answer_relevance is:")
print(inspeq_instance.answer_relevance(input_data))

print("\n c. response_tone is:")
print(inspeq_instance.response_tone(input_data))

print("\n  d. grammatical_correctness is:")
print(inspeq_instance.grammatical_correctness(input_data))

print("\n e. fluency is:")
print(inspeq_instance.fluency(input_data))

print("\n f. do_not_use_keywords is:")

print(inspeq_instance.do_not_use_keywords(input_data))

print("\n g. word_limit_test is:")
print(inspeq_instance.word_limit_test(input_data))

print("\n h.  conceptual_similarity is:")
print(inspeq_instance.conceptual_similarity(input_data))

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

inspeqai-0.0.1.tar.gz (7.2 kB view hashes)

Uploaded Source

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