Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add agentUniverse-data flow. #95

Merged
merged 27 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
50659d8
feat: add data agent in the agentUniverse.
EdwinInAu Jun 14, 2024
b7dbe10
feat: add data agent in the agentUniverse.
EdwinInAu Jun 17, 2024
9012d18
feat: add data agent in the agentUniverse.
EdwinInAu Jun 18, 2024
36ba3e8
feat: add data agent in the agentUniverse.
EdwinInAu Jun 18, 2024
1b19975
feat: add data agent in the agentUniverse.
EdwinInAu Jun 18, 2024
73f6685
feat: add data agent in the agentUniverse.
EdwinInAu Jun 19, 2024
3d37dfd
feat: add data agent in the agentUniverse.
EdwinInAu Jun 19, 2024
ec55462
feat: add data agent in the agentUniverse.
EdwinInAu Jun 20, 2024
7ae0bd8
docs: update readme & guidebook
LandJerry Jun 14, 2024
da761da
feat: Release version 0.0.9
LandJerry Jun 14, 2024
53fee05
feat: Release version 0.0.9
LandJerry Jun 14, 2024
188695a
Add: peer case docs
AniviaTn Jun 18, 2024
bab76de
Add: peer case docs
AniviaTn Jun 18, 2024
b604777
docs: update README
LandJerry Jun 18, 2024
751c85e
docs: update readme
LandJerry Jun 14, 2024
c1e0ff7
docs: update README for new version
LandJerry Jun 17, 2024
57dd5f0
docs: update readme for new version.
LandJerry Jun 17, 2024
ede51e2
docs: update Discord code
LandJerry Jun 17, 2024
8c4fd61
add tool doc
weizjajj Jun 17, 2024
cebfbf0
add en doc
weizjajj Jun 17, 2024
ba905ac
暂存
weizjajj Jun 17, 2024
0fecf96
add knowlege
weizjajj Jun 17, 2024
6707da4
fix output
weizjajj Jun 17, 2024
3105870
remove unused import
weizjajj Jun 17, 2024
83ba37d
add deepseek support
weizjajj Jun 19, 2024
377f19c
Fix: Pydantic warning in chroma store
AniviaTn Jun 20, 2024
0af9a6f
Merge remote-tracking branch 'origin/dev' into dev_chongshi_data_agent
LandJerry Jun 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add knowlege
  • Loading branch information
weizjajj authored and LandJerry committed Jun 21, 2024
commit 0fecf96d852e40ba899174e8d26d69a34be82a85
4 changes: 2 additions & 2 deletions agentuniverse/agent/action/knowledge/knowledge.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# @Author : wangchongshi
# @Email : [email protected]
# @FileName: knowledge.py
from typing import Optional, Dict, List, Any
from typing import Optional, Dict, List

from langchain_core.utils.json import parse_json_markdown
from langchain.tools import Tool as LangchainTool
Expand Down Expand Up @@ -94,7 +94,7 @@ def langchain_query(self, query: str) -> str:
res.append(doc.text)
return "\n=========================================\n".join(res)

def as_langchain_tool(self) -> Any:
def as_langchain_tool(self) -> LangchainTool:
"""Convert the Knowledge object to a LangChain tool.

Returns:
Expand Down
12 changes: 12 additions & 0 deletions agentuniverse/agent/plan/planner/react_planner/react_planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
from langchain.tools import Tool as LangchainTool
from langchain_core.runnables import RunnableConfig

from agentuniverse.agent.action.knowledge.knowledge import Knowledge
from agentuniverse.agent.action.knowledge.knowledge_manager import KnowledgeManager
from agentuniverse.agent.action.tool.tool import Tool
from agentuniverse.agent.action.tool.tool_manager import ToolManager
from agentuniverse.agent.agent import Agent
from agentuniverse.agent.agent_model import AgentModel
from agentuniverse.agent.input_object import InputObject
from agentuniverse.agent.memory.chat_memory import ChatMemory
Expand Down Expand Up @@ -78,6 +81,15 @@ def acquire_tools(action) -> list[LangchainTool]:
for tool_name in tool_names:
tool: Tool = ToolManager().get_instance_obj(tool_name)
lc_tools.append(tool.as_langchain())
knowledge: list = action.get('knowledge') or list()
for knowledge_name in knowledge:
knowledge_tool: Knowledge = KnowledgeManager().get_instance_obj(knowledge_name)
lc_tools.append(knowledge_tool.as_langchain_tool())

agents: list = action.get('agent') or list()
for agent_name in agents:
agent_tool: Agent = AgentModel.load_by_name(agent_name)
lc_tools.append(agent_tool.as_langchain_tool())
return lc_tools

def handle_prompt(self, agent_model: AgentModel, planner_input: dict) -> Prompt:
Expand Down
17 changes: 10 additions & 7 deletions sample_standard_app/app/test/test_rag_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
# @FileName: test_rag_agent.py
import unittest

from agentuniverse.agent.action.knowledge.knowledge import Knowledge
from agentuniverse.agent.action.knowledge.knowledge_manager import KnowledgeManager
from agentuniverse.agent.agent import Agent
from agentuniverse.agent.agent_manager import AgentManager
from agentuniverse.agent.output_object import OutputObject
Expand All @@ -23,13 +25,14 @@ def setUp(self) -> None:

def test_rag_agent(self):
"""Test demo rag agent."""
instance: Agent = AgentManager().get_instance_obj('demo_rag_agent')
# output_object: OutputObject = instance.run(input='分析下巴菲特减持比亚迪的原因')
# res_info = f"\nRag agent execution result is :\n"
# res_info += output_object.get_data('output')
# print(res_info)
tool = instance.as_langchain_tool()
print(tool.description)
# instance: Agent = AgentManager().get_instance_obj('demo_rag_agent')
# # output_object: OutputObject = instance.run(input='分析下巴菲特减持比亚迪的原因')
# # res_info = f"\nRag agent execution result is :\n"
# # res_info += output_object.get_data('output')
# # print(res_info)
# tool = instance.as_langchain_tool()
knowledge: Knowledge = KnowledgeManager().get_instance_obj('demo_knowledge')
print(knowledge.as_langchain_tool().description)


if __name__ == '__main__':
Expand Down