Skip to main content
Meez - AI Assistant and Copilot SDK for SaaS Applications

PyPI-Server Build Status License PyPI Downloads

Meez

AI Assistant and Copilot SDK for SaaS Applications

Meez is a powerful Python library that provides AI-powered assistance capabilities for SaaS applications. It offers intention detection, contextual responses, and workflow automation using LangChain and LangGraph.

Features

  • Intention Detection: Automatically detect user intentions from natural language input

  • Contextual Responses: Generate intelligent responses based on provided context data

  • Workflow Automation: Create complex AI workflows using LangGraph

  • Multiple Data Sources: Support for text, JSON, and file-based data sources

  • OpenAI Integration: Built on top of OpenAI’s GPT models for reliable AI responses

  • Flexible Architecture: Modular design for easy integration and customization

Installation

Install Meez using pip:

pip install Meez

Quick Start

  1. Set up your OpenAI API key:

import os
os.environ["OPENAI_API_KEY"] = "your-openai-api-key-here"
  1. Basic intention detection:

from meez.core import Langchain, Intention

# Initialize LangChain
langchain = Langchain(openai_api_key="your-api-key")

# Define possible intentions
intentions = ["greeting", "weather", "help", "goodbye", "unknown"]

# Create intention detector
detector = Intention(langchain=langchain, intentions=intentions)

# Detect intention
user_input = "Hello there!"
intention = detector.detect(user_input)
print(f"Detected intention: {intention}")
  1. Contextual responses:

from meez.core import Langchain, Respond
from meez.data import TextReader

# Initialize components
langchain = Langchain(openai_api_key="your-api-key")
respond = Respond(langchain)

# Create data source
context_data = "Python is a high-level programming language..."
data_reader = TextReader(context_data)

# Get contextual response
question = "What is Python?"
response = respond.run(question=question, data=data_reader)
print(f"Response: {response}")

Usage Examples

Intention Detection

Detect user intentions from natural language:

import os
from meez.core import Langchain, Intention

# Setup
api_key = os.getenv("OPENAI_API_KEY")
langchain = Langchain(openai_api_key=api_key)

# Define intentions
intentions = [
    "greeting",
    "weather",
    "joke",
    "help",
    "goodbye",
    "book_appointment",
    "cancel_appointment",
    "unknown"
]

# Create detector
detector = Intention(langchain=langchain, intentions=intentions)

# Test inputs
test_texts = [
    "Hello there!",
    "What's the weather like?",
    "I need to book an appointment",
    "Can you help me cancel my appointment?"
]

for text in test_texts:
    intention = detector.detect(text)
    print(f"'{text}' → {intention}")

Contextual Responses

Generate responses based on context data:

from meez.core import Langchain, Respond
from meez.data import TextReader, JsonReader, FileReader

# Initialize
langchain = Langchain(openai_api_key=api_key)
respond = Respond(langchain)

# Using text data
text_data = "Artificial Intelligence is a branch of computer science..."
text_reader = TextReader(text_data)

response = respond.run(
    question="What is AI?",
    data=text_reader
)

# Using JSON data
json_data = {"company": {"name": "TechCorp", "employees": 250}}
json_reader = JsonReader(json_data)

response = respond.run(
    question="How many employees does the company have?",
    data=json_reader
)

# Using file data
file_reader = FileReader("documentation.txt")
response = respond.run(
    question="What are the main features?",
    data=file_reader
)

General Respond

Respond to general user questions using AI knowledge:

from meez.core import Langchain, GeneralRespond

# Initialize
langchain = Langchain(openai_api_key=api_key)
respond = GeneralRespond(langchain)

# Get response
question = "What is the capital of France?"
response = respond.run(question=question)
print(f"Response: {response}")

Workflow Automation with LangGraph

Create complex AI workflows:

from meez.core.langgraph import LangGraph, MainState
from meez.core import Langchain, Intention

# Define workflow nodes
def get_intent(state: MainState) -> MainState:
    # Detect user intention
    detector = Intention(langchain, ["get_phone", "get_email", "unknown"])
    intent = detector.detect(state["messages"][-1]["content"])
    state["messages"].append({"role": "assistant", "content": intent, "internal": True})
    return state

def decide(state: MainState) -> str:
    # Return the detected intent to determine next step
    return state["messages"][-1]["content"]

def get_phone(state: MainState) -> MainState:
    state["messages"].append({"role": "assistant", "content": "Phone: +1234567890"})
    return state

def get_email(state: MainState) -> MainState:
    state["messages"].append({"role": "assistant", "content": "Email: support@company.com"})
    return state

def unknown(state: MainState) -> MainState:
    state["messages"].append({"role": "assistant", "content": "I'm sorry, I don't know that."})
    return state

# Create and configure graph
graph = LangGraph()
graph.add_node("get_intent", get_intent)
graph.add_node("decide", decide)
graph.add_node("get_phone", get_phone)
graph.add_node("get_email", get_email)
graph.add_node("unknown", unknown)

graph.set_entry_point("get_intent")
graph.add_conditional_edge("get_intent", decide)
graph.add_finish_point("get_phone")
graph.add_finish_point("get_email")
graph.add_finish_point("unknown")

# Run workflow
initial_state = {"messages": [{"role": "user", "content": "What's your phone number?"}]}
result = graph.run(initial_state)

Examples

See the examples/ directory for complete working examples:

  • intention_detection.py - Basic intention detection

  • respond_to_user.py - Contextual responses with different data sources

  • complex_graph.py - Advanced workflow automation

  • sample_graph.py - Simple graph workflow

  • sample_assistant.py - Complete assistant implementation

Development

Setup Development Environment

# Clone the repository
git clone https://github.com/clivern/meez.git
cd meez

# Install development dependencies
pip install -r requirements.test.txt
pip install -e .

Running Tests

# Run tests
make ci

Support

Changelog

See CHANGELOG.rst for a detailed history of changes.

Release files for Meez 0.3.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Meez 0.3.4
File Size Uploaded
meez-0.3.4.tar.gz 25.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for Meez 0.3.4
File Interpreter ABI Platform
meez-0.3.4-py3-none-any.whl Python 3 none any Details

Total release size: 45.9 kB

Release files / meez-0.3.4.tar.gz

Download URL meez-0.3.4.tar.gz
Size 25.9 kB
Tags Source
SHA-256 checksum
How to use checksums
0e2d4e56235995ebe1fb22c945cb08811a6181ffb0ceac6f2c1d757aa12a5713
BLAKE2b-256 checksum
How to use checksums
d0c207b99a00524494fb4ef7c95f1d02aa1943cb4a21ede7b87c162289422986
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.23

Release files / meez-0.3.4-py3-none-any.whl

Download URL meez-0.3.4-py3-none-any.whl
Size 20.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1103d68b07c5c54ef9870a8450951d8d13914aac8929e2ba3eae0665dd73fc96
BLAKE2b-256 checksum
How to use checksums
2aec38d66a78ab80fca405395018d06ac54851ad3b4093b8dcc05a4864089f91
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.23

Release history Release notifications | RSS feed

This release

0.3.4 This release

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.22

2 release files

0.2.21

2 release files

0.2.20

2 release files

0.2.19

2 release files

0.2.16

2 release files

0.2.15

2 release files

0.2.14

2 release files

0.2.13

2 release files

0.2.12

2 release files

0.2.11

2 release files

0.2.10

2 release files

0.2.9

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page