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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: superu-0.0.6.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.6.tar.gz
Algorithm Hash digest
SHA256 47065da884941339b2d34fdb125c9a8c3fdd4d31c1a18c4a3a9357dc6101136c
MD5 0ece7fe2e7e73e49d2754945e47d8e78
BLAKE2b-256 b2e5094824b3e3f0e226161ed266b36150f363f00007a8fdd8b142132bc95046

See more details on using hashes here.

File details

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

File metadata

  • Download URL: superu-0.0.6-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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 2eaea11eec0198e3156bcd5b9af4059a0416830bc47cd81c926e7d1e5f9db8c5
MD5 af223a1a7c24cf5745578cecf3747114
BLAKE2b-256 005ec288ec8bacdc3bb30955bdda5d7cca2d431868986af4e874e0ea9a6cd535

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