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.3.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: superu-0.0.3.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.3.tar.gz
Algorithm Hash digest
SHA256 5ab522189da0aa028080737ba7d7d4f8120d28fe17abf343a5a528075158def6
MD5 ab3e20f20d5ec9ea1162023399688e66
BLAKE2b-256 5fac0fadd2d74670873519e84bd15848b760d93d69b4c4e558ed3569147a44b7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: superu-0.0.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f38038bbb81a2c5a9249fcabc91706e3f24146cf79db1a53f72bfff08916f3ab
MD5 94c2281a9a8118ba90170252ff386c08
BLAKE2b-256 4e93b28e49cea4c4b45893be7818391cd3f6a42b50360d963f628390e7881425

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