Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Fix smol dev prompt formatting
Tomas Valentafbc19c5dbd47
diff --git a/api-service/agent/smol_agent.py b/api-service/agent/smol_agent.pyindex 17a41b9e4..7aea20f3a 100644--- a/api-service/agent/smol_agent.py+++ b/api-service/agent/smol_agent.py@@ -71,6 +71,11 @@ class SmolAgent(AgentBase):# TODO: Apply the file rewrite when the agent was invoked via PR code commentfile: str | None = instructions.get("File", None)+ # await self.on_logs(+ # {+ # "message": f"hi its me, 🐣the smol developer🐣! you said you wanted:\n{user_prompt}"+ # }+ # )playground = Nonetry:callback_manager = AsyncCallbackManager([StreamingStdOutCallbackHandler()])@@ -143,36 +148,36 @@ class SmolAgent(AgentBase):filecode = await generate_response(f"""You are an AI developer who is trying to write a program that will generate code for the user based on their intent.- the app is: {prompt}+the app is: {prompt}- the files we have decided to generate are: {filepaths_string}+the files we have decided to generate are: {filepaths_string}- the shared dependencies (like filenames and variable names) we have decided on are: {shared_dependencies}+the shared dependencies (like filenames and variable names) we have decided on are: {shared_dependencies}- only write valid code for the given filepath and file type, and return only the code.- do not add any other explanation, only return valid code for that file type.- """,+only write valid code for the given filepath and file type, and return only the code.+do not add any other explanation, only return valid code for that file type.+""",f"""- We have broken up the program into per-file generation.- Now your job is to generate only the code for the file {filename}.- Make sure to have consistent filenames if you reference other files we are also generating.+We have broken up the program into per-file generation.+Now your job is to generate only the code for the file {filename}.+Make sure to have consistent filenames if you reference other files we are also generating.- Remember that you must obey 3 things:- - you are generating code for the file {filename}- - do not stray from the names of the files and the shared dependencies we have decided on- - MOST IMPORTANT OF ALL - the purpose of our app is {prompt} - every line of code you generate must be valid code. Do not include code fences in your response, for example+Remember that you must obey 3 things:+- you are generating code for the file {filename}+- do not stray from the names of the files and the shared dependencies we have decided on+- MOST IMPORTANT OF ALL - the purpose of our app is {prompt} - every line of code you generate must be valid code. Do not include code fences in your response, for example- Bad response:- ```javascript- console.log("hello world")- ```+Bad response:+```javascript+console.log("hello world")+```- Good response:- console.log("hello world")+Good response:+console.log("hello world")- Begin generating the code now.+Begin generating the code now.- """,+""",)return filename, filecode@@ -180,11 +185,11 @@ class SmolAgent(AgentBase):filepaths_string = await generate_response("""You are an AI developer who is trying to write a program that will generate code for the user based on their intent.- When given their intent, create a complete, exhaustive list of filepaths that the user would write to make the program.+When given their intent, create a complete, exhaustive list of filepaths that the user would write to make the program.- only list the filepaths you would write, and return them as a python list of strings.- do not add any other explanation, only return a python list of strings.- """,+only list the filepaths you would write, and return them as a python list of strings.+do not add any other explanation, only return a python list of strings.+""",user_prompt,)@@ -216,18 +221,18 @@ class SmolAgent(AgentBase):shared_dependencies = await generate_response("""You are an AI developer who is trying to write a program that will generate code for the user based on their intent.- In response to the user's prompt:+In response to the user's prompt:- ---- the app is: {prompt}- ---+---+the app is: {prompt}+---- the files we have decided to generate are: {filepaths_string}+the files we have decided to generate are: {filepaths_string}- Now that we have a list of files, we need to understand what dependencies they share.- Please name and briefly describe what is shared between the files we are generating, including exported variables, data schemas, id names of every DOM elements that javascript functions will use, message names, and function names.- Exclusively focus on the names of the shared dependencies, and do not add any other explanation.- """,+Now that we have a list of files, we need to understand what dependencies they share.+Please name and briefly describe what is shared between the files we are generating, including exported variables, data schemas, id names of every DOM elements that javascript functions will use, message names, and function names.+Exclusively focus on the names of the shared dependencies, and do not add any other explanation.+""",user_prompt,)print(shared_dependencies)