mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-28 04:59:52 +01:00
- Added LiveKit server with proper folder structure - Integrated MQTT gateway for ESP32 communication - Added agent with STT/TTS capabilities - Sanitized .env.example with placeholder API keys - Updated project configuration files 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
25 lines
No EOL
936 B
Python
25 lines
No EOL
936 B
Python
import logging
|
|
from livekit.agents import (
|
|
Agent,
|
|
RunContext,
|
|
function_tool,
|
|
)
|
|
|
|
logger = logging.getLogger("agent")
|
|
|
|
class Assistant(Agent):
|
|
"""Main AI Assistant agent class"""
|
|
|
|
def __init__(self) -> None:
|
|
super().__init__(
|
|
instructions="""You are a helpful voice AI assistant.
|
|
You eagerly assist users with their questions by providing information from your extensive knowledge.
|
|
Your responses are concise, to the point, and without any complex formatting or punctuation including emojis, asterisks, or other symbols.
|
|
You are curious, friendly, and have a sense of humor.""",
|
|
)
|
|
|
|
@function_tool
|
|
async def lookup_weather(self, context: RunContext, location: str):
|
|
"""Look up weather information for a specific location"""
|
|
logger.info(f"Looking up weather for {location}")
|
|
return "sunny with a temperature of 70 degrees." |