# Lexia Platform Package
Clean, minimal package for Lexia platform integration. Contains only essential components for communication with the Lexia platform.
## ๐ Quick Start
### Option 1: Install from PyPI (Recommended)
```bash
pip install lexia
```
### Option 2: Install with web dependencies
```bash
pip install lexia[web]
```
### Option 3: Install for development
```bash
pip install lexia[dev]
```
### Option 4: Install from source
```bash
# Clone the repository
git clone https://github.com/yourusername/lexia-platform.git
cd lexia-platform
# Install in editable mode
pip install -e .
```
## ๐ฆ Package Information
- **Package Name**: `lexia`
- **Version**: 1.1.0
- **Python**: >=3.8
- **License**: MIT
- **Dependencies**: requests, pydantic
- **Optional**: fastapi, uvicorn (web), pytest, black, flake8 (dev)
## ๐ฏ Purpose
This package provides a clean interface for your AI agent to communicate with the Lexia platform. It handles all Lexia-specific communication while keeping your AI agent completely platform-agnostic.
## ๐ Usage
### Basic Usage
```python
from lexia import LexiaHandler, ChatMessage, create_success_response
# Initialize the handler
lexia = LexiaHandler()
# Use in your AI agent
async def process_message(data: ChatMessage):
# Your AI logic here...
response = "Hello from your AI agent!"
lexia.complete_response(data, response)
```
### FastAPI Integration
```python
from fastapi import FastAPI
from lexia import create_lexia_app, add_standard_endpoints, LexiaHandler
# Create FastAPI app
app = create_lexia_app(title="My AI Agent")
# Initialize Lexia handler
lexia = LexiaHandler()
# Add standard endpoints
add_standard_endpoints(
app,
lexia_handler=lexia,
process_message_func=your_ai_function
)
```
## ๐ Structure
```
lexia/
โโโ __init__.py # Clean exports only
โโโ models.py # Lexia data models (ChatMessage, ChatResponse, Variable)
โโโ response_handler.py # Response creation utilities
โโโ unified_handler.py # Single communication interface
โโโ api_client.py # HTTP communication with Lexia backend
โโโ centrifugo_client.py # Real-time updates via Centrifugo
โโโ utils.py # Platform utilities (env vars, API keys)
โโโ web/ # FastAPI web framework utilities
โ โโโ __init__.py
โ โโโ app_factory.py
โ โโโ endpoints.py
โโโ requirements.txt # Package dependencies
โโโ README.md # This file
```
## ๐ Core Components
### 1. LexiaHandler (Main Interface)
**Purpose**: Single, clean interface for all Lexia communication
```python
from lexia import LexiaHandler
lexia = LexiaHandler()
# Stream AI response chunks
lexia.stream_chunk(data, content)
# Complete AI response (handles all Lexia communication)
lexia.complete_response(data, full_response)
# Send error messages
lexia.send_error(data, error_message)
```
### 2. Data Models
**Purpose**: Lexia's expected data formats
```python
from lexia import ChatMessage, ChatResponse, Variable
# ChatMessage - Lexia's request format
# ChatResponse - Lexia's expected response format
# Variable - Environment variables from Lexia
```
### 3. Response Handler
**Purpose**: Create Lexia-compatible responses
```python
from lexia import create_success_response
response = create_success_response(
response_uuid="uuid123",
thread_id="thread456"
)
```
## ๐ก Complete Usage Examples
### Example 1: Minimal AI Agent with FastAPI
```python
# main.py
import asyncio
from fastapi import FastAPI
from lexia import (
LexiaHandler,
ChatMessage,
create_success_response,
create_lexia_app,
add_standard_endpoints
)
# Initialize services
lexia = LexiaHandler()
# Create FastAPI app using Lexia's utilities
app = create_lexia_app(
title="My AI Agent",
version="1.1.0",
description="Custom AI agent with Lexia integration"
)
# Define your AI logic
async def process_message(data: ChatMessage):
"""Your custom AI processing logic goes here."""
try:
# Example: Simple echo response
response = f"AI Agent processed: {data.message}"
# Stream response chunks (optional)
for word in response.split():
lexia.stream_chunk(data, word + " ")
await asyncio.sleep(0.1) # Simulate processing time
# Complete the response
lexia.complete_response(data, response)
except Exception as e:
lexia.send_error(data, str(e))
# Add all standard Lexia endpoints
add_standard_endpoints(
app,
conversation_manager=None, # Add your conversation manager if needed
lexia_handler=lexia,
process_message_func=process_message
)
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="0.0.0.0", port=8000)
```
### Example 2: OpenAI Integration
```python
# openai_agent.py
import asyncio
from openai import OpenAI
from lexia import LexiaHandler, ChatMessage, create_lexia_app, add_standard_endpoints
class OpenAIAgent:
def __init__(self, api_key: str):
self.client = OpenAI(api_key=api_key)
self.lexia = LexiaHandler()
async def process_message(self, data: ChatMessage):
"""Process message using OpenAI and send via Lexia."""
try:
# Get OpenAI API key from variables
api_key = None
for var in data.variables:
if var.name == "OPENAI_API_KEY":
api_key = var.value
break
if not api_key:
self.lexia.send_error(data, "OpenAI API key not found")
return
# Create OpenAI client
client = OpenAI(api_key=api_key)
# Stream response from OpenAI
stream = client.chat.completions.create(
model=data.model,
messages=[{"role": "user", "content": data.message}],
max_tokens=1000,
temperature=0.7,
stream=True
)
# Stream chunks to Lexia
full_response = ""
for chunk in stream:
if chunk.choices[0].delta.content:
content = chunk.choices[0].delta.content
full_response += content
self.lexia.stream_chunk(data, content)
# Complete response
self.lexia.complete_response(data, full_response)
except Exception as e:
self.lexia.send_error(data, str(e))
# Create FastAPI app
app = create_lexia_app(title="OpenAI Agent", version="1.1.0")
# Initialize agent
agent = OpenAIAgent(api_key="your-api-key-here")
# Add endpoints
add_standard_endpoints(
app,
conversation_manager=None,
lexia_handler=agent.lexia,
process_message_func=agent.process_message
)
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="0.0.0.0", port=8000)
```
### Example 3: Custom Endpoints with Lexia
```python
# custom_agent.py
from fastapi import FastAPI
from lexia import (
LexiaHandler,
ChatMessage,
create_lexia_app,
add_standard_endpoints
)
# Initialize
lexia = LexiaHandler()
app = create_lexia_app(title="Custom Agent", version="1.1.0")
# Your custom AI logic
async def process_message(data: ChatMessage):
response = f"Custom AI processed: {data.message}"
lexia.complete_response(data, response)
# Add standard endpoints
add_standard_endpoints(
app,
conversation_manager=None,
lexia_handler=lexia,
process_message_func=process_message
)
# Add your custom endpoints
@app.post("/api/v1/custom_action")
async def custom_action(data: ChatMessage):
"""Custom endpoint that doesn't use Lexia communication."""
return {"message": "Custom action executed", "input": data.message}
@app.get("/api/v1/agent_status")
async def agent_status():
"""Get agent status."""
return {"status": "active", "version": "1.1.0"}
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="0.0.0.0", port=8000)
```
### Example 4: Environment Variables and Configuration
```python
# config_agent.py
import os
from lexia import LexiaHandler, ChatMessage, create_lexia_app, add_standard_endpoints
from lexia.utils import set_env_variables, get_openai_api_key
# Initialize
lexia = LexiaHandler()
app = create_lexia_app(title="Config Agent", version="1.1.0")
async def process_message(data: ChatMessage):
"""Process message with environment configuration."""
try:
# Set environment variables from Lexia request
set_env_variables(data.variables)
# Get configured API key
api_key = get_openai_api_key(data.variables)
if not api_key:
lexia.send_error(data, "API key not configured")
return
# Your AI logic here...
response = f"Processed with config: {data.message}"
lexia.complete_response(data, response)
except Exception as e:
lexia.send_error(data, str(e))
# Add endpoints
add_standard_endpoints(
app,
conversation_manager=None,
lexia_handler=lexia,
process_message_func=process_message
)
```
## ๐ง What This Package Handles
โ
**Real-time streaming** via Centrifugo
โ
**Backend communication** with Lexia
โ
**Response formatting** for Lexia compatibility
โ
**Data validation** with Pydantic models
โ
**Error handling** and notifications
โ
**FastAPI integration** with standard endpoints
โ
**Environment variable management**
โ
**API key handling**
## โ What This Package Does NOT Handle
โ **AI/LLM processing** (that's your agent's job)
โ **Conversation memory** (that's in your `memory/` module)
โ **Business logic** (that's in your main application)
โ **Database operations**
โ **Authentication/Authorization**
## ๐ฏ Design Principles
1. **Single Responsibility**: Each component has one clear purpose
2. **Clean Interface**: Simple, intuitive methods
3. **Platform Agnostic**: Your AI agent doesn't know about Lexia internals
4. **Minimal Dependencies**: Only what's absolutely necessary
5. **Easy Testing**: Simple, focused components
## ๐ Benefits
- **Clean separation** between your AI agent and Lexia
- **Easy to maintain** - all Lexia logic in one place
- **Easy to replace** - switch platforms by replacing this package
- **Professional structure** - clean, organized code
- **Fast development** - no complex integrations to manage
- **Drop-in replacement** - copy folder and start using immediately
## ๐ Integration Flow
```
Your AI Agent โ LexiaHandler โ Lexia Platform
โ โ โ
OpenAI/LLM Communication Real-time + Backend
```
Your AI agent focuses on AI logic, this package handles all Lexia communication complexity behind a clean interface.
## ๐ Development Setup
### Using Make (Recommended)
```bash
# Show available commands
make help
# Setup development environment
make dev
source lexia_env/bin/activate
make deps
# Build and test
make build
make test
make install
```
### Using Python Scripts
```bash
# Build and test
python build_package.py all
# Just build
python build_package.py build
# Install locally
python build_package.py install
```
### Manual Setup
```bash
# Create virtual environment
python3 -m venv lexia_env
source lexia_env/bin/activate
# Install dependencies
pip install -r lexia/requirements.txt
pip install build twine
# Build package
python -m build
# Install locally
pip install -e .
```
## ๐งช Testing Your Integration
```python
# test_lexia.py
import pytest
from lexia import LexiaHandler, ChatMessage, Variable
def test_lexia_handler():
"""Test basic LexiaHandler functionality."""
handler = LexiaHandler()
# Create test data
test_data = ChatMessage(
thread_id="test123",
model="gpt-4",
message="Hello",
conversation_id=1,
response_uuid="uuid123",
message_uuid="msg123",
channel="test",
file_type="",
file_url="",
variables=[],
url="http://test.com",
url_update="",
url_upload="",
force_search=False,
system_message=None,
memory=[],
project_system_message=None,
first_message=False,
project_id="",
project_files=None
)
# Test that handler can be created
assert handler is not None
assert hasattr(handler, 'stream_chunk')
assert hasattr(handler, 'complete_response')
assert hasattr(handler, 'send_error')
if __name__ == "__main__":
pytest.main([__file__])
```
## ๐จ Common Issues and Solutions
### Issue: Import Error
```bash
ModuleNotFoundError: No module named 'lexia'
```
**Solution**: Make sure you're in the correct directory or add the lexia folder to your Python path.
### Issue: Missing Dependencies
```bash
ImportError: No module named 'fastapi'
```
**Solution**: Install requirements: `pip install -r lexia/requirements.txt` or use `pip install lexia[web]`
### Issue: Lexia Communication Fails
**Solution**: Check that your environment variables and API keys are properly configured in the Lexia request variables.
## ๐ฆ Publishing to PyPI
### Test PyPI (Recommended for testing)
```bash
# Build package
make build
# Upload to Test PyPI
make publish-test
```
### Production PyPI
```bash
# Build package
make build
# Upload to PyPI (requires credentials)
make publish
```
## ๐ Support
When you install this package:
1. All Lexia communication is handled automatically
2. Standard endpoints are provided out-of-the-box
3. Your AI agent remains completely platform-agnostic
4. You can focus on building your AI logic, not integration code
The package is designed to be a drop-in solution - just `pip install lexia` and start building your AI agent!
## ๐ License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
Raw data
{
"_id": null,
"home_page": "https://github.com/yourusername/lexia",
"name": "lexia",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "Your Name <your.email@example.com>",
"keywords": "lexia, ai, chatbot, platform, integration, fastapi, real-time",
"author": "Your Name",
"author_email": "Your Name <your.email@example.com>",
"download_url": "https://files.pythonhosted.org/packages/e2/40/b1fd2a8b7e6f24851e9d951dec09252e08754ed838d4209b5fe50e8a2566/lexia-1.1.0.tar.gz",
"platform": null,
"description": "# Lexia Platform Package\n\nClean, minimal package for Lexia platform integration. Contains only essential components for communication with the Lexia platform.\n\n## \ud83d\ude80 Quick Start\n\n### Option 1: Install from PyPI (Recommended)\n```bash\npip install lexia\n```\n\n### Option 2: Install with web dependencies\n```bash\npip install lexia[web]\n```\n\n### Option 3: Install for development\n```bash\npip install lexia[dev]\n```\n\n### Option 4: Install from source\n```bash\n# Clone the repository\ngit clone https://github.com/yourusername/lexia-platform.git\ncd lexia-platform\n\n# Install in editable mode\npip install -e .\n```\n\n## \ud83d\udce6 Package Information\n\n- **Package Name**: `lexia`\n- **Version**: 1.1.0\n- **Python**: >=3.8\n- **License**: MIT\n- **Dependencies**: requests, pydantic\n- **Optional**: fastapi, uvicorn (web), pytest, black, flake8 (dev)\n\n## \ud83c\udfaf Purpose\n\nThis package provides a clean interface for your AI agent to communicate with the Lexia platform. It handles all Lexia-specific communication while keeping your AI agent completely platform-agnostic.\n\n## \ud83d\ude80 Usage\n\n### Basic Usage\n```python\nfrom lexia import LexiaHandler, ChatMessage, create_success_response\n\n# Initialize the handler\nlexia = LexiaHandler()\n\n# Use in your AI agent\nasync def process_message(data: ChatMessage):\n # Your AI logic here...\n response = \"Hello from your AI agent!\"\n lexia.complete_response(data, response)\n```\n\n### FastAPI Integration\n```python\nfrom fastapi import FastAPI\nfrom lexia import create_lexia_app, add_standard_endpoints, LexiaHandler\n\n# Create FastAPI app\napp = create_lexia_app(title=\"My AI Agent\")\n\n# Initialize Lexia handler\nlexia = LexiaHandler()\n\n# Add standard endpoints\nadd_standard_endpoints(\n app, \n lexia_handler=lexia,\n process_message_func=your_ai_function\n)\n```\n\n## \ud83d\udcc1 Structure\n\n```\nlexia/\n\u251c\u2500\u2500 __init__.py # Clean exports only\n\u251c\u2500\u2500 models.py # Lexia data models (ChatMessage, ChatResponse, Variable)\n\u251c\u2500\u2500 response_handler.py # Response creation utilities\n\u251c\u2500\u2500 unified_handler.py # Single communication interface\n\u251c\u2500\u2500 api_client.py # HTTP communication with Lexia backend\n\u251c\u2500\u2500 centrifugo_client.py # Real-time updates via Centrifugo\n\u251c\u2500\u2500 utils.py # Platform utilities (env vars, API keys)\n\u251c\u2500\u2500 web/ # FastAPI web framework utilities\n\u2502 \u251c\u2500\u2500 __init__.py\n\u2502 \u251c\u2500\u2500 app_factory.py\n\u2502 \u2514\u2500\u2500 endpoints.py\n\u251c\u2500\u2500 requirements.txt # Package dependencies\n\u2514\u2500\u2500 README.md # This file\n```\n\n## \ud83d\ude80 Core Components\n\n### 1. LexiaHandler (Main Interface)\n**Purpose**: Single, clean interface for all Lexia communication\n\n```python\nfrom lexia import LexiaHandler\n\nlexia = LexiaHandler()\n\n# Stream AI response chunks\nlexia.stream_chunk(data, content)\n\n# Complete AI response (handles all Lexia communication)\nlexia.complete_response(data, full_response)\n\n# Send error messages\nlexia.send_error(data, error_message)\n```\n\n### 2. Data Models\n**Purpose**: Lexia's expected data formats\n\n```python\nfrom lexia import ChatMessage, ChatResponse, Variable\n\n# ChatMessage - Lexia's request format\n# ChatResponse - Lexia's expected response format \n# Variable - Environment variables from Lexia\n```\n\n### 3. Response Handler\n**Purpose**: Create Lexia-compatible responses\n\n```python\nfrom lexia import create_success_response\n\nresponse = create_success_response(\n response_uuid=\"uuid123\",\n thread_id=\"thread456\"\n)\n```\n\n## \ud83d\udca1 Complete Usage Examples\n\n### Example 1: Minimal AI Agent with FastAPI\n\n```python\n# main.py\nimport asyncio\nfrom fastapi import FastAPI\nfrom lexia import (\n LexiaHandler, \n ChatMessage, \n create_success_response,\n create_lexia_app,\n add_standard_endpoints\n)\n\n# Initialize services\nlexia = LexiaHandler()\n\n# Create FastAPI app using Lexia's utilities\napp = create_lexia_app(\n title=\"My AI Agent\",\n version=\"1.1.0\",\n description=\"Custom AI agent with Lexia integration\"\n)\n\n# Define your AI logic\nasync def process_message(data: ChatMessage):\n \"\"\"Your custom AI processing logic goes here.\"\"\"\n try:\n # Example: Simple echo response\n response = f\"AI Agent processed: {data.message}\"\n \n # Stream response chunks (optional)\n for word in response.split():\n lexia.stream_chunk(data, word + \" \")\n await asyncio.sleep(0.1) # Simulate processing time\n \n # Complete the response\n lexia.complete_response(data, response)\n \n except Exception as e:\n lexia.send_error(data, str(e))\n\n# Add all standard Lexia endpoints\nadd_standard_endpoints(\n app, \n conversation_manager=None, # Add your conversation manager if needed\n lexia_handler=lexia,\n process_message_func=process_message\n)\n\nif __name__ == \"__main__\":\n import uvicorn\n uvicorn.run(app, host=\"0.0.0.0\", port=8000)\n```\n\n### Example 2: OpenAI Integration\n\n```python\n# openai_agent.py\nimport asyncio\nfrom openai import OpenAI\nfrom lexia import LexiaHandler, ChatMessage, create_lexia_app, add_standard_endpoints\n\nclass OpenAIAgent:\n def __init__(self, api_key: str):\n self.client = OpenAI(api_key=api_key)\n self.lexia = LexiaHandler()\n \n async def process_message(self, data: ChatMessage):\n \"\"\"Process message using OpenAI and send via Lexia.\"\"\"\n try:\n # Get OpenAI API key from variables\n api_key = None\n for var in data.variables:\n if var.name == \"OPENAI_API_KEY\":\n api_key = var.value\n break\n \n if not api_key:\n self.lexia.send_error(data, \"OpenAI API key not found\")\n return\n \n # Create OpenAI client\n client = OpenAI(api_key=api_key)\n \n # Stream response from OpenAI\n stream = client.chat.completions.create(\n model=data.model,\n messages=[{\"role\": \"user\", \"content\": data.message}],\n max_tokens=1000,\n temperature=0.7,\n stream=True\n )\n \n # Stream chunks to Lexia\n full_response = \"\"\n for chunk in stream:\n if chunk.choices[0].delta.content:\n content = chunk.choices[0].delta.content\n full_response += content\n self.lexia.stream_chunk(data, content)\n \n # Complete response\n self.lexia.complete_response(data, full_response)\n \n except Exception as e:\n self.lexia.send_error(data, str(e))\n\n# Create FastAPI app\napp = create_lexia_app(title=\"OpenAI Agent\", version=\"1.1.0\")\n\n# Initialize agent\nagent = OpenAIAgent(api_key=\"your-api-key-here\")\n\n# Add endpoints\nadd_standard_endpoints(\n app,\n conversation_manager=None,\n lexia_handler=agent.lexia,\n process_message_func=agent.process_message\n)\n\nif __name__ == \"__main__\":\n import uvicorn\n uvicorn.run(app, host=\"0.0.0.0\", port=8000)\n```\n\n### Example 3: Custom Endpoints with Lexia\n\n```python\n# custom_agent.py\nfrom fastapi import FastAPI\nfrom lexia import (\n LexiaHandler, \n ChatMessage, \n create_lexia_app, \n add_standard_endpoints\n)\n\n# Initialize\nlexia = LexiaHandler()\napp = create_lexia_app(title=\"Custom Agent\", version=\"1.1.0\")\n\n# Your custom AI logic\nasync def process_message(data: ChatMessage):\n response = f\"Custom AI processed: {data.message}\"\n lexia.complete_response(data, response)\n\n# Add standard endpoints\nadd_standard_endpoints(\n app,\n conversation_manager=None,\n lexia_handler=lexia,\n process_message_func=process_message\n)\n\n# Add your custom endpoints\n@app.post(\"/api/v1/custom_action\")\nasync def custom_action(data: ChatMessage):\n \"\"\"Custom endpoint that doesn't use Lexia communication.\"\"\"\n return {\"message\": \"Custom action executed\", \"input\": data.message}\n\n@app.get(\"/api/v1/agent_status\")\nasync def agent_status():\n \"\"\"Get agent status.\"\"\"\n return {\"status\": \"active\", \"version\": \"1.1.0\"}\n\nif __name__ == \"__main__\":\n import uvicorn\n uvicorn.run(app, host=\"0.0.0.0\", port=8000)\n```\n\n### Example 4: Environment Variables and Configuration\n\n```python\n# config_agent.py\nimport os\nfrom lexia import LexiaHandler, ChatMessage, create_lexia_app, add_standard_endpoints\nfrom lexia.utils import set_env_variables, get_openai_api_key\n\n# Initialize\nlexia = LexiaHandler()\napp = create_lexia_app(title=\"Config Agent\", version=\"1.1.0\")\n\nasync def process_message(data: ChatMessage):\n \"\"\"Process message with environment configuration.\"\"\"\n try:\n # Set environment variables from Lexia request\n set_env_variables(data.variables)\n \n # Get configured API key\n api_key = get_openai_api_key(data.variables)\n if not api_key:\n lexia.send_error(data, \"API key not configured\")\n return\n \n # Your AI logic here...\n response = f\"Processed with config: {data.message}\"\n lexia.complete_response(data, response)\n \n except Exception as e:\n lexia.send_error(data, str(e))\n\n# Add endpoints\nadd_standard_endpoints(\n app,\n conversation_manager=None,\n lexia_handler=lexia,\n process_message_func=process_message\n)\n```\n\n## \ud83d\udd27 What This Package Handles\n\n\u2705 **Real-time streaming** via Centrifugo \n\u2705 **Backend communication** with Lexia \n\u2705 **Response formatting** for Lexia compatibility \n\u2705 **Data validation** with Pydantic models \n\u2705 **Error handling** and notifications \n\u2705 **FastAPI integration** with standard endpoints \n\u2705 **Environment variable management** \n\u2705 **API key handling** \n\n## \u274c What This Package Does NOT Handle\n\n\u274c **AI/LLM processing** (that's your agent's job) \n\u274c **Conversation memory** (that's in your `memory/` module) \n\u274c **Business logic** (that's in your main application) \n\u274c **Database operations** \n\u274c **Authentication/Authorization** \n\n## \ud83c\udfaf Design Principles\n\n1. **Single Responsibility**: Each component has one clear purpose\n2. **Clean Interface**: Simple, intuitive methods\n3. **Platform Agnostic**: Your AI agent doesn't know about Lexia internals\n4. **Minimal Dependencies**: Only what's absolutely necessary\n5. **Easy Testing**: Simple, focused components\n\n## \ud83d\ude80 Benefits\n\n- **Clean separation** between your AI agent and Lexia\n- **Easy to maintain** - all Lexia logic in one place\n- **Easy to replace** - switch platforms by replacing this package\n- **Professional structure** - clean, organized code\n- **Fast development** - no complex integrations to manage\n- **Drop-in replacement** - copy folder and start using immediately\n\n## \ud83d\udd04 Integration Flow\n\n```\nYour AI Agent \u2192 LexiaHandler \u2192 Lexia Platform\n \u2193 \u2193 \u2193\n OpenAI/LLM Communication Real-time + Backend\n```\n\nYour AI agent focuses on AI logic, this package handles all Lexia communication complexity behind a clean interface.\n\n## \ud83d\udccb Development Setup\n\n### Using Make (Recommended)\n```bash\n# Show available commands\nmake help\n\n# Setup development environment\nmake dev\nsource lexia_env/bin/activate\nmake deps\n\n# Build and test\nmake build\nmake test\nmake install\n```\n\n### Using Python Scripts\n```bash\n# Build and test\npython build_package.py all\n\n# Just build\npython build_package.py build\n\n# Install locally\npython build_package.py install\n```\n\n### Manual Setup\n```bash\n# Create virtual environment\npython3 -m venv lexia_env\nsource lexia_env/bin/activate\n\n# Install dependencies\npip install -r lexia/requirements.txt\npip install build twine\n\n# Build package\npython -m build\n\n# Install locally\npip install -e .\n```\n\n## \ud83e\uddea Testing Your Integration\n\n```python\n# test_lexia.py\nimport pytest\nfrom lexia import LexiaHandler, ChatMessage, Variable\n\ndef test_lexia_handler():\n \"\"\"Test basic LexiaHandler functionality.\"\"\"\n handler = LexiaHandler()\n \n # Create test data\n test_data = ChatMessage(\n thread_id=\"test123\",\n model=\"gpt-4\",\n message=\"Hello\",\n conversation_id=1,\n response_uuid=\"uuid123\",\n message_uuid=\"msg123\",\n channel=\"test\",\n file_type=\"\",\n file_url=\"\",\n variables=[],\n url=\"http://test.com\",\n url_update=\"\",\n url_upload=\"\",\n force_search=False,\n system_message=None,\n memory=[],\n project_system_message=None,\n first_message=False,\n project_id=\"\",\n project_files=None\n )\n \n # Test that handler can be created\n assert handler is not None\n assert hasattr(handler, 'stream_chunk')\n assert hasattr(handler, 'complete_response')\n assert hasattr(handler, 'send_error')\n\nif __name__ == \"__main__\":\n pytest.main([__file__])\n```\n\n## \ud83d\udea8 Common Issues and Solutions\n\n### Issue: Import Error\n```bash\nModuleNotFoundError: No module named 'lexia'\n```\n**Solution**: Make sure you're in the correct directory or add the lexia folder to your Python path.\n\n### Issue: Missing Dependencies\n```bash\nImportError: No module named 'fastapi'\n```\n**Solution**: Install requirements: `pip install -r lexia/requirements.txt` or use `pip install lexia[web]`\n\n### Issue: Lexia Communication Fails\n**Solution**: Check that your environment variables and API keys are properly configured in the Lexia request variables.\n\n## \ud83d\udce6 Publishing to PyPI\n\n### Test PyPI (Recommended for testing)\n```bash\n# Build package\nmake build\n\n# Upload to Test PyPI\nmake publish-test\n```\n\n### Production PyPI\n```bash\n# Build package\nmake build\n\n# Upload to PyPI (requires credentials)\nmake publish\n```\n\n## \ud83d\udcde Support\n\nWhen you install this package:\n1. All Lexia communication is handled automatically\n2. Standard endpoints are provided out-of-the-box\n3. Your AI agent remains completely platform-agnostic\n4. You can focus on building your AI logic, not integration code\n\nThe package is designed to be a drop-in solution - just `pip install lexia` and start building your AI agent!\n\n## \ud83d\udcc4 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Clean, minimal package for Lexia platform integration",
"version": "1.1.0",
"project_urls": {
"Bug Tracker": "https://github.com/yourusername/lexia/issues",
"Documentation": "https://github.com/yourusername/lexia#readme",
"Homepage": "https://github.com/yourusername/lexia",
"Repository": "https://github.com/yourusername/lexia"
},
"split_keywords": [
"lexia",
" ai",
" chatbot",
" platform",
" integration",
" fastapi",
" real-time"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "2860ecc338ba7685e5a6d104523ae3f49cf8b196de85427b11c3264e38324d96",
"md5": "6b6a684a2516fd9c3a588ea0feb1b4b7",
"sha256": "e2dcb054f1815dbba2bc53ccccf27ca6650eeee4ffa81211c2c125bcfcf55e1d"
},
"downloads": -1,
"filename": "lexia-1.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6b6a684a2516fd9c3a588ea0feb1b4b7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 21203,
"upload_time": "2025-08-17T12:46:46",
"upload_time_iso_8601": "2025-08-17T12:46:46.474260Z",
"url": "https://files.pythonhosted.org/packages/28/60/ecc338ba7685e5a6d104523ae3f49cf8b196de85427b11c3264e38324d96/lexia-1.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "e240b1fd2a8b7e6f24851e9d951dec09252e08754ed838d4209b5fe50e8a2566",
"md5": "5388dc67595ce9432787e7d7bb5795dc",
"sha256": "06262b1aed7da39bfabfcad2d38fc3c31ac5c197da90975bb66a8e4bbb128de1"
},
"downloads": -1,
"filename": "lexia-1.1.0.tar.gz",
"has_sig": false,
"md5_digest": "5388dc67595ce9432787e7d7bb5795dc",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 19569,
"upload_time": "2025-08-17T12:46:48",
"upload_time_iso_8601": "2025-08-17T12:46:48.070301Z",
"url": "https://files.pythonhosted.org/packages/e2/40/b1fd2a8b7e6f24851e9d951dec09252e08754ed838d4209b5fe50e8a2566/lexia-1.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-17 12:46:48",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "yourusername",
"github_project": "lexia",
"github_not_found": true,
"lcname": "lexia"
}