# -*- coding: utf-8 -*- """ NLP Module für Trixy. Dieses Modul stellt die NLP-Infrastruktur für Intent-Erkennung und Antwortgenerierung bereit. Komponenten: - NLPProvider: Abstrakte Basisklasse für NLP-Backends - IntentRegistry: Globale Registry für verfügbare Intents - @intent: Dekorator zum Markieren von Intent-Handlern - IntentReceivedData / IntentResult: Datenklassen für Handler Verwendung: # Intent-Handler in einem Plugin definieren from trixy_core.nlp import intent, IntentReceivedData, IntentResult class MyPlugin(TrixyPlugin): @intent( "my_intent", slots={"param": str}, examples=["mach das", "tu dies"] ) async def handle_my_intent(self, data: IntentReceivedData) -> IntentResult: return IntentResult.success_with_response("Fertig!") # NLP-Provider implementieren from trixy_core.nlp import NLPProvider, NLPConfig, NLPContext, NLPResult class MyNLPProvider(NLPProvider): async def initialize(self, config: NLPConfig) -> bool: # Provider initialisieren return True async def process(self, context: NLPContext) -> NLPResult: # Text verarbeiten return NLPResult(intent="my_intent", confidence=0.95) """ from trixy_core.nlp.provider import ( NLPConfig, NLPContext, NLPProvider, NLPResult, NLPState, ) from trixy_core.nlp.intent_registry import ( IntentDefinition, IntentRegistry, IntentSlot, ) from trixy_core.nlp.decorators import ( admin_only, discover_intent_handlers, example, get_intent_metadata, intent, is_intent_handler, pattern, INTENT_METADATA_ATTR, ) from trixy_core.nlp.handler import ( IntentReceivedData, IntentResult, ) from trixy_core.nlp.system_intents import ( IntentSecurityLevel, SystemIntentInfo, PUBLIC_SYSTEM_INTENTS, ADMIN_SYSTEM_INTENTS, ALL_SYSTEM_INTENTS, get_system_intents_for_context, is_admin_intent, is_system_intent, get_system_intent_info, ) from trixy_core.nlp.intent_dispatcher import IntentDispatcherService from trixy_core.nlp.entities import ( EntityDefinition, EntityRegistry, EntityResolver, ResolvedEntity, ) from trixy_core.nlp.intent_loader import load_entity_yaml __all__ = [ # Provider "NLPConfig", "NLPContext", "NLPProvider", "NLPResult", "NLPState", # Registry "IntentDefinition", "IntentRegistry", "IntentSlot", # Decorator "discover_intent_handlers", "example", "get_intent_metadata", "intent", "is_intent_handler", "pattern", "INTENT_METADATA_ATTR", # Handler "IntentReceivedData", "IntentResult", # System Intents "IntentSecurityLevel", "SystemIntentInfo", "PUBLIC_SYSTEM_INTENTS", "ADMIN_SYSTEM_INTENTS", "ALL_SYSTEM_INTENTS", "get_system_intents_for_context", "is_admin_intent", "is_system_intent", "get_system_intent_info", # Dispatcher "IntentDispatcherService", # Entities "EntityDefinition", "EntityRegistry", "EntityResolver", "ResolvedEntity", # Entity-Loader "load_entity_yaml", ]