Skip to main content

A package that helps optimize your chatbot response

Project description

superU Python Package

Intent Classification for LLM

This functionality is designed to help you build and test models for intent classification for various user queries. Below, you will find the list of defined classes and how to use the functionality.

Intent categories on user queries:

  • Informational

  • Navigational

  • Transactional

  • Commercial

Additional tags:

  • Human Support (Requested for human support)

  • Support (Looking for help)

  • FAQ

  • Language: {English, Hindi, Mandarin}

User Persona

This functionality is designed to identify the persona of a user based on their conversations or statements. By analyzing the text, it extracts and identifies key aspects of a user's persona, such as age, gender, profession, hobbies, relationship status, and city.

Key data points considered

  • Age

  • Gender

  • City

  • Profession

  • Relationship Status

  • Interests

  • Contact Info

LLM Analytics

This functionality allows you to track metrics (cost, latency, quality) about the usage of your LLM in the chatbot and gain key insights about your users.

Get your API Credentials for LLLM Analytics

To start using the superU's Free Analytics API service, follow these steps:

  1. Visit analytics.superu.ai.

  2. Sign up for a free account or log in if you already have one.

  3. Create a new Project.

  4. Navigate to the Settings > API keys section.

  5. Generate your superU API keys.

Usage

Installing the package

pip install superu

Example Usage

from superu import superU as su

import openai



openai.api_type = ""

openai.api_key = ""

openai.azure_endpoint = ""

openai.api_version = ""



User_Persona = Build_User_Persona(openai, llm_deploymentname='')

Intent_Classifier = Intent_Classification()

LLM_Analysis = LLM_Analytics(public_key="", secret_key="")



# Chatbot Session

user_question = "What is 1 + 1"



intent = Intent_Classification_1.get_intent(user_question)

user_persona = User_Persona_1.build([user_question])   # List of users previous inputs



messages = [{"role": "system", "content":"You are a helpful assistant."}]

message_append = {"role": "user", "content": f"{user_question}"}

messages.append(message_append)

response = openai.chat.completions.create(model="", messages=messages)



# Format data to build analysis

data = {

    "input_messages": messages,                                         # Required - Input Messages 

    "output_messages": response.choices[0].message.content,      # Required - the output from the model

    "metadata": {"user": "test-user", "context": "openai testing"},     # Optional - to give some metadata to the conversation

    "model": response.model,                                     # Required - Name of the model

    "user_id": "",                                                      # Optional - if not given a user_id will be generated

    "usage": response.usage.model_dump(),                        # Optional - usage details to track the model usage and costs

    "name": ""                                                          # Optional - to name the given conversation 

}



LLM_Analysis.analyse(data)

print("Intent: ", intent)

print("User  Details: ", user_persona)

Contributing

We welcome contributions to this project! If you have suggestions for improvements or bug fixes, feel free to open an issue or submit a pull request.

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

superu-0.0.4.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

superu-0.0.4-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file superu-0.0.4.tar.gz.

File metadata

  • Download URL: superu-0.0.4.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.6

File hashes

Hashes for superu-0.0.4.tar.gz
Algorithm Hash digest
SHA256 098bfce023162c5fb6409c4f96055ab639b272a9920fe8c36a20b79ade57a764
MD5 42c8f8e94f13fb5bdf0b4e9a49457e0f
BLAKE2b-256 6b8591d254fdabecd0e17e1deda24b392b1c95f8723a9e7bfe325298b5d05420

See more details on using hashes here.

File details

Details for the file superu-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: superu-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.6

File hashes

Hashes for superu-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 6e211983c5bb4a7c23d95755892e9642c31bc28bbb7590750fb887f4b2314008
MD5 7e71adecc843b8e6c4594c5eaf7af7b8
BLAKE2b-256 48d55c414326f651b9e5900f086c30fabfcf0171450cac460f62f65d4d306a77

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