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

Uploaded Source

Built Distribution

superu-0.0.5-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: superu-0.0.5.tar.gz
  • Upload date:
  • Size: 11.1 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.5.tar.gz
Algorithm Hash digest
SHA256 2ff4580f73cc6e1eaba41d4a4748676df43c88b58ecc737f97fad1cf520b150f
MD5 689e57536e50b2e53cfa753c2c35f606
BLAKE2b-256 2ef34a60b3a3842d36c2b1a691fe5886159fc0b22973d162cb24a4f4c6b7c210

See more details on using hashes here.

File details

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

File metadata

  • Download URL: superu-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 11.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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 d5850d893483545a31326492d8c53a57d3bb7af5d92a9c5d1ce2773eb19b95f9
MD5 8e1569e3ab2f4445995c22e5ff04196a
BLAKE2b-256 272f5ddc9cae65a468ad966b980d77bc92bebdfe5f700008e2e7c89d2b7afa93

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