Skip to content

Commit

Permalink
Review fixes. Use JSON schema for LLM response.
Browse files Browse the repository at this point in the history
  • Loading branch information
gperetin committed Jun 19, 2024
1 parent 20934d0 commit 1aec48a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
6 changes: 5 additions & 1 deletion core/agents/troubleshooter.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,11 @@ 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)
convo = (
self._get_task_convo()
.template("get_route_files", task=self.current_state.current_task)
.require_schema(RouteFilePaths)
)
file_list = await llm(convo, parser=JSONParser(RouteFilePaths))
route_files: set[str] = set(file_list.files)

Expand Down
1 change: 1 addition & 0 deletions core/prompts/troubleshooter/define_user_review_goal.prompt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ File **`{{ file.path }}`** ({{file.content.content.splitlines()|length}} lines o
{{ file.content.content }}```

{% endfor %}
---END_OF_FILES---
{% endif %}
How can a human user test if this task was completed successfully?

Expand Down
12 changes: 0 additions & 12 deletions core/prompts/troubleshooter/get_route_files.prompt
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,3 @@ them, and this prompt selects those files.

#}
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.

Example response:
```
{
"files": [
"dir/file1.js",
"dir/file2.js",
]
}
```

Your response must be a valid JSON format.

0 comments on commit 1aec48a

Please sign in to comment.