nlu-core
Multilingual Natural Language Understanding (NLU) engine for customer support chatbots.
Supports English and Bahasa Malaysia (Malay).
Features
- Intent classification — maps customer messages to knowledge-base topics
- Escalation detection — identifies customers who need a human agent
- Conversation summarisation — produces compact conversation summaries for context
- History reply — finds the most relevant previous answer in a conversation
- Product enquiry prompts — builds structured prompts for product recommendation flows
Installation
pip install nlu-core
Quick Start
import pandas as pd
from nlu_core import engine_match, detect_escalation, summarize_conversation
# Load your knowledge base
kb = pd.read_excel("knowledge_base.xlsx", sheet_name="Main DB")
# Classify a customer message
intent, confidence, matched_row = engine_match(
user_question="How do I track my order?",
knowledge_df=kb,
)
# Check for escalation
should_escalate, response = detect_escalation("I want to speak to a manager!")
# Summarise a conversation
summary = summarize_conversation(
history=["Customer: My phone is broken.", "Agent: I can help with that."],
)
API Reference
| Function | Description |
|---|---|
engine_match(user_question, knowledge_df, ...) |
Returns (intent, confidence, matched_row) |
detect_escalation(question) |
Returns (should_escalate: bool, response: str) |
summarize_conversation(history, ...) |
Returns a summary string |
find_relevant_history_reply(history, question, ...) |
Returns the best matching previous reply |
build_product_enquiry_prompt(user_message, stock_json) |
Returns a structured LLM prompt |
Constants
| Name | Description |
|---|---|
DEFAULT_GEMINI_MODEL |
Default primary language model |
DEFAULT_OPENAI_MODEL |
Default translation model |
FALLBACK_GEMINI_MODEL |
Fallback model if primary is unavailable |
LOG_TICKET |
Intent token for support ticket creation |
MATCH_GEMINI_MODEL |
Intent token for product matching |
Requirements
- Python 3.10+
- macOS (Apple Silicon or Intel)
google-genaiopenaipandas
Metadata
Release files for nlu-core 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nlu_core-1.0.0-cp314-cp314-macosx_14_0_arm64.whl | CPython 3.14 | CPython 3.14 | macOS 14.0+ ARM64 | Details for nlu_core-1.0.0-cp314-cp314-macosx_14_0_arm64.whl |
Release files / nlu_core-1.0.0-cp314-cp314-macosx_14_0_arm64.whl
| Download URL | nlu_core-1.0.0-cp314-cp314-macosx_14_0_arm64.whl |
|---|---|
| Size | 64.9 kB |
| Tags | CPython 3.14 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
bf8e8ca0531eabe768b5674b5bbad58ac14024a62fca6279f8ac6d94b51695bd
|
|
BLAKE2b-256 checksum How to use checksums |
86111f7173d48bc904913bcd408496b5bc1ad20e89fa05fca60fc14b4a3df4e8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|
Security for nlu-core 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.