Skip to content

Commit

Permalink
Merge pull request #66 from Significant-Gravitas/ntindle/agpt-440-tel…
Browse files Browse the repository at this point in the history
…l-the-llm-about-our-tech-stack-in-the-interview

Add basic knowedge of the system to the interview
  • Loading branch information
ntindle authored Mar 3, 2024
2 parents 29668d2 + 65f0b0f commit f3e78ec
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 7 deletions.
11 changes: 7 additions & 4 deletions codex/develop/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,11 +316,14 @@ def create_server_route_code(complied_route: CompiledRoute) -> str:

# 4. Determine path parameters
path_params = extract_path_params(route_spec.path)
params = set(
[arg.ReferredObjectType.name for arg in args if arg.ReferredObjectType]
)
func_args_names = set([arg.name for arg in args])
if not set(path_params).issubset(func_args_names):
raise ComplicationFailure(
f"Path parameters {path_params} not in function arguments {func_args_names}"
)
# if not set(path_params).issubset(func_args_names):
# raise ComplicationFailure(
# f"Path parameters {path_params} not in function arguments {func_args_names}"
# )

http_verb = str(route_spec.method)
route_decorator = f"@app.{http_verb.lower()}('{route_spec.path}'"
Expand Down
8 changes: 7 additions & 1 deletion codex/interview/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from codex.common.ai_block import Identifiers, Tool
from codex.interview.blocks.ai_interview import InterviewBlock
from codex.interview.choose_tool import use_tool
from codex.interview.database import _create_interview_testing_only, create_interview
from codex.interview.database import _create_interview_testing_only
from codex.interview.hardcoded import (
appointment_optimization_interview,
availability_checker_interview,
Expand Down Expand Up @@ -110,6 +110,12 @@ async def next_step(
"task": task,
"tools": {tool.name: tool.description for tool in tools},
"memory": memory,
"tech_stack": {
"programming_language": "Python",
"api_framework": "FastAPI",
"database": "PostgreSQL",
"orm": "Prisma",
},
},
)

Expand Down
14 changes: 14 additions & 0 deletions codex/interview/blocks/ai_interview.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ async def run_ai() -> dict[str, InterviewMessageUse]:
"finished": "finish the task and provide a comprehensive project to the user. Include the important notes from the task as well. This should be very detailed and comprehensive. Do NOT use this if there are unsettled questions.",
},
"memory": [],
"tech_stack": {
"programming_language": "Python",
"api_framework": "FastAPI",
"frontend_framework": "React",
"database": "PostgreSQL",
"orm": "Prisma",
},
},
)

Expand All @@ -129,6 +136,13 @@ async def run_ai() -> dict[str, InterviewMessageUse]:
"search": "search the web for information",
"finished": "finish the task and provide a comprehensive project to the user. Include the important notes from the task as well. This should be very detailed and comprehensive. Do NOT use this if there are unsettled questions.",
},
"tech_stack": {
"programming_language": "Python",
"api_framework": "FastAPI",
"frontend_framework": "React",
"database": "PostgreSQL",
"orm": "Prisma",
},
"memory": [
{
"tool": "ask",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,15 @@ Here's some context
Your available database models are: {{ db_models }}


If there are no params, put [] in the params field rather than leaving it blank
If there are no params, put [] in the params field rather than leaving it blank.
Ensure all path, query, and body params are included in the request model params.
For path params, the name should be the name of the path param, the param_type should be the type of the path param, and the description should be a description of the path param. It should not go into any wrapping object.

for example, if an endpoint is /r/{id}/s/{name}, the request model should have two params, one for id and one for name. The name of the first param should be "id", the name of the second param should be "name", and the param_type should be the type of the path param. The description should be a description of the path param. It should not go into any wrapping object.
If there is also a body, that should be included in the request model params as well.
an example would be something like POST /update/{id}/name/{name} with a body of the update. The request model should have three params, one for id, one for name, and one for the body. The name of the first param should be "id", the name of the second param should be "name", and the name of the third param should be "body". The param_type should be the type of the path param for the first two, and the type of the body for the third. The description should be a description of the path param for the first two, and a description of the body for the third. It should not go into any wrapping object.

Ensure all response params are included in the response model params.

```json
{
Expand Down
10 changes: 9 additions & 1 deletion codex/prompts/gpt-4-0125-preview/requirements/endpoint/user.j2
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,15 @@ Here's some context
Your available database models are: {{ db_models }}


If there are no params, put [] in the params field rather than leaving it blank
If there are no params, put [] in the params field rather than leaving it blank.
Ensure all path, query, and body params are included in the request model params.
For path params, the name should be the name of the path param, the param_type should be the type of the path param, and the description should be a description of the path param. It should not go into any wrapping object.

for example, if an endpoint is /r/{id}/s/{name}, the request model should have two params, one for id and one for name. The name of the first param should be "id", the name of the second param should be "name", and the param_type should be the type of the path param. The description should be a description of the path param. It should not go into any wrapping object.
If there is also a body, that should be included in the request model params as well.
an example would be something like POST /update/{id}/name/{name} with a body of the update. The request model should have three params, one for id, one for name, and one for the body. The name of the first param should be "id", the name of the second param should be "name", and the name of the third param should be "body". The param_type should be the type of the path param for the first two, and the type of the body for the third. The description should be a description of the path param for the first two, and a description of the body for the third. It should not go into any wrapping object.

Ensure all response params are included in the response model params.


```json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ Your available tools are

all of them will take a `content` parameter and return a response in plain text.

The tech stack you can choose from is

{{ tech_stack }}

a valid response to `make an app` could be (keep in mind this is a simplified example)

```json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ Your available tools are

all of them will take a `content` parameter and return a response in plain text.

The tech stack you can choose from is

{{ tech_stack }}

a valid response looks like this

```json
Expand Down

0 comments on commit f3e78ec

Please sign in to comment.