ajoute et implementation de la communication etre Satellite
Browse files- main.py +67 -34
- req.txt +1 -1
- satellites/atlasSat/atlas.py +2 -0
- satellites/edisonSat/edison.py +2 -2
- satellites/lilithSat/lilith.py +4 -0
- satellites/pythagorasSat/pythagoras.py +2 -2
- satellites/shakaSat/shaka.py +2 -7
main.py
CHANGED
|
@@ -1,34 +1,67 @@
|
|
| 1 |
-
|
| 2 |
-
from
|
| 3 |
-
|
| 4 |
-
from
|
| 5 |
-
from
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import openai
|
| 2 |
+
from dotenv import load_dotenv
|
| 3 |
+
import os
|
| 4 |
+
from mistralai import Mistral
|
| 5 |
+
from dotenv import load_dotenv
|
| 6 |
+
load_dotenv()
|
| 7 |
+
api_key = os.getenv("MISTRAL_API_KEY")
|
| 8 |
+
model = "mistral-large-latest"
|
| 9 |
+
|
| 10 |
+
client = Mistral(api_key=api_key)
|
| 11 |
+
|
| 12 |
+
while True:
|
| 13 |
+
chat_response = client.chat.complete(
|
| 14 |
+
model=model,
|
| 15 |
+
messages=[{"role":"user", "content":input("Enter your message: ")}]
|
| 16 |
+
|
| 17 |
+
)
|
| 18 |
+
if chat_response.choices[0].message.content == "Goodbye":
|
| 19 |
+
break
|
| 20 |
+
print(chat_response.choices[0].message.content)
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
print("Aurevoir")
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
#
|
| 44 |
+
# stellar = Stellar()
|
| 45 |
+
# atlas = Atlas()
|
| 46 |
+
# lilith = Lilith()
|
| 47 |
+
# pythagoras = Pythagoras()
|
| 48 |
+
# shaka = Shaka()
|
| 49 |
+
# edison = Edison()
|
| 50 |
+
# york = York()
|
| 51 |
+
|
| 52 |
+
#
|
| 53 |
+
# stellar.register_satellites(atlas)
|
| 54 |
+
# stellar.register_satellites(lilith)
|
| 55 |
+
# stellar.register_satellites(pythagoras)
|
| 56 |
+
# stellar.register_satellites(shaka)
|
| 57 |
+
# stellar.register_satellites(edison)
|
| 58 |
+
# stellar.register_satellites(york)
|
| 59 |
+
#
|
| 60 |
+
#
|
| 61 |
+
# # Exemple de communication
|
| 62 |
+
# response = stellar.route_communication("Shaka", "Atlas", {"type": "monitor_directory", "content": "Suspicious activity detected"})
|
| 63 |
+
# print(response)
|
| 64 |
+
#
|
| 65 |
+
# # Exemple de diffusion
|
| 66 |
+
# results = stellar.broadcast_message("Shaka", {"type": "ethics_update", "content": "New ethical guidelines"})
|
| 67 |
+
# print(results)
|
req.txt
CHANGED
|
@@ -11,4 +11,4 @@ psutil
|
|
| 11 |
python-dotenv
|
| 12 |
beautifulsoup4
|
| 13 |
langchain-anthropic
|
| 14 |
-
|
|
|
|
| 11 |
python-dotenv
|
| 12 |
beautifulsoup4
|
| 13 |
langchain-anthropic
|
| 14 |
+
mistralai
|
satellites/atlasSat/atlas.py
CHANGED
|
@@ -18,6 +18,8 @@ class Atlas(VegapunkSatellite):
|
|
| 18 |
self.email_config ={}
|
| 19 |
self.external_systems = {}
|
| 20 |
# logging.basicConfig(filename='atlas.log', level=logging.INFO)
|
|
|
|
|
|
|
| 21 |
self.logger = get_logger("atlas")
|
| 22 |
def process_task(self, task: Dict[str, Any]) -> Dict[str, Any]:
|
| 23 |
task_type = task.get("type")
|
|
|
|
| 18 |
self.email_config ={}
|
| 19 |
self.external_systems = {}
|
| 20 |
# logging.basicConfig(filename='atlas.log', level=logging.INFO)
|
| 21 |
+
self.llm_api_key = os.getenv("MISTRAL_API_KEY")
|
| 22 |
+
self.llm_api_url = "https://api.mistral.ai/v1/chat/completions" # Example usi
|
| 23 |
self.logger = get_logger("atlas")
|
| 24 |
def process_task(self, task: Dict[str, Any]) -> Dict[str, Any]:
|
| 25 |
task_type = task.get("type")
|
satellites/edisonSat/edison.py
CHANGED
|
@@ -13,8 +13,8 @@ fonction = "Générer des idées innovantes et évaluer leur faisabilité techni
|
|
| 13 |
class Edison(VegapunkSatellite):
|
| 14 |
def __init__(self):
|
| 15 |
super().__init__(name="Edison", specialty=role)
|
| 16 |
-
self.llm_api_key = os.getenv("
|
| 17 |
-
self.llm_api_url = "https://api.
|
| 18 |
self.external_apis = {
|
| 19 |
"math": "http://api.mathjs.org/v4/",
|
| 20 |
"wolfram": "http://api.wolframalpha.com/v1/result"
|
|
|
|
| 13 |
class Edison(VegapunkSatellite):
|
| 14 |
def __init__(self):
|
| 15 |
super().__init__(name="Edison", specialty=role)
|
| 16 |
+
self.llm_api_key = os.getenv("MISTRAL_API_KEY")
|
| 17 |
+
self.llm_api_url = "https://api.mistral.ai/v1/chat/completions" # Example using OpenAI's API
|
| 18 |
self.external_apis = {
|
| 19 |
"math": "http://api.mathjs.org/v4/",
|
| 20 |
"wolfram": "http://api.wolframalpha.com/v1/result"
|
satellites/lilithSat/lilith.py
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
|
|
|
|
|
| 1 |
from satellites.base_satellite import VegapunkSatellite
|
| 2 |
from typing import Dict, Any, List
|
| 3 |
import random
|
|
@@ -18,6 +20,8 @@ class Lilith(VegapunkSatellite):
|
|
| 18 |
"Contraintes extrêmes"]
|
| 19 |
# logging.basicConfig(filename='lilith_log.txt', level=logging.INFO)
|
| 20 |
self.external_apis = {}
|
|
|
|
|
|
|
| 21 |
self.logger = get_logger("lilith")
|
| 22 |
|
| 23 |
def process_task(self, task: Dict[str, Any]) -> Dict[str, Any]:
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
|
| 3 |
from satellites.base_satellite import VegapunkSatellite
|
| 4 |
from typing import Dict, Any, List
|
| 5 |
import random
|
|
|
|
| 20 |
"Contraintes extrêmes"]
|
| 21 |
# logging.basicConfig(filename='lilith_log.txt', level=logging.INFO)
|
| 22 |
self.external_apis = {}
|
| 23 |
+
self.llm_api_key = os.getenv("MISTRAL_API_KEY")
|
| 24 |
+
self.llm_api_url = "https://api.mistral.ai/v1/chat/completions" # Example usi
|
| 25 |
self.logger = get_logger("lilith")
|
| 26 |
|
| 27 |
def process_task(self, task: Dict[str, Any]) -> Dict[str, Any]:
|
satellites/pythagorasSat/pythagoras.py
CHANGED
|
@@ -32,8 +32,8 @@ fonction = "Effectuer des calculs complexes et analyser des ensembles de donnée
|
|
| 32 |
class Pythagoras(VegapunkSatellite):
|
| 33 |
def __init__(self):
|
| 34 |
super().__init__(name="Pythagoras", specialty="Role")
|
| 35 |
-
self.llm_api_key = os.getenv("
|
| 36 |
-
self.llm_api_url = "https://api.
|
| 37 |
self.research_databases = {
|
| 38 |
"scientific": "https://api.example-scientific-db.com/search",
|
| 39 |
"news": "https://api.example-news-db.com/search",
|
|
|
|
| 32 |
class Pythagoras(VegapunkSatellite):
|
| 33 |
def __init__(self):
|
| 34 |
super().__init__(name="Pythagoras", specialty="Role")
|
| 35 |
+
self.llm_api_key = os.getenv("MISTRAL_API_KEY")
|
| 36 |
+
self.llm_api_url = "https://api.mistral.ai/v1/chat/completions" # Example using OpenAI's API
|
| 37 |
self.research_databases = {
|
| 38 |
"scientific": "https://api.example-scientific-db.com/search",
|
| 39 |
"news": "https://api.example-news-db.com/search",
|
satellites/shakaSat/shaka.py
CHANGED
|
@@ -14,11 +14,6 @@ from openai import OpenAI
|
|
| 14 |
|
| 15 |
load_dotenv()
|
| 16 |
|
| 17 |
-
client = OpenAI(
|
| 18 |
-
organization= os.getenv("OPENAI_ORG"),
|
| 19 |
-
project= '$Dr-Vegapunk'
|
| 20 |
-
|
| 21 |
-
)
|
| 22 |
|
| 23 |
|
| 24 |
role = "logique, éthique et analyse"
|
|
@@ -29,8 +24,8 @@ class Shaka(VegapunkSatellite):
|
|
| 29 |
super().__init__(name="Shaka", specialty=role)
|
| 30 |
self.nlp = self._initialize_nlp_tools()
|
| 31 |
# logging.basicConfig(filename='shaka.log', level=logging.INFO)
|
| 32 |
-
self.llm_api_key = os.getenv("
|
| 33 |
-
self.llm_api_url = "https://api.
|
| 34 |
self.fact_check_api = "https://factchecktools.googleapis.com/v1alpha1/claims:search"
|
| 35 |
self.fact_check_api_key = os.getenv("FACT_CHECK_API_KEY")
|
| 36 |
self.ethical_filter_active = True
|
|
|
|
| 14 |
|
| 15 |
load_dotenv()
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
|
| 19 |
role = "logique, éthique et analyse"
|
|
|
|
| 24 |
super().__init__(name="Shaka", specialty=role)
|
| 25 |
self.nlp = self._initialize_nlp_tools()
|
| 26 |
# logging.basicConfig(filename='shaka.log', level=logging.INFO)
|
| 27 |
+
self.llm_api_key = os.getenv("MISTRAL_API_KEY")
|
| 28 |
+
self.llm_api_url = "https://api.mistral.ai/v1/chat/completions" # Example using OpenAI's API
|
| 29 |
self.fact_check_api = "https://factchecktools.googleapis.com/v1alpha1/claims:search"
|
| 30 |
self.fact_check_api_key = os.getenv("FACT_CHECK_API_KEY")
|
| 31 |
self.ethical_filter_active = True
|