Skip to content

Commit 7f0f781

Browse files
Update openmind.py
# openmind.py # openmind (c) 2024 Gregory L. Magnusson MIT licence # internal reasoning loop for continuous AGI reasoning without user interaction # openmind internal reasoning asynchronous task ensuring non-blocking execution and efficient concurrency # modular integration of automind reasoning with memory # webmind for API and llama3 handling of input response from various LLM # log internal reasoning conclusion ./memory/logs/thoughts.json # log not premise ./memory/logs/notpremise.json # log short term memory input response ./memory/stm/{timestamp}memory.json
1 parent 7946c84 commit 7f0f781

File tree

1 file changed

+33
-3
lines changed

1 file changed

+33
-3
lines changed

automind/openmind.py

+33-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,23 @@
1+
# openmind.py
2+
# openmind (c) 2024 Gregory L. Magnusson MIT licence
3+
# internal reasoning loop for continuous AGI reasoning without user interaction
4+
# openmind internal reasoning asynchronous task ensuring non-blocking execution and efficient concurrency
5+
# modular integration of automind reasoning with memory
6+
# ollama model handling from ollama_handler.py for input response
7+
# API handlling from api.py and chatter.py for openai, together.ai, groq.com, ai71.ai
8+
# log internal reasoning conclusion ./memory/logs/thoughts.json
9+
# log not premise ./memory/logs/notpremise.json
10+
# log short term memory input response ./memory/stm/{timestamp}memory.json
11+
12+
113
import os
214
import time
315
from datetime import datetime
416
from nicegui import ui # importing ui for easyAGI
517
from memory.memory import create_memory_folders, store_in_stm, save_conversation_memory, save_internal_reasoning, DialogEntry, save_valid_truth
618
from webmind.ollama_handler import OllamaHandler # Import OllamaHandler for modular Ollama interactions
719
from automind.automind import FundamentalAGI
8-
from webmind.chatter import GPT4o, GroqModel, TogetherModel
20+
from webmind.chatter import GPT4o, GroqModel, TogetherModel, AI71Model
921
from webmind.api import APIManager
1022
import ujson as json
1123
import asyncio
@@ -134,13 +146,24 @@ def log_and_notify(message, level='info', message_type='info'):
134146
else:
135147
log_and_notify('Together AI API key not found. Please add the key first.', 'warning', 'negative')
136148

149+
if model_name == 'ai71' and not model_initialized:
150+
ai71_key = self.api_manager.get_api_key('ai71')
151+
if ai71_key:
152+
chatter = AI71Model(ai71_key) # ai71
153+
self.agi_instance = FundamentalAGI(chatter)
154+
log_and_notify('Using AI71 for AGI')
155+
model_initialized = True
156+
else:
157+
log_and_notify('AI71 API key not found. Please add the key first.', 'warning', 'negative')
158+
137159
if not model_initialized:
138160
log_and_notify(f'Failed to initialize AGI with {model_name}', 'warning', 'negative')
139161

140162
async def initialize_agi(self):
141163
openai_key = self.api_manager.get_api_key('openai')
142164
groq_key = self.api_manager.get_api_key('groq')
143165
together_key = self.api_manager.get_api_key('together')
166+
ai71_key = self.api_manager.get_api_key('ai71')
144167
llama_running = self.check_llama_running()
145168

146169
if openai_key:
@@ -164,6 +187,13 @@ async def initialize_agi(self):
164187
with self.message_container:
165188
ui.notify('Using Together AI for ezAGI')
166189
logging.debug("AGI initialized with Together AI")
190+
elif ai71_key:
191+
chatter = AI71Model(ai71_key)
192+
self.agi_instance = FundamentalAGI(chatter)
193+
if self.message_container.client.connected:
194+
with self.message_container:
195+
ui.notify('Using AI71 for ezAGI')
196+
logging.debug("AGI initialized with AI71")
167197
elif llama_running:
168198
# Call ollama_handler to list models when LLaMA is found running
169199
models = self.ollama_handler.list_models()
@@ -224,8 +254,9 @@ async def reasoning_loop(self):
224254
openai_key = self.api_manager.get_api_key('openai')
225255
groq_key = self.api_manager.get_api_key('groq')
226256
together_key = self.api_manager.get_api_key('together')
257+
ai71_key = self.api_manager.get_api_key('ai71')
227258
llama_running = self.check_llama_running()
228-
if openai_key or groq_key or together_key or llama_running:
259+
if openai_key or groq_key or together_key or ai71_key or llama_running:
229260
await self.initialize_agi()
230261
else:
231262
if not self.initialization_warning_shown:
@@ -384,4 +415,3 @@ def handle_javascript_response(self, msg):
384415

385416
# Log the entire message for debugging purposes
386417
logging.debug(f"Received JavaScript response: {msg}")
387-

0 commit comments

Comments
 (0)