diff --git a/poetry.lock b/poetry.lock index 93dfa85..98bfcff 100644 --- a/poetry.lock +++ b/poetry.lock @@ -713,6 +713,28 @@ type = "legacy" url = "https://mirrors.aliyun.com/pypi/simple" reference = "aliyun" +[[package]] +name = "grandalf" +version = "0.8" +description = "Graph and drawing algorithms framework" +optional = false +python-versions = "*" +files = [ + {file = "grandalf-0.8-py3-none-any.whl", hash = "sha256:793ca254442f4a79252ea9ff1ab998e852c1e071b863593e5383afee906b4185"}, + {file = "grandalf-0.8.tar.gz", hash = "sha256:2813f7aab87f0d20f334a3162ccfbcbf085977134a17a5b516940a93a77ea974"}, +] + +[package.dependencies] +pyparsing = "*" + +[package.extras] +full = ["numpy", "ply"] + +[package.source] +type = "legacy" +url = "https://mirrors.aliyun.com/pypi/simple" +reference = "aliyun" + [[package]] name = "greenlet" version = "3.0.3" @@ -2353,6 +2375,25 @@ type = "legacy" url = "https://mirrors.aliyun.com/pypi/simple" reference = "aliyun" +[[package]] +name = "pyparsing" +version = "3.1.2" +description = "pyparsing module - Classes and methods to define and execute parsing grammars" +optional = false +python-versions = ">=3.6.8" +files = [ + {file = "pyparsing-3.1.2-py3-none-any.whl", hash = "sha256:f9db75911801ed778fe61bb643079ff86601aca99fcae6345aa67292038fb742"}, + {file = "pyparsing-3.1.2.tar.gz", hash = "sha256:a1bac0ce561155ecc3ed78ca94d3c9378656ad4c94c1270de543f621420f94ad"}, +] + +[package.extras] +diagrams = ["jinja2", "railroad-diagrams"] + +[package.source] +type = "legacy" +url = "https://mirrors.aliyun.com/pypi/simple" +reference = "aliyun" + [[package]] name = "python-dateutil" version = "2.9.0.post0" @@ -3787,4 +3828,4 @@ reference = "aliyun" [metadata] lock-version = "2.0" python-versions = "^3.11" -content-hash = "195407f2d9b6d9da0535632b2fe6b80ea57f03a5a02bb8a96eaf01d17fe7e718" +content-hash = "169619afc9ede476b72835d1c5aa2becbf0ea678e66fb66df4b5510291ba382c" diff --git a/pyproject.toml b/pyproject.toml index 545e89b..110865d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,6 +28,7 @@ SQLAlchemy = "2.0.22" wikipedia = "1.4.0" tabulate = "0.9.0" openpyxl = "3.1.5" +grandalf = "0.8" [tool.pytest.ini_options] pythonpath = ["src"] diff --git a/src/langchain_lab/langgraph/marketing_analysis_assistant/marketing_analysis_assistant.py b/src/langchain_lab/langgraph/marketing_analysis_assistant/marketing_analysis_assistant.py index 8f37f6b..1227911 100644 --- a/src/langchain_lab/langgraph/marketing_analysis_assistant/marketing_analysis_assistant.py +++ b/src/langchain_lab/langgraph/marketing_analysis_assistant/marketing_analysis_assistant.py @@ -201,6 +201,7 @@ def run(self): with open(f"sales_analysis_report_{self.model_name}.md", "w") as f: f.write("# 市场部销售智能助手(POC)\n\n") f.write(f"> {self.model_name}\n\n") + f.write(f"```{self.graph.get_graph().draw_ascii()}\n```\n\n") f.write("![image-20240710141823753](assets/marketing_analysis_assistant.png)\n\n") f.write("## 多代理协商过程\n\n") for s in self.graph.stream( diff --git a/src/langchain_lab/langgraph/network_operations_analysis_assistant/network_operations_analysis_assistant.py b/src/langchain_lab/langgraph/network_operations_analysis_assistant/network_operations_analysis_assistant.py index c980046..64d1c9a 100644 --- a/src/langchain_lab/langgraph/network_operations_analysis_assistant/network_operations_analysis_assistant.py +++ b/src/langchain_lab/langgraph/network_operations_analysis_assistant/network_operations_analysis_assistant.py @@ -113,6 +113,12 @@ def __init__(self, openai_api_base: str, openai_api_key: str, model_name: str, r workflow.set_entry_point("wirelessNetworkEngineer") self.graph = workflow.compile() + # from IPython.display import Image + # import matplotlib.pyplot as plt + # img = Image(self.graph.get_graph().print_ascii()) + # imgplot = plt.imshow(img) + # plt.show() + tools = [self.data_analysis_tool, self.python_repl_tool, self.load_data_tool] self.tool_executor = ToolExecutor(tools) @@ -249,6 +255,7 @@ def run(self): with open(f"network_operations_analysis_assistant_report_{self.model_name}.md", "w") as f: f.write("# 网络运维智能助手(POC)\n\n") f.write(f"> {self.model_name}\n\n") + f.write(f"```{self.graph.get_graph().draw_ascii()}\n```\n\n") # f.write("![image-20240710141823753](assets/marketing_analysis_assistant.png)\n\n") f.write("## 多代理协商过程\n\n") for s in self.graph.stream( diff --git a/tests/langchain_lab/langgraph/network_operations_analysis_assistant/test_network_operations_analysis_assistant.py b/tests/langchain_lab/langgraph/network_operations_analysis_assistant/test_network_operations_analysis_assistant.py index 173d21a..e870f9e 100644 --- a/tests/langchain_lab/langgraph/network_operations_analysis_assistant/test_network_operations_analysis_assistant.py +++ b/tests/langchain_lab/langgraph/network_operations_analysis_assistant/test_network_operations_analysis_assistant.py @@ -1,9 +1,7 @@ import os import unittest -import warnings from unittest import TestCase -import pandas as pd from dotenv import load_dotenv from langchain_lab.langgraph.network_operations_analysis_assistant.network_operations_analysis_assistant import \ @@ -21,17 +19,6 @@ def test_main(self): recursion_limit=50) assistant.run() - def test_load_data(self): - warnings.filterwarnings("ignore", category=UserWarning, module="openpyxl") - df = pd.read_excel("./wireless_network_statistics_data.xlsx") - print(df.head()) - analysis_result = df.describe() - print(analysis_result) - - numerical_df = df.select_dtypes(include=['float64', 'int64']) - correlation = numerical_df.corr() - print(correlation) - if __name__ == "__main__": unittest.main()