You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: models/search_model.py
+14-17Lines changed: 14 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -221,13 +221,14 @@ async def search(
221
221
multistep=False,
222
222
redo=None,
223
223
):
224
-
DEFAULT_SEARCH_NODES=1
224
+
DEFAULT_SEARCH_NODES=4
225
225
ifnotuser_api_key:
226
226
os.environ["OPENAI_API_KEY"] =self.openai_key
227
227
else:
228
228
os.environ["OPENAI_API_KEY"] =user_api_key
229
229
openai.api_key=os.environ["OPENAI_API_KEY"]
230
230
231
+
231
232
# Initialize the search cost
232
233
price=0
233
234
@@ -239,28 +240,21 @@ async def search(
239
240
)
240
241
241
242
try:
242
-
llm_predictor_presearch=OpenAI(
243
-
max_tokens=50,
244
-
temperature=0.4,
243
+
llm_predictor_presearch=ChatOpenAI(
244
+
max_tokens=100,
245
+
temperature=0,
245
246
presence_penalty=0.65,
246
-
model_name="text-davinci-003",
247
+
model_name=model,
247
248
)
248
249
249
250
# Refine a query to send to google custom search API
250
251
prompt=f"You are to be given a search query for google. Change the query such that putting it into the Google Custom Search API will return the most relevant websites to assist in answering the original query. If the original query is inferring knowledge about the current day, insert the current day into the refined prompt. If the original query is inferring knowledge about the current month, insert the current month and year into the refined prompt. If the original query is inferring knowledge about the current year, insert the current year into the refined prompt. Generally, if the original query is inferring knowledge about something that happened recently, insert the current month into the refined query. Avoid inserting a day, month, or year for queries that purely ask about facts and about things that don't have much time-relevance. The current date is {str(datetime.now().date())}. Do not insert the current date if not neccessary. Respond with only the refined query for the original query. Don’t use punctuation or quotation marks.\n\nExamples:\n---\nOriginal Query: ‘Who is Harald Baldr?’\nRefined Query: ‘Harald Baldr biography’\n---\nOriginal Query: ‘What happened today with the Ohio train derailment?’\nRefined Query: ‘Ohio train derailment details {str(datetime.now().date())}’\n---\nOriginal Query: ‘Is copper in drinking water bad for you?’\nRefined Query: ‘copper in drinking water adverse effects’\n---\nOriginal Query: What's the current time in Mississauga?\nRefined Query: current time Mississauga\nNow, refine the user input query.\nOriginal Query: {query}\nRefined Query:"
0 commit comments