diff --git a/core/agents/spec_writer.py b/core/agents/spec_writer.py index c45bd82a8..cdd93dd76 100644 --- a/core/agents/spec_writer.py +++ b/core/agents/spec_writer.py @@ -62,26 +62,27 @@ async def initialize_spec(self) -> AgentResponse: # nothing but repeat the question. We reproduce this bug for bug here. return AgentResponse.done(self) - spec = response.text.strip() + user_description = response.text.strip() - complexity = await self.check_prompt_complexity(spec) + complexity = await self.check_prompt_complexity(user_description) await telemetry.trace_code_event( "project-description", { - "initial_prompt": spec, + "initial_prompt": user_description, "complexity": complexity, }, ) - if len(spec) < ANALYZE_THRESHOLD and complexity != Complexity.SIMPLE: - spec = await self.analyze_spec(spec) - spec = await self.review_spec(spec) + if len(user_description) < ANALYZE_THRESHOLD and complexity != Complexity.SIMPLE: + initial_spec = await self.analyze_spec(user_description) + reviewed_spec = await self.review_spec(desc=user_description, spec=initial_spec) self.next_state.specification = self.current_state.specification.clone() - self.next_state.specification.original_description = spec - self.next_state.specification.description = spec + self.next_state.specification.original_description = user_description + self.next_state.specification.description = reviewed_spec self.next_state.specification.complexity = complexity - telemetry.set("initial_prompt", spec) + telemetry.set("initial_prompt", user_description) + telemetry.set("updated_prompt", reviewed_spec) telemetry.set("is_complex_app", complexity != Complexity.SIMPLE) self.next_state.action = SPEC_STEP_NAME @@ -203,11 +204,11 @@ async def analyze_spec(self, spec: str) -> str: n_answers += 1 convo.user(user_response.text) - async def review_spec(self, spec: str) -> str: - convo = AgentConvo(self).template("review_spec", spec=spec) + async def review_spec(self, desc: str, spec: str) -> str: + convo = AgentConvo(self).template("review_spec", desc=desc, spec=spec) llm = self.get_llm(SPEC_WRITER_AGENT_NAME) llm_response: str = await llm(convo, temperature=0) additional_info = llm_response.strip() if additional_info and len(additional_info) > 6: - spec += "\nAdditional info/examples:\n" + additional_info + spec += "\n\nAdditional info/examples:\n\n" + additional_info return spec diff --git a/core/prompts/spec-writer/review_spec.prompt b/core/prompts/spec-writer/review_spec.prompt index 8f8e5f5e2..043a340ad 100644 --- a/core/prompts/spec-writer/review_spec.prompt +++ b/core/prompts/spec-writer/review_spec.prompt @@ -9,7 +9,7 @@ This might include: Here is the client brief: ---CLIENT-BRIEF-START--- -{{ state.specification.description }} +{{ desc }} ---CLIENT-BRIEF-END--- Here is the specification your team came up with: