nananie143 commited on
Commit
3ef1144
·
verified ·
1 Parent(s): b59a236

Upload folder using huggingface_hub

Browse files
.env.example ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Hugging Face Configuration
2
+ # Get your token from https://huggingface.co/settings/tokens
3
+ # Make sure to select "WRITE" access when creating the token
4
+ HUGGINGFACE_TOKEN=your_huggingface_token_here
5
+
6
+ # System Configuration
7
+ DEBUG_MODE=False
8
+ LOG_LEVEL=INFO
9
+ MAX_WORKERS=4
10
+ ASYNC_TIMEOUT=30
11
+
12
+ # Resource Limits
13
+ MAX_MEMORY_MB=8192
14
+ MAX_CPU_PERCENT=90
15
+ MAX_GPU_MEMORY_MB=4096
16
+ MAX_API_CALLS_PER_MINUTE=500
17
+
18
+ # Team Configuration
19
+ MIN_TEAM_SIZE=2
20
+ MAX_TEAM_SIZE=10
21
+ MAX_CONCURRENT_OBJECTIVES=5
22
+
23
+ # Error Recovery
24
+ MAX_RETRIES=3
25
+ RETRY_DELAY_SECONDS=5
26
+ ERROR_THRESHOLD=0.2
27
+
28
+ # Monitoring
29
+ METRICS_INTERVAL_SECONDS=60
30
+ HEALTH_CHECK_INTERVAL=30
31
+ PERFORMANCE_LOG_RETENTION_DAYS=7
32
+
33
+ # API Keys
34
+ # Get your Hugging Face token from https://huggingface.co/settings/tokens
35
+ # Required for uploading to Spaces - must have WRITE access
36
+ HUGGINGFACE_API_KEY=your_huggingface_api_key
37
+
38
+ # Optional API keys for additional features
39
+ OPENAI_API_KEY=your_openai_api_key
40
+ GROQ_API_KEY=your_groq_api_key
41
+
42
+ # Service Configuration
43
+ PORT=7860
44
+ HOST=0.0.0.0
45
+ DEBUG=True
46
+ ENVIRONMENT=development
47
+
48
+ # Database Configuration
49
+ DATABASE_URL=sqlite:///./ventures.db
50
+
51
+ # Model Configuration
52
+ MODEL_CACHE_DIR=./model_cache
53
+ DEFAULT_MODEL=gpt-4-turbo-preview
54
+
55
+ # Venture Configuration
56
+ MIN_PROFIT_TARGET=1000000
57
+ DEFAULT_CURRENCY=USD
58
+ RISK_TOLERANCE=medium
59
+
60
+ # API Configuration
61
+ API_VERSION=v1
62
+ API_PREFIX=/api/v1
63
+ CORS_ORIGINS=["*"]
64
+ MAX_REQUEST_SIZE=10MB
65
+
66
+ # Monitoring Configuration
67
+ ENABLE_METRICS=True
68
+ METRICS_PORT=9090
69
+ LOG_LEVEL=INFO
70
+
71
+ # Cache Configuration
72
+ REDIS_URL=redis://localhost:6379/0
73
+ CACHE_TTL=3600
74
+
75
+ # Security Configuration
76
+ JWT_SECRET=your_jwt_secret
77
+ JWT_ALGORITHM=HS256
78
+ ACCESS_TOKEN_EXPIRE_MINUTES=30
79
+
80
+ # Feature Flags
81
+ ENABLE_PORTFOLIO_OPTIMIZATION=True
82
+ ENABLE_MARKET_ANALYSIS=True
83
+ ENABLE_MONETIZATION_STRATEGY=True
84
+ ENABLE_VENTURE_ANALYSIS=True
85
+
86
+ # Note: After copying this file to .env:
87
+ # 1. Replace 'your_huggingface_token_here' with your actual token
88
+ # 2. Make sure your token has WRITE access for Spaces
89
+ # 3. Keep this .env.example file for reference
90
+ # 4. Never commit your actual .env file with real tokens
meta_learning.py CHANGED
@@ -42,22 +42,38 @@ class LearningMetrics:
42
  class MetaLearningSystem:
43
  """Meta-learning system for optimizing learning strategies"""
44
 
45
- def __init__(self):
46
  self.logger = logging.getLogger(__name__)
 
47
 
48
- # Initialize quantum system with consistent configuration
 
 
 
 
 
 
 
 
 
 
 
49
  quantum_config = {
50
- "min_confidence": 0.7,
51
- "parallel_threshold": 3,
52
- "learning_rate": 0.1,
53
- "strategy_weights": {
54
- "LOCAL_LLM": 0.8,
55
- "CHAIN_OF_THOUGHT": 0.6,
56
- "TREE_OF_THOUGHTS": 0.5,
57
- "META_LEARNING": 0.4
58
- }
 
 
 
 
 
59
  }
60
-
61
  self.quantum_system = QuantumLearningSystem(quantum_config)
62
  self.strategies = {}
63
  self.performance_history = []
 
42
  class MetaLearningSystem:
43
  """Meta-learning system for optimizing learning strategies"""
44
 
45
+ def __init__(self, config: Optional[Dict[str, Any]] = None):
46
  self.logger = logging.getLogger(__name__)
47
+ self.config = config or {}
48
 
49
+ # Standard reasoning parameters
50
+ self.min_confidence = self.config.get('min_confidence', 0.7)
51
+ self.parallel_threshold = self.config.get('parallel_threshold', 3)
52
+ self.learning_rate = self.config.get('learning_rate', 0.1)
53
+ self.strategy_weights = self.config.get('strategy_weights', {
54
+ "LOCAL_LLM": 0.8,
55
+ "CHAIN_OF_THOUGHT": 0.6,
56
+ "TREE_OF_THOUGHTS": 0.5,
57
+ "META_LEARNING": 0.4
58
+ })
59
+
60
+ # Initialize quantum system with shared config
61
  quantum_config = {
62
+ 'min_confidence': self.min_confidence,
63
+ 'parallel_threshold': self.parallel_threshold,
64
+ 'learning_rate': self.learning_rate,
65
+ 'strategy_weights': self.strategy_weights,
66
+ 'num_qubits': self.config.get('num_qubits', 8),
67
+ 'entanglement_strength': self.config.get('entanglement_strength', 0.5),
68
+ 'interference_threshold': self.config.get('interference_threshold', 0.3),
69
+ 'tunneling_rate': self.config.get('tunneling_rate', 0.1),
70
+ 'annealing_schedule': self.config.get('annealing_schedule', {
71
+ 'initial_temp': 1.0,
72
+ 'final_temp': 0.01,
73
+ 'steps': 100,
74
+ 'cooling_rate': 0.95
75
+ })
76
  }
 
77
  self.quantum_system = QuantumLearningSystem(quantum_config)
78
  self.strategies = {}
79
  self.performance_history = []
multimodal_reasoning.py CHANGED
@@ -5,7 +5,7 @@ Implements reasoning across different types of information.
5
  """
6
 
7
  import logging
8
- from typing import Dict, Any, List
9
  from datetime import datetime
10
  import json
11
  import numpy as np
@@ -14,6 +14,34 @@ from .reasoning import ReasoningStrategy
14
  class MultiModalReasoning(ReasoningStrategy):
15
  """Implements multi-modal reasoning across different types of information."""
16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  async def reason(self, query: str, context: Dict[str, Any]) -> Dict[str, Any]:
18
  try:
19
  # Process different modalities
@@ -86,7 +114,7 @@ class MultiModalReasoning(ReasoningStrategy):
86
  for item1 in items1:
87
  for item2 in items2:
88
  similarity = self._calculate_similarity(item1, item2)
89
- if similarity > 0.5: # Threshold for alignment
90
  alignments.append({
91
  "type1": type1,
92
  "type2": type2,
 
5
  """
6
 
7
  import logging
8
+ from typing import Dict, Any, List, Optional
9
  from datetime import datetime
10
  import json
11
  import numpy as np
 
14
  class MultiModalReasoning(ReasoningStrategy):
15
  """Implements multi-modal reasoning across different types of information."""
16
 
17
+ def __init__(self, config: Optional[Dict[str, Any]] = None):
18
+ """Initialize multi-modal reasoning."""
19
+ super().__init__()
20
+ self.config = config or {}
21
+
22
+ # Standard reasoning parameters
23
+ self.min_confidence = self.config.get('min_confidence', 0.7)
24
+ self.parallel_threshold = self.config.get('parallel_threshold', 3)
25
+ self.learning_rate = self.config.get('learning_rate', 0.1)
26
+ self.strategy_weights = self.config.get('strategy_weights', {
27
+ "LOCAL_LLM": 0.8,
28
+ "CHAIN_OF_THOUGHT": 0.6,
29
+ "TREE_OF_THOUGHTS": 0.5,
30
+ "META_LEARNING": 0.4
31
+ })
32
+
33
+ # Multi-modal specific parameters
34
+ self.modality_weights = self.config.get('modality_weights', {
35
+ 'text': 0.8,
36
+ 'image': 0.7,
37
+ 'audio': 0.6,
38
+ 'video': 0.5,
39
+ 'structured': 0.7
40
+ })
41
+ self.cross_modal_threshold = self.config.get('cross_modal_threshold', 0.6)
42
+ self.integration_steps = self.config.get('integration_steps', 3)
43
+ self.alignment_method = self.config.get('alignment_method', 'attention')
44
+
45
  async def reason(self, query: str, context: Dict[str, Any]) -> Dict[str, Any]:
46
  try:
47
  # Process different modalities
 
114
  for item1 in items1:
115
  for item2 in items2:
116
  similarity = self._calculate_similarity(item1, item2)
117
+ if similarity > self.cross_modal_threshold: # Threshold for alignment
118
  alignments.append({
119
  "type1": type1,
120
  "type2": type2,
quantum_learning.py CHANGED
@@ -40,25 +40,35 @@ class QuantumLearningSystem:
40
  5. Uses quantum annealing for global optimization
41
  """
42
 
43
- def __init__(self,
44
- num_qubits: int = 8,
45
- entanglement_strength: float = 0.5,
46
- interference_threshold: float = 0.3,
47
- tunneling_rate: float = 0.1,
48
- annealing_schedule: Optional[Dict[str, Any]] = None):
49
  """Initialize quantum learning system."""
50
- self.num_qubits = num_qubits
51
- self.entanglement_strength = entanglement_strength
52
- self.interference_threshold = interference_threshold
53
- self.tunneling_rate = tunneling_rate
54
- self.annealing_schedule = annealing_schedule or {
55
- "initial_temp": 10.0,
56
- "final_temp": 0.1,
57
- "cooling_rate": 0.95
58
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
 
60
  # Initialize quantum state
61
- self.state = np.zeros((2**num_qubits,), dtype=complex)
62
  self.state[0] = 1.0 # Initialize to |0⟩ state
63
 
64
  # Pattern storage
 
40
  5. Uses quantum annealing for global optimization
41
  """
42
 
43
+ def __init__(self, config: Optional[Dict[str, Any]] = None):
 
 
 
 
 
44
  """Initialize quantum learning system."""
45
+ self.config = config or {}
46
+
47
+ # Quantum system parameters
48
+ self.num_qubits = self.config.get('num_qubits', 8)
49
+ self.entanglement_strength = self.config.get('entanglement_strength', 0.5)
50
+ self.interference_threshold = self.config.get('interference_threshold', 0.3)
51
+ self.tunneling_rate = self.config.get('tunneling_rate', 0.1)
52
+ self.annealing_schedule = self.config.get('annealing_schedule', {
53
+ 'initial_temp': 1.0,
54
+ 'final_temp': 0.01,
55
+ 'steps': 100,
56
+ 'cooling_rate': 0.95
57
+ })
58
+
59
+ # Standard reasoning parameters
60
+ self.min_confidence = self.config.get('min_confidence', 0.7)
61
+ self.parallel_threshold = self.config.get('parallel_threshold', 3)
62
+ self.learning_rate = self.config.get('learning_rate', 0.1)
63
+ self.strategy_weights = self.config.get('strategy_weights', {
64
+ "LOCAL_LLM": 0.8,
65
+ "CHAIN_OF_THOUGHT": 0.6,
66
+ "TREE_OF_THOUGHTS": 0.5,
67
+ "META_LEARNING": 0.4
68
+ })
69
 
70
  # Initialize quantum state
71
+ self.state = np.zeros((2**self.num_qubits,), dtype=complex)
72
  self.state[0] = 1.0 # Initialize to |0⟩ state
73
 
74
  # Pattern storage
team_management.py CHANGED
@@ -14,7 +14,7 @@ Features:
14
  - Synchronized execution
15
  """
16
 
17
- from typing import Dict, List, Optional, Set, Union, TypeVar
18
  from dataclasses import dataclass, field
19
  from enum import Enum
20
  import asyncio
@@ -196,7 +196,8 @@ class TeamManager:
196
  agent = Agent(
197
  profile=config["profile"],
198
  reasoning_engine=self.orchestrator.reasoning_engine,
199
- meta_learning=self.orchestrator.meta_learning
 
200
  )
201
 
202
  self.agents[team_id][agent_id] = agent
@@ -484,18 +485,21 @@ class TeamManager:
484
  )
485
 
486
  class Agent:
487
- def __init__(self, profile: Dict, reasoning_engine: UnifiedReasoningEngine, meta_learning: bool):
488
  self.profile = profile
 
 
 
489
  self.reasoning_engine = reasoning_engine if reasoning_engine else UnifiedReasoningEngine(
490
- min_confidence=0.7,
491
- parallel_threshold=3,
492
- learning_rate=0.1,
493
- strategy_weights={
494
  "LOCAL_LLM": 0.8,
495
  "CHAIN_OF_THOUGHT": 0.6,
496
  "TREE_OF_THOUGHTS": 0.5,
497
  "META_LEARNING": 0.4
498
- }
499
  )
500
  self.meta_learning = meta_learning
501
  self.state = AgentState.IDLE
 
14
  - Synchronized execution
15
  """
16
 
17
+ from typing import Dict, List, Optional, Set, Union, TypeVar, Any
18
  from dataclasses import dataclass, field
19
  from enum import Enum
20
  import asyncio
 
196
  agent = Agent(
197
  profile=config["profile"],
198
  reasoning_engine=self.orchestrator.reasoning_engine,
199
+ meta_learning=self.orchestrator.meta_learning,
200
+ config=config.get("config", {})
201
  )
202
 
203
  self.agents[team_id][agent_id] = agent
 
485
  )
486
 
487
  class Agent:
488
+ def __init__(self, profile: Dict, reasoning_engine: UnifiedReasoningEngine, meta_learning: bool, config: Optional[Dict[str, Any]] = None):
489
  self.profile = profile
490
+ self.config = config or {}
491
+
492
+ # Use provided reasoning engine or create one with config
493
  self.reasoning_engine = reasoning_engine if reasoning_engine else UnifiedReasoningEngine(
494
+ min_confidence=self.config.get('min_confidence', 0.7),
495
+ parallel_threshold=self.config.get('parallel_threshold', 3),
496
+ learning_rate=self.config.get('learning_rate', 0.1),
497
+ strategy_weights=self.config.get('strategy_weights', {
498
  "LOCAL_LLM": 0.8,
499
  "CHAIN_OF_THOUGHT": 0.6,
500
  "TREE_OF_THOUGHTS": 0.5,
501
  "META_LEARNING": 0.4
502
+ })
503
  )
504
  self.meta_learning = meta_learning
505
  self.state = AgentState.IDLE