Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #1064

Closed
wants to merge 5 commits into from
Closed

Fixes #1064

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/agents/error_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": [],
}
]
Expand Down
2 changes: 1 addition & 1 deletion core/agents/task_reviewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ async def review_code_changes(self) -> AgentResponse:
)
llm_response: str = await llm(convo, temperature=0.7)

if "done" in llm_response.strip().lower()[-7:]:
if "done" in llm_response.strip().lower()[-20:]:
return AgentResponse.done(self)
else:
return AgentResponse.task_review_feedback(self, llm_response)
6 changes: 6 additions & 0 deletions core/llm/anthropic_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

# Maximum number of tokens supported by Anthropic Claude 3
MAX_TOKENS = 4096
MAX_TOKENS_SONNET = 8192


class AnthropicClient(BaseLLMClient):
Expand Down Expand Up @@ -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"}

Expand Down
31 changes: 16 additions & 15 deletions core/prompts/developer/breakdown.prompt
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand All @@ -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.
4 changes: 2 additions & 2 deletions core/templates/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from core.log import get_logger

from .node_express_mongoose import NodeExpressMongooseProjectTemplate
from .react_express import ReactExpressProjectTemplate

Check failure on line 6 in core/templates/registry.py

View workflow job for this annotation

GitHub Actions / build (3.9, ubuntu-latest)

Ruff (F401)

core/templates/registry.py:6:28: F401 `.react_express.ReactExpressProjectTemplate` imported but unused

Check failure on line 6 in core/templates/registry.py

View workflow job for this annotation

GitHub Actions / build (3.9, macos-latest)

Ruff (F401)

core/templates/registry.py:6:28: F401 `.react_express.ReactExpressProjectTemplate` imported but unused

Check failure on line 6 in core/templates/registry.py

View workflow job for this annotation

GitHub Actions / build (3.9, windows-latest)

Ruff (F401)

core\templates\registry.py:6:28: F401 `.react_express.ReactExpressProjectTemplate` imported but unused

Check failure on line 6 in core/templates/registry.py

View workflow job for this annotation

GitHub Actions / build (3.12, ubuntu-latest)

Ruff (F401)

core/templates/registry.py:6:28: F401 `.react_express.ReactExpressProjectTemplate` imported but unused

Check failure on line 6 in core/templates/registry.py

View workflow job for this annotation

GitHub Actions / build (3.12, macos-latest)

Ruff (F401)

core/templates/registry.py:6:28: F401 `.react_express.ReactExpressProjectTemplate` imported but unused

Check failure on line 6 in core/templates/registry.py

View workflow job for this annotation

GitHub Actions / build (3.12, windows-latest)

Ruff (F401)

core\templates\registry.py:6:28: F401 `.react_express.ReactExpressProjectTemplate` imported but unused

log = get_logger(__name__)

Expand All @@ -13,11 +13,11 @@

# JAVASCRIPT_REACT = JavascriptReactProjectTemplate.name
NODE_EXPRESS_MONGOOSE = NodeExpressMongooseProjectTemplate.name
REACT_EXPRESS = ReactExpressProjectTemplate.name
# REACT_EXPRESS = ReactExpressProjectTemplate.name


PROJECT_TEMPLATES = {
# JavascriptReactProjectTemplate.name: JavascriptReactProjectTemplate,
NodeExpressMongooseProjectTemplate.name: NodeExpressMongooseProjectTemplate,
ReactExpressProjectTemplate.name: ReactExpressProjectTemplate,
# ReactExpressProjectTemplate.name: ReactExpressProjectTemplate,
}
Loading