Lucas ARRIESSE
commited on
Commit
Β·
0925e1c
1
Parent(s):
be704f8
Sort prompts + add doc for prompts
Browse files- api/requirements.py +1 -1
- api/solutions.py +4 -4
- prompts/private/README +8 -1
- prompts/public/README.md +9 -0
- prompts/{bootstrap_solution.txt β public/bootstrap_solution.txt} +0 -0
- prompts/{classify.txt β public/classify.txt} +0 -0
- prompts/{criticize.txt β public/criticize.txt} +0 -0
- prompts/{format_requirements.txt β public/format_requirements.txt} +0 -0
- prompts/{refine_solution.txt β public/refine_solution.txt} +0 -0
- prompts/structure_solution.txt +0 -12
api/requirements.py
CHANGED
@@ -46,7 +46,7 @@ async def categorize_reqs(params: ReqGroupingRequest, prompt_env: Environment =
|
|
46 |
messages = []
|
47 |
|
48 |
# categorize the requirements using their indices
|
49 |
-
req_prompt = await prompt_env.get_template("classify.txt").render_async(**{
|
50 |
"requirements": [rq.model_dump() for rq in params.requirements],
|
51 |
"max_n_categories": params.max_n_categories,
|
52 |
"response_schema": _ReqGroupingOutput.model_json_schema()})
|
|
|
46 |
messages = []
|
47 |
|
48 |
# categorize the requirements using their indices
|
49 |
+
req_prompt = await prompt_env.get_template("public/classify.txt").render_async(**{
|
50 |
"requirements": [rq.model_dump() for rq in params.requirements],
|
51 |
"max_n_categories": params.max_n_categories,
|
52 |
"response_schema": _ReqGroupingOutput.model_json_schema()})
|
api/solutions.py
CHANGED
@@ -45,7 +45,7 @@ async def bootstrap_solutions(req: SolutionBootstrapRequest, prompt_env: Environ
|
|
45 |
fmt_completion = await llm_router.acompletion("gemini-v2", messages=[
|
46 |
{
|
47 |
"role": "user",
|
48 |
-
"content": await prompt_env.get_template("format_requirements.txt").render_async(**{
|
49 |
"category": cat.model_dump(),
|
50 |
"response_schema": InsightFinderConstraintsList.model_json_schema()
|
51 |
})
|
@@ -66,7 +66,7 @@ async def bootstrap_solutions(req: SolutionBootstrapRequest, prompt_env: Environ
|
|
66 |
|
67 |
format_solution = await llm_router.acompletion("gemini-v2", messages=[{
|
68 |
"role": "user",
|
69 |
-
"content": await prompt_env.get_template("bootstrap_solution.txt").render_async(**{
|
70 |
"category": cat.model_dump(),
|
71 |
"technologies": technologies.model_dump()["technologies"],
|
72 |
"user_constraints": req.user_constraints,
|
@@ -103,7 +103,7 @@ async def criticize_solution(params: CriticizeSolutionsRequest, prompt_env: Envi
|
|
103 |
"""Criticize the challenges, weaknesses and limitations of the provided solutions."""
|
104 |
|
105 |
async def __criticize_single(solution: SolutionModel):
|
106 |
-
req_prompt = await prompt_env.get_template("criticize.txt").render_async(**{
|
107 |
"solutions": [solution.model_dump()],
|
108 |
"response_schema": _SolutionCriticismOutput.model_json_schema()
|
109 |
})
|
@@ -131,7 +131,7 @@ async def refine_solutions(params: CritiqueResponse, prompt_env: Environment = D
|
|
131 |
"""Refines the previously critiqued solutions."""
|
132 |
|
133 |
async def __refine_solution(crit: SolutionCriticism):
|
134 |
-
req_prompt = await prompt_env.get_template("refine_solution.txt").render_async(**{
|
135 |
"solution": crit.solution.model_dump(),
|
136 |
"criticism": crit.criticism,
|
137 |
"response_schema": _RefinedSolutionModel.model_json_schema(),
|
|
|
45 |
fmt_completion = await llm_router.acompletion("gemini-v2", messages=[
|
46 |
{
|
47 |
"role": "user",
|
48 |
+
"content": await prompt_env.get_template("public/format_requirements.txt").render_async(**{
|
49 |
"category": cat.model_dump(),
|
50 |
"response_schema": InsightFinderConstraintsList.model_json_schema()
|
51 |
})
|
|
|
66 |
|
67 |
format_solution = await llm_router.acompletion("gemini-v2", messages=[{
|
68 |
"role": "user",
|
69 |
+
"content": await prompt_env.get_template("public/bootstrap_solution.txt").render_async(**{
|
70 |
"category": cat.model_dump(),
|
71 |
"technologies": technologies.model_dump()["technologies"],
|
72 |
"user_constraints": req.user_constraints,
|
|
|
103 |
"""Criticize the challenges, weaknesses and limitations of the provided solutions."""
|
104 |
|
105 |
async def __criticize_single(solution: SolutionModel):
|
106 |
+
req_prompt = await prompt_env.get_template("public/criticize.txt").render_async(**{
|
107 |
"solutions": [solution.model_dump()],
|
108 |
"response_schema": _SolutionCriticismOutput.model_json_schema()
|
109 |
})
|
|
|
131 |
"""Refines the previously critiqued solutions."""
|
132 |
|
133 |
async def __refine_solution(crit: SolutionCriticism):
|
134 |
+
req_prompt = await prompt_env.get_template("public/refine_solution.txt").render_async(**{
|
135 |
"solution": crit.solution.model_dump(),
|
136 |
"criticism": crit.criticism,
|
137 |
"response_schema": _RefinedSolutionModel.model_json_schema(),
|
prompts/private/README
CHANGED
@@ -1 +1,8 @@
|
|
1 |
-
Prompts for client-side inference (in `private/`) should only use basic variable templating.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
>**!!WARNING!!**: Prompts for client-side inference (in `private/`) should only use basic variable templating.
|
2 |
+
|
3 |
+
## List of client-side prompts used for assessment using private LLM
|
4 |
+
- `assess` : Prompt for assessing the user idea
|
5 |
+
- `extract` : Prompt for extracting information from the LLM assessment in a structured way
|
6 |
+
- `refine` : Prompt for refining the user idea with supplied insights
|
7 |
+
- `fto_topics` : Retrieves from a user idea the topics to look up for FTO analysis
|
8 |
+
- `fto_assess` : Assess the FTO analysis results
|
prompts/public/README.md
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
## List of public prompts
|
3 |
+
- `format_requirements`: Glue prompt for extracting most important constraints to retrieve relevant technologies
|
4 |
+
- `bootstrap_solution` : Boostrap a solution from a list of technologies
|
5 |
+
- `structure_solution` : Format a bootstrapped solution into a structured outptut
|
6 |
+
- `criticize`: Criticize a boostraped solution for refinement
|
7 |
+
- `refine_solution` : Refines a boostrapped solution using critics
|
8 |
+
- `classify` : Categorize requirements into sections
|
9 |
+
-
|
prompts/{bootstrap_solution.txt β public/bootstrap_solution.txt}
RENAMED
File without changes
|
prompts/{classify.txt β public/classify.txt}
RENAMED
File without changes
|
prompts/{criticize.txt β public/criticize.txt}
RENAMED
File without changes
|
prompts/{format_requirements.txt β public/format_requirements.txt}
RENAMED
File without changes
|
prompts/{refine_solution.txt β public/refine_solution.txt}
RENAMED
File without changes
|
prompts/structure_solution.txt
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
<role>You are an expert system designer</role>
|
2 |
-
<task>Your task is to take a solution you've created previously and structure it into a JSON object.</task>
|
3 |
-
|
4 |
-
Here is the solution
|
5 |
-
<solution>
|
6 |
-
{{solution}}
|
7 |
-
</solution>
|
8 |
-
|
9 |
-
<response_format>
|
10 |
-
Reply in JSON using the following schema:
|
11 |
-
{{response_schema}}
|
12 |
-
</response_format>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|