Skip to content

Commit

Permalink
add constrains on the step execution and workflow generation (#250)
Browse files Browse the repository at this point in the history
  • Loading branch information
dongyuanjushi authored Sep 24, 2024
1 parent 8d5f038 commit 633dccd
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The goal of AIOS is to build a large language model (LLM) agent operating system

## 🏠 Architecture of AIOS
<p align="center">
<img src="images/AIOS-Architecture.png">
<img src="docs/assets/aios-figs/AIOS-Architecture.png">
</p>

AIOS provides the LLM kernel as an abstraction on top of the OS kernel. The kernel facilitates the installation, execution and usage of agents. Furthermore, the AIOS SDK facilitates the development and deployment of agents.
Expand Down
5 changes: 4 additions & 1 deletion aios/llm_core/llm_classes/gpt_llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,12 @@ def process(self,
messages = messages,
tools = agent_process.query.tools,
# tool_choice = "required" if agent_process.query.tools else None,
max_tokens = self.max_new_tokens
max_tokens = self.max_new_tokens,
# response_format = {"type": "json_object"}
)
# print(response_message)
response_message = response.choices[0].message.content
# print(response_message)
tool_calls = self.parse_tool_calls(
response.choices[0].message.tool_calls
)
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
2 changes: 0 additions & 2 deletions images/README.md

This file was deleted.

16 changes: 9 additions & 7 deletions pyopenagi/agents/react_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,24 @@ def build_system_instruction(self):
[
f'You are given the available tools from the tool list: {json.dumps(self.tool_info)} to help you solve problems. ',
'Generate a plan of steps you need to take. ',
'The plan must follow the json format as: ',
'The plan must follow the json format as below: ',
'[',
'{"message": "message_value1","tool_use": [tool_name1, tool_name2,...]}',
'{"message": "message_value2", "tool_use": [tool_name1, tool_name2,...]}',
'...',
']',
'In each step of the planned workflow, you must select the most related tool to use',
'Followings are some plan examples:',
'In each step of the planned plan, identify tools to use and recognize no tool is necessary. ',
'Followings are some plan examples. ',
'['
'[',
'{"message": "gather information from arxiv. ", "tool_use": ["arxiv"]},',
'{"message", "write a summarization based on the gathered information. ", "tool_use": []}',
'];',
'[',
'{"message": "identify the tool that you need to call to obtain information. ", "tool_use": ["imdb_top_movies", "imdb_top_series"]},',
'{"message", "give recommendations for the user based on the information. ", "tool_use": []}',
'];',
'{"message": "gather information from arxiv. ", "tool_use": ["arxiv"]},',
'{"message", "understand the current methods and propose ideas that can improve ", "tool_use": []}',
']',
']'
]
)

Expand Down Expand Up @@ -138,7 +140,7 @@ def run(self):
message = step["message"]
tool_use = step["tool_use"]

prompt = f"At step {i + 1}, you need to: {message}. "
prompt = f"At step {i + 1}, you need to: {message}. Outputs should be pure text without any json object"
self.messages.append({
"role": "user",
"content": prompt
Expand Down
2 changes: 1 addition & 1 deletion pyopenagi/utils/chat_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class Query:
def __init__(self,
messages,
tools = None,
message_return_type = "text"
message_return_type = "json"
) -> None:
"""Query format
Expand Down

0 comments on commit 633dccd

Please sign in to comment.