Lucas ARRIESSE commited on
Commit
32239ae
·
1 Parent(s): 72683de

Return solutions which are not grounded on search items

Browse files
Files changed (2) hide show
  1. app.py +8 -3
  2. prompts/criticize.txt +1 -1
app.py CHANGED
@@ -30,10 +30,14 @@ llm_router = Router(model_list=[
30
  "litellm_params": {
31
  "model": os.environ.get("LLM_MODEL"),
32
  "api_key": os.environ.get("LLM_API_KEY"),
33
- "max_retries": 5
 
 
 
 
34
  }
35
  }
36
- ], cooldown_time=30)
37
 
38
  # Jinja2 environment to load prompt templates
39
  prompt_env = Environment(loader=FileSystemLoader(
@@ -140,9 +144,10 @@ async def search_solutions(params: ReqGroupingResponse) -> SolutionSearchRespons
140
 
141
  # generate the completion in non-structured mode.
142
  # the googleSearch tool enables grounding gemini with google search
 
143
  req_completion = await llm_router.acompletion(model="chat", messages=[
144
  {"role": "user", "content": req_prompt}
145
- ], tools=[{"googleSearch": {}}])
146
 
147
  # ==================== structure the solution as a json ===================================
148
 
 
30
  "litellm_params": {
31
  "model": os.environ.get("LLM_MODEL"),
32
  "api_key": os.environ.get("LLM_API_KEY"),
33
+ "rpm": 15,
34
+ "max_parallel_requests": 4,
35
+ "allowed_fails": 1,
36
+ "cooldown_time": 60,
37
+ "max_retries": 10,
38
  }
39
  }
40
+ ], num_retries=10, retry_after=30)
41
 
42
  # Jinja2 environment to load prompt templates
43
  prompt_env = Environment(loader=FileSystemLoader(
 
144
 
145
  # generate the completion in non-structured mode.
146
  # the googleSearch tool enables grounding gemini with google search
147
+ # this also forces gemini to perform a tool call
148
  req_completion = await llm_router.acompletion(model="chat", messages=[
149
  {"role": "user", "content": req_prompt}
150
+ ], tools=[{"googleSearch": {}}], tool_choice="required")
151
 
152
  # ==================== structure the solution as a json ===================================
153
 
prompts/criticize.txt CHANGED
@@ -1,4 +1,4 @@
1
- <role>You are an useful engineering assistant for innovation</role>
2
  <task>
3
  You are tasked with criticizing multiple solutions solving a set of requirements on different points,
4
  namely the technical challenges of the solutions, the weaknesses and limitations of the proposed solutions.
 
1
+ <role>You are an expert system designer</role>
2
  <task>
3
  You are tasked with criticizing multiple solutions solving a set of requirements on different points,
4
  namely the technical challenges of the solutions, the weaknesses and limitations of the proposed solutions.