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

Crashes #1043

Merged
merged 5 commits into from
Jul 2, 2024
Merged

Crashes #1043

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
8 changes: 5 additions & 3 deletions core/agents/code_monkey.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,12 @@ async def implement_changes(self) -> AgentResponse:
user_feedback = None
user_feedback_qa = None
llm = self.get_llm()

if iterations:
instructions = iterations[-1]["description"]
user_feedback = iterations[-1]["user_feedback"]
user_feedback_qa = iterations[-1]["user_feedback_qa"]
last_iteration = iterations[-1]
instructions = last_iteration.get("description")
user_feedback = last_iteration.get("user_feedback")
user_feedback_qa = last_iteration.get("user_feedback_qa")
else:
instructions = self.current_state.current_task["instructions"]

Expand Down
3 changes: 1 addition & 2 deletions core/agents/developer.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,11 @@ async def breakdown_current_task(self) -> AgentResponse:
)
response: str = await llm(convo)

# FIXME: check if this is correct, as sqlalchemy can't figure out modifications
# to attributes; however, self.next is not saved yet so maybe this is fine
self.next_state.tasks[current_task_index] = {
**task,
"instructions": response,
}
self.next_state.flag_tasks_as_modified()

await self.send_message("Breaking down the task into steps ...")
convo.assistant(response).template("parse_task").require_schema(TaskSteps)
Expand Down
12 changes: 6 additions & 6 deletions core/agents/tech_lead.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@
log = get_logger(__name__)


class Task(BaseModel):
description: str = Field(description=("Very detailed description of a development task."))
class Epic(BaseModel):
description: str = Field(description=("Description of an epic."))


class DevelopmentPlan(BaseModel):
plan: list[Task] = Field(description="List of development tasks that need to be done to implement the entire plan.")
plan: list[Epic] = Field(description="List of epics that need to be done to implement the entire plan.")


class UpdatedDevelopmentPlan(BaseModel):
updated_current_epic: Task = Field(
description="Updated detailed description of what was implemented while working on the current development task."
updated_current_epic: Epic = Field(
description="Updated description of what was implemented while working on the current epic."
)
plan: list[Task] = Field(description="List of unfinished development tasks.")
plan: list[Epic] = Field(description="List of unfinished epics.")


class TechLead(BaseAgent):
Expand Down
6 changes: 1 addition & 5 deletions core/agents/troubleshooter.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,7 @@ async def _get_route_files(self) -> list[File]:
"""Returns the list of file paths that have routes defined in them."""

llm = self.get_llm(ROUTE_FILES_AGENT_NAME)
convo = (
self._get_task_convo()
.template("get_route_files", task=self.current_state.current_task)
.require_schema(RouteFilePaths)
)
convo = AgentConvo(self).template("get_route_files").require_schema(RouteFilePaths)
file_list = await llm(convo, parser=JSONParser(RouteFilePaths))
route_files: set[str] = set(file_list.files)

Expand Down
2 changes: 1 addition & 1 deletion core/prompts/architect/technologies.prompt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
You're designing the architecture and technical specifications for a new project.

If the project requirements call out for specific technology, use that. Otherwise, if working on a web app, prefer Node.js for the backend (with Express if a web server is needed, and MongoDB if a database is needed), and Bootstrap for the front-end. You MUST NOT use Docker, Kubernetes, microservices and single-page app frameworks like React, Next.js, Angular, Vue or Svelte unless the project details explicitly require it.
If the project requirements call out for specific technology, use that. Otherwise, if working on a web app, prefer Node.js for the backend (with Express if a web server is needed, and MongoDB if a database is needed), and Bootstrap for the front-end. You MUST NOT use Docker, Kubernetes, microservices and single-page app frameworks like Next.js, Angular, Vue or Svelte unless the project details explicitly require it.

Here are the details for the new project:
-----------------------------
Expand Down
5 changes: 2 additions & 3 deletions core/prompts/tech-lead/system.prompt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
You are an experienced tech lead in a software development agency.
Your main task is to break down the project into smaller tasks that developers will do.
You must specify each task as clear as possible.
Each task must have a description of what needs to be implemented.
Your main job is to break down the project into epics that developers will do.
You must specify each epic as clear as possible.
3 changes: 3 additions & 0 deletions core/prompts/troubleshooter/get_route_files.prompt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ The solution was to add the entire content of all the files that have routes def
them, and this prompt selects those files.

#}
{% include "partials/project_details.prompt" %}
{% include "partials/files_list.prompt" %}

Your task is to identify all the files, from the above list, that have routes defined in them. Return just the file paths as a JSON list named "files", DO NOT return anything else. If there are no files with routes, return an empty list.
10 changes: 5 additions & 5 deletions tests/agents/test_tech_lead.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest

from core.agents.response import ResponseType
from core.agents.tech_lead import DevelopmentPlan, Task, TechLead, UpdatedDevelopmentPlan
from core.agents.tech_lead import DevelopmentPlan, Epic, TechLead, UpdatedDevelopmentPlan
from core.db.models import Complexity
from core.db.models.project_state import TaskStatus
from core.ui.base import UserInput
Expand Down Expand Up @@ -87,8 +87,8 @@ async def test_plan_epic(agentcontext):
tl.get_llm = mock_get_llm(
return_value=DevelopmentPlan(
plan=[
Task(description="Task 1"),
Task(description="Task 2"),
Epic(description="Task 1"),
Epic(description="Task 2"),
]
)
)
Expand Down Expand Up @@ -122,8 +122,8 @@ async def test_update_epic(agentcontext):
tl = TechLead(sm, ui)
tl.get_llm = mock_get_llm(
return_value=UpdatedDevelopmentPlan(
updated_current_epic=Task(description="Updated Just Finished"),
plan=[Task(description="Alternative Future Task")],
updated_current_epic=Epic(description="Updated Just Finished"),
plan=[Epic(description="Alternative Future Task")],
)
)

Expand Down
Loading