Skip to content

Commit

Permalink
Add ASCII graph visualization to network and marketing analysis reports
Browse files Browse the repository at this point in the history
  • Loading branch information
coolbeevip committed Jul 11, 2024
1 parent 5843565 commit c1440b9
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 14 deletions.
43 changes: 42 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
@@ -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 \
Expand All @@ -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()

0 comments on commit c1440b9

Please sign in to comment.