diff --git a/core/agents/error_handler.py b/core/agents/error_handler.py index 66dbe05ce..0150bf3c1 100644 --- a/core/agents/error_handler.py +++ b/core/agents/error_handler.py @@ -111,7 +111,7 @@ async def handle_command_error(self, message: str, details: dict) -> AgentRespon "description": llm_response, "alternative_solutions": [], "attempts": 1, - "status": IterationStatus.HUNTING_FOR_BUG, + "status": IterationStatus.IMPLEMENT_SOLUTION, "bug_hunting_cycles": [], } ] diff --git a/core/llm/anthropic_client.py b/core/llm/anthropic_client.py index f458a7b2b..1fc7d1d01 100644 --- a/core/llm/anthropic_client.py +++ b/core/llm/anthropic_client.py @@ -15,6 +15,7 @@ # Maximum number of tokens supported by Anthropic Claude 3 MAX_TOKENS = 4096 +MAX_TOKENS_SONNET = 8192 class AnthropicClient(BaseLLMClient): @@ -72,6 +73,11 @@ async def _make_request( "messages": messages, "temperature": self.config.temperature if temperature is None else temperature, } + + if "sonnet" in self.config.model: + completion_kwargs["extra_headers"] = {"anthropic-beta": "max-tokens-3-5-sonnet-2024-07-15"} + completion_kwargs["max_tokens"] = MAX_TOKENS_SONNET + if json_mode: completion_kwargs["response_format"] = {"type": "json_object"} diff --git a/core/prompts/developer/breakdown.prompt b/core/prompts/developer/breakdown.prompt index f11511961..51715cbe7 100644 --- a/core/prompts/developer/breakdown.prompt +++ b/core/prompts/developer/breakdown.prompt @@ -4,21 +4,6 @@ You are working on an app called "{{ state.branch.project.name }}" and you need {% include "partials/features_list.prompt" %} {% include "partials/files_list.prompt" %} -We've broken the development of this {% if state.epics|length > 1 %}feature{% else %}app{% endif %} down to these tasks: -``` -{% for task in state.tasks %} -{{ loop.index }}. {{ task.description }}{% if task.get("status") == "done" %} (completed){% endif %} -{% endfor %} -``` - -You are currently working on task #{{ current_task_index + 1 }} with the following description: -``` -{{ task.description }} -``` -{% if current_task_index != 0 %}All previous tasks are finished and you don't have to work on them.{% endif %} - -Now, tell me all the code that needs to be written to implement ONLY this task and have it fully working and all commands that need to be run to implement this task. - {% include "partials/doc_snippets.prompt" %} {%- if state.epics|length == 1 %} @@ -35,3 +20,19 @@ DO NOT specify commands to create any folders or files, they will be created aut {% include "partials/file_size_limit.prompt" %} Never use the port 5000 to run the app, it's reserved. + +--IMPLEMENTATION INSTRUCTIONS-- +We've broken the development of this {% if state.epics|length > 1 %}feature{% else %}app{% endif %} down to these tasks: +``` +{% for task in state.tasks %} +{{ loop.index }}. {{ task.description }}{% if task.get("status") == "done" %} (completed){% endif %} +{% endfor %} +``` + +You are currently working on task #{{ current_task_index + 1 }} with the following description: +``` +{{ task.description }} +``` +{% if current_task_index != 0 %}All previous tasks are finished and you don't have to work on them.{% endif %} + +Now, tell me all the code that needs to be written to implement ONLY this task and have it fully working and all commands that need to be run to implement this task.