diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 984764e..e1c051f 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -6,6 +6,7 @@
+
@@ -51,6 +52,9 @@
+
+
+
@@ -61,7 +65,7 @@
1696663237589
-
+
diff --git a/README.md b/README.md
index 571b182..09722cc 100644
--- a/README.md
+++ b/README.md
@@ -4,6 +4,10 @@
![Screenshot 2023-10-07 at 19.07.30.png](assets%2FScreenshot%202023-10-07%20at%2019.07.30.png)
+![photo_2023-10-07 23.14.18.jpeg](assets%2Fphoto_2023-10-07%2023.14.18.jpeg)
+
+![photo_2023-10-07 23.14.16.jpeg](assets%2Fphoto_2023-10-07%2023.14.16.jpeg)
+
## Software Platform
![Screenshot 2023-10-07 at 19.08.07.png](assets%2FScreenshot%202023-10-07%20at%2019.08.07.png)
diff --git a/assets/photo_2023-10-07 23.14.16.jpeg b/assets/photo_2023-10-07 23.14.16.jpeg
new file mode 100644
index 0000000..bdc8fba
Binary files /dev/null and b/assets/photo_2023-10-07 23.14.16.jpeg differ
diff --git a/assets/photo_2023-10-07 23.14.18.jpeg b/assets/photo_2023-10-07 23.14.18.jpeg
new file mode 100644
index 0000000..2925955
Binary files /dev/null and b/assets/photo_2023-10-07 23.14.18.jpeg differ
diff --git a/weather_platform/apps/py-tg-bot-weather-agent/main.py b/weather_platform/apps/py-tg-bot-weather-agent/main.py
index 06feee4..a7cd620 100644
--- a/weather_platform/apps/py-tg-bot-weather-agent/main.py
+++ b/weather_platform/apps/py-tg-bot-weather-agent/main.py
@@ -1,5 +1,6 @@
import pandas as pd
from langchain.chat_models import ChatOpenAI
+from langchain.llms import OpenAI
from langchain.agents import initialize_agent, AgentType, AgentOutputParser
from typing import List, Union
from langchain.schema import AgentAction, AgentFinish, OutputParserException
@@ -7,8 +8,11 @@ from langchain.tools.base import StructuredTool
from typing import Optional
import requests
import telebot
+from langchain.agents import create_json_agent, AgentExecutor
+from langchain.agents.agent_toolkits import JsonToolkit
-OPENAI_API = "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"
+# OPENAI_API = "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"
+OPENAI_API = "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"
BOT_KEY = '6415742729:AAHVyDkHHF57ZsVd9gJjVtXjKE2M9CydzPk'
@@ -55,17 +59,17 @@ def fetch_get_weather_data(params={}):
return None
def get_sensors_insight() -> str:
- """Tool that using for get meteo weather sensors"""
+ """This tool provides data about the sensors (sensors) of the weather station. Data: lat, lng, height, name, agregator_uuid. Use it to answer questions related to this data. """
data = fetch_get_sensors()
return data
def get_agregators_insight() -> str:
- """Tool that using for get meteo weather sensors"""
+ """This tool provides data on adapters (repeaters that transmit data from sensors to the server) of the weather station. Data: lat, lng, height (altitude above sea level), name, country, city, region, street. Use it to answer questions related to this data."""
data = fetch_get_agregator()
return data
def get_weather_data_history_insight() -> str:
- """Tool that using for get meteo weather history from sensors using in the meteo system"""
+ """This tool provides information about the history of changes in weather data readings. It will return an array of measurements including the following data: Sensor UUID, Agregator UUID, Type (Temperature, Humidity), Value, Time (date string). Use it to answer questions using this data."""
data = fetch_get_weather_data()
return data
@@ -104,7 +108,7 @@ output_parser = CustomOutputParser()
agent_chain = initialize_agent(
tools,
chat,
- max_iterations=3,
+ max_iterations=4,
agent=AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION,
verbose=True,
output_parser=output_parser
@@ -121,13 +125,16 @@ def echo_all(message):
user_id = message.from_user.id
print(message.text)
bot.reply_to(message, "AI думает... 🤔")
-
- result = agent_chain(message.text)
+ llm = OpenAI(model_name="text-davinci-003", openai_api_key=OPENAI_API)
+ msg = llm("Translate the text to English: " + message.text)
+ request = "You are a system for monitoring data from weather systems. Solve the problem: " + msg + ". for this solution you can use any tool without me but you can run tool only one step."
+ result = agent_chain(request)
if (result):
final_answer = result['output']
- print(final_answer)
-
- bot.reply_to(message, str(final_answer))
+ msg = llm("Переведи на красивый русский язык: " + final_answer)
+ print("AGENT_FINAL: " + final_answer)
+ print("DAVINCHI_FINAL: " + msg)
+ bot.reply_to(message, str(msg))
bot.infinity_polling()