Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
commit
Vasek Mlejnsky134dd9296baa
diff --git a/api-service/codegen/agent/base.py b/api-service/codegen/agent/base.pyindex d94878415..f13dc2ce0 100644--- a/api-service/codegen/agent/base.py+++ b/api-service/codegen/agent/base.py@@ -13,6 +13,7 @@ from langchain.tools.base import BaseToolFINAL_ANSWER_ACTION = "Final Answer:"+FINAL_ANSWER_ACTION_NO_WHITESPACE = "FinalAnswer"ACTIONS_QUEUE = "action_queue"MALFORMED_ANSWER = "malformed_answer"@@ -242,7 +243,10 @@ class CodegenAgentExecutor(AgentExecutor):# Sometimes the LLM decides to pass the value of `FINAL_ANSWER_ACTION` as a tool name.# Instead of trying to "force" the LLM to don't do that, we can just write a bit of# code and handle this case.- elif output.tool == FINAL_ANSWER_ACTION:+ elif (+ output.tool == FINAL_ANSWER_ACTION+ or output.tool == FINAL_ANSWER_ACTION_NO_WHITESPACE+ ):return AgentFinish({"output": output.tool_input}, output.log)# Sometimes the agent just completely messed up the output format.@@ -321,7 +325,10 @@ class CodegenAgentExecutor(AgentExecutor):# Sometimes the LLM decides to pass the value of `FINAL_ANSWER_ACTION` as a tool name.# Instead of trying to "force" the LLM to don't do that, we can just write a bit of# code and handle this case.- elif output.tool == FINAL_ANSWER_ACTION:+ elif (+ output.tool == FINAL_ANSWER_ACTION+ or output.tool == FINAL_ANSWER_ACTION_NO_WHITESPACE+ ):return AgentFinish({"output": output.tool_input}, output.log)# Sometimes the agent just completely messed up the output format.diff --git a/api-service/codegen/codegen.py b/api-service/codegen/codegen.pyindex 47fec4fd8..1905d7230 100644--- a/api-service/codegen/codegen.py+++ b/api-service/codegen/codegen.py@@ -174,7 +174,8 @@ class Codegen(BaseModel):inst_idx += 1instructions = instructions + "\n" + f"{inst_idx}. {inst}"- instructions += "\nThought: Here is the plan of how I will go about solving this based on the instructions I got:\n1."+ # instructions += "\nThought: Here is the plan of how I will go about solving this based on the instructions I got:\n1."+ # instructions += "\nThought:"print("Instructions:\n", instructions)print("Running executor...")diff --git a/api-service/codegen/prompt.py b/api-service/codegen/prompt.pyindex d86d88d0f..5903f5313 100644--- a/api-service/codegen/prompt.py+++ b/api-service/codegen/prompt.py@@ -36,6 +36,10 @@ Final Answer: the final answer"""SYSTEM_SUFFIX = """Begin! Reminder to NEVER use tools you don't have access. Reminder to ALWAYS use the exact the action `Final Answer` when you know the final answer."""HUMAN_INSTRUCTIONS_PREFIX = [+ {+ "variables": [],+ "content": "You are building a slack bot that sends a message to channel every time it gets a new request. You have access to the folling environment variables: `SLACK_BOT_ACCESS_TOKEN`",+ },{"variables": [],"content": "Do not try to come up with solutions and code if you do not know. Instead, use the tool `AskHuman` to ask for help.",@@ -49,7 +53,7 @@ const app = express();const port = 3000;app.use(express.json())// TODO: Implement the {0} handlers here-app.listen(port, () => {{+app.listen(port, async () => {{console.log(`Server listening on port ${{port}}`)}})```""",@@ -65,13 +69,15 @@ app.listen(port, () => {{]HUMAN_INSTRUCTIONS_SUFFIX = [- "Think about it and plan your work first",- "If you are not sure what to do or something is not working and you do not know why, use the tool `AskHuman` to ask for help",- "Always run the code before you submit the answer",- "Generate the full required server code and and make sure it starts without any errors",- "Test that the generated server from the previous step works as required by making mock `curl` requests to the server",+ "Do not forget to use async and await when sending message",+ # "Think about it and plan your work first",+ "If something is not working and you do not know why, use the tool `AskHuman` to ask for help",+ # "If you do not know how to use an NPM package, DO NOT COME UP WITH IMAGINARY CODE, instead use the tool `AskHuman` to ask for help",+ "ALWAYS run the code before you submit the answer",+ "Generate the full required server code and and make sure it runs without any errors",+ "ALWAYS test that the generated server works as required by making mock `curl` requests to the server",# "Once all works without any bugs and errors, write the code to the file",# "Deploy the code",- "Once you know the final code, output it as the 'Final answer:'",+ "Once you are done, output the final code as the 'Final answer:'"# "Thought: Here is the plan of how I will go about solving this based on the instructions I got:\n1.",]diff --git a/components/Editor/RightSidebar/Envs.tsx b/components/Editor/RightSidebar/Envs.tsxindex 19b6ff127..b98bb2e1d 100644--- a/components/Editor/RightSidebar/Envs.tsx+++ b/components/Editor/RightSidebar/Envs.tsx@@ -88,6 +88,7 @@ function Envs({ }: Props) {focus:border-green-600"placeholder="VALUE"+ type="password"value={env.value}onChange={event => handleEnvValueChange(event, idx)}/>