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.

Requirements for building user persona with open source LLaMA3

To inference LLaMA3 on CPU it is necessary to have completed the setup of Ollama.

  1. Ensure you have installed docker on your desktop. You can install it from https://docs.docker.com/engine/install/

  2. Run the below command on your terminal to clone the ollma image on your docker container

docker pull ollama/ollama
  1. Run the docker container using the below command
docker run -d -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama
  1. Go to Exec/Terminal in docker and run the command to install the LLaMA3 model
ollama run llama3
  1. Once you have completed the above steps, you can successfully build user persona using open source LLaMA3 via Ollama

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

import openai

import superu



openai.api_type = ""

openai.api_key = ""

openai.azure_endpoint = ""

openai.api_version = ""

User_Persona_1 = superu.superU.Build_User_Persona_OpenAI(openai, llm_deploymentname='')

User_Persona_2 = superu.superU.Build_User_Persona_LLaMA3()

Intent_Classification_1 = superu.superU.Intent_Classification()



prompt = "What is 1 + 1"



intent = Intent_Classification_1.get_intent(prompt)

user_persona_openai = User_Persona_1.build([prompt])

user_persona_llama3 = User_Persona_2.build([prompt])





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

message_r = {"role": "user", "content": f"{prompt}"}

messages.append(message_r)

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



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": "pip package test",                                                      # 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": "test"                                                          # Optional - to name the given conversation 

}



service_client = superu.superU.LLM_Analytics(public_key="", secret_key="")



service_client.analyse(data)



print("Intent: ", intent)

print("User Details OpenAI: ", user_persona_openai)

print("User Details LLaMA3: ", user_persona_llama3)

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

Uploaded Source

Built Distribution

superu-0.0.8-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: superu-0.0.8.tar.gz
  • Upload date:
  • Size: 12.5 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.8.tar.gz
Algorithm Hash digest
SHA256 9b316e91bf5472f4c7a0efc2273e9493cdd078891949f793f290c9b3c4795ade
MD5 9c5eee6f183b1152a24ae05b456b1b81
BLAKE2b-256 a93bf85be45d530f733e46b6e04fe618e15ba9a990d78dd7443d5d15d29ddc08

See more details on using hashes here.

File details

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

File metadata

  • Download URL: superu-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 12.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.8-py3-none-any.whl
Algorithm Hash digest
SHA256 a028dc8c61187278c719aaa9810c5236485d1e2b60b6f919152d652e8bd00508
MD5 8e2126f93d5268816d39ad917ce6c81d
BLAKE2b-256 54f9a0ed367dddc4f3985c5cd4cdb54b86c74339d76fe5a800d615f97790a0a1

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