Skip to content

Commit

Permalink
Format Python code with psf/black push
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions authored and github-actions committed Feb 6, 2023
1 parent 2cf1632 commit f8972ec
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions models/search_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,18 @@ async def search(self, query, user_api_key, search_scope, nodes):

llm_predictor = LLMPredictor(llm=OpenAI(model_name="text-davinci-003"))
try:
llm_predictor_presearch = OpenAI(max_tokens=30, temperature=0, model_name="text-davinci-003")
llm_predictor_presearch = OpenAI(
max_tokens=30, temperature=0, model_name="text-davinci-003"
)

# Refine a query to send to google custom search API
query_refined = llm_predictor_presearch.generate(prompts=["You are refining a query to send to the Google Custom Search API. Change the query such that putting it into the Google Custom Search API will return the most relevant websites to assist us in answering the original query. Respond with only the refined query for the original query. The original query is: " + query +"\nRefined Query:"])
query_refined = llm_predictor_presearch.generate(
prompts=[
"You are refining a query to send to the Google Custom Search API. Change the query such that putting it into the Google Custom Search API will return the most relevant websites to assist us in answering the original query. Respond with only the refined query for the original query. The original query is: "
+ query
+ "\nRefined Query:"
]
)
query_refined_text = query_refined.generations[0][0].text
except Exception as e:
traceback.print_exc()
Expand Down Expand Up @@ -172,7 +180,6 @@ async def search(self, query, user_api_key, search_scope, nodes):

embedding_model = OpenAIEmbedding()


index = await self.loop.run_in_executor(
None, partial(GPTSimpleVectorIndex, documents, embed_model=embedding_model)
)
Expand Down

0 comments on commit f8972ec

Please sign in to comment.