peichao.dong
commited on
Commit
·
ebd41b5
1
Parent(s):
7a27b40
refacoter code generate tools
Browse files- agents/code_generate_agent.py +1 -1
- agents/promopts.py +19 -0
- promopts.py +0 -33
agents/code_generate_agent.py
CHANGED
|
@@ -6,7 +6,7 @@ from langchain.agents import Tool, LLMSingleActionAgent, AgentExecutor, AgentOut
|
|
| 6 |
from langchain.schema import AgentAction, AgentFinish
|
| 7 |
from langchain.agents import initialize_agent
|
| 8 |
from langchain.prompts import StringPromptTemplate
|
| 9 |
-
from promopts import code_generate_agent_template
|
| 10 |
from agents.tools.api_layer_code_tool import apiLayerCodeGenerator
|
| 11 |
from agents.tools.domain_layer_code_tool import domainLayerCodeGenerator
|
| 12 |
from agents.tools.persistent_layer_code_tool import persistentLayerCodeGenerator
|
|
|
|
| 6 |
from langchain.schema import AgentAction, AgentFinish
|
| 7 |
from langchain.agents import initialize_agent
|
| 8 |
from langchain.prompts import StringPromptTemplate
|
| 9 |
+
from agents.promopts import code_generate_agent_template
|
| 10 |
from agents.tools.api_layer_code_tool import apiLayerCodeGenerator
|
| 11 |
from agents.tools.domain_layer_code_tool import domainLayerCodeGenerator
|
| 12 |
from agents.tools.persistent_layer_code_tool import persistentLayerCodeGenerator
|
agents/promopts.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
code_generate_agent_template = """You are a tool picker.
|
| 2 |
+
You should pick a tool of following tools to ansser the question.:
|
| 3 |
+
|
| 4 |
+
{tools}
|
| 5 |
+
|
| 6 |
+
Use the following format:
|
| 7 |
+
|
| 8 |
+
Request: the request
|
| 9 |
+
Thought: which tool should used to fufill this request and pass the original content of Request to it.
|
| 10 |
+
Action: the action to take, should be one of [{tool_names}]
|
| 11 |
+
Action Input: the original content of Request
|
| 12 |
+
Observation: the result of the action
|
| 13 |
+
... (this Thought/Action/Action Input/Observation can repeat 1 times)
|
| 14 |
+
Final Answer: the result of the action
|
| 15 |
+
|
| 16 |
+
Begin!
|
| 17 |
+
|
| 18 |
+
Request: {input}
|
| 19 |
+
{agent_scratchpad}"""
|
promopts.py
CHANGED
|
@@ -49,39 +49,6 @@ Begin!
|
|
| 49 |
Story: {input}
|
| 50 |
{agent_scratchpad}"""
|
| 51 |
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
code_generate_agent_template = """You are a tool picker.
|
| 64 |
-
You should pick a tool of following tools to ansser the question.:
|
| 65 |
-
|
| 66 |
-
{tools}
|
| 67 |
-
|
| 68 |
-
Use the following format:
|
| 69 |
-
|
| 70 |
-
Request: the request
|
| 71 |
-
Thought: which tool should used to fufill this request and pass the original content of Request to it.
|
| 72 |
-
Action: the action to take, should be one of [{tool_names}]
|
| 73 |
-
Action Input: the original content of Request
|
| 74 |
-
Observation: the result of the action
|
| 75 |
-
... (this Thought/Action/Action Input/Observation can repeat 1 times)
|
| 76 |
-
Final Answer: the result of the action
|
| 77 |
-
|
| 78 |
-
Begin!
|
| 79 |
-
|
| 80 |
-
Request: {input}
|
| 81 |
-
{agent_scratchpad}"""
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
CONTENT_RE_WRIGHT = """你是一个文案助手,请将如下文案整理重写,去除重复的内容,尽量保留原有信息:
|
| 86 |
```
|
| 87 |
{input}
|
|
|
|
| 49 |
Story: {input}
|
| 50 |
{agent_scratchpad}"""
|
| 51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
CONTENT_RE_WRIGHT = """你是一个文案助手,请将如下文案整理重写,去除重复的内容,尽量保留原有信息:
|
| 53 |
```
|
| 54 |
{input}
|