#!/usr/bin/env python3
"""
LLM Integration Module
======================

Integration between ML predictions and LLM-based trading decisions.

This module provides the bridge between the ML pipeline (metamodel, strategies)
and an LLM agent that makes trading decisions based on the ML signals.

Components:
- prompts: Prompt templates for the trading decision agent
- signal_formatter: Formats ML predictions for LLM consumption
- decision_parser: Parses LLM responses into structured decisions
- signal_logger: Logs signals and results for feedback/fine-tuning
- llm_client: Client for LLM providers (Ollama, Claude)
- integration: Main orchestration class

Usage:
    from src.llm import MLLLMIntegration, create_integration

    # Create integration with default settings
    integration = create_integration(
        llm_provider="ollama",
        llm_model="llama3:8b"
    )

    # Get trading decision
    recommendation = integration.analyze_and_decide(
        df=price_data,
        symbol="XAUUSD",
        account_info={"balance": 1000.0, ...}
    )

    if recommendation.action == "TRADE":
        execute_trade(recommendation)

Author: ML-Specialist (NEXUS v4.0)
Version: 1.0.0
Created: 2026-01-25
"""

# Prompts
from .prompts.trading_decision import (
    TradingDecisionPrompt,
    SYSTEM_PROMPT,
    EXPECTED_RESPONSE_FORMAT,
    MetamodelOutput,
    StrategyOutput,
    MarketContext,
    AccountInfo,
)

# Signal Formatter
from .signal_formatter import (
    SignalFormatter,
    FormattedSignal,
    FormattedStrategy,
)

# Decision Parser
from .decision_parser import (
    DecisionParser,
    TradingDecision,
    parse_llm_response,
    is_valid_trade_decision,
)

# Signal Logger
from .signal_logger import (
    LLMSignalLogger,
    TradeResult,
)

# LLM Client
from .llm_client import (
    LLMClient,
    LLMClientConfig,
    LLMProvider,
    OllamaProvider,
    ClaudeProvider,
    create_client,
    get_ollama_client,
    get_claude_client,
)

# Integration
from .integration import (
    MLLLMIntegration,
    IntegrationConfig,
    TradingRecommendation,
    create_integration,
)


# ============================================================
# MODULE EXPORTS
# ============================================================

__all__ = [
    # Main integration
    'MLLLMIntegration',
    'IntegrationConfig',
    'TradingRecommendation',
    'create_integration',

    # Prompts
    'TradingDecisionPrompt',
    'SYSTEM_PROMPT',
    'EXPECTED_RESPONSE_FORMAT',
    'MetamodelOutput',
    'StrategyOutput',
    'MarketContext',
    'AccountInfo',

    # Signal formatting
    'SignalFormatter',
    'FormattedSignal',
    'FormattedStrategy',

    # Decision parsing
    'DecisionParser',
    'TradingDecision',
    'parse_llm_response',
    'is_valid_trade_decision',

    # Logging
    'LLMSignalLogger',
    'TradeResult',

    # LLM clients
    'LLMClient',
    'LLMClientConfig',
    'LLMProvider',
    'OllamaProvider',
    'ClaudeProvider',
    'create_client',
    'get_ollama_client',
    'get_claude_client',
]

__version__ = '1.0.0'
