Skip to content

Instantly share code, notes, and snippets.

@ikanez
Created May 17, 2021 14:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ikanez/9692272b0f2dcc71d05a0f1a46b7b76f to your computer and use it in GitHub Desktop.
Save ikanez/9692272b0f2dcc71d05a0f1a46b7b76f to your computer and use it in GitHub Desktop.
Prompt for GPT-3 for search capability
# based on job classification on jobstreet.com
job_classification = [
"accounting/finance",
"admin/human resources",
"sales/marketing",
"arts/media/communications",
"services",
"hotel/restaurant",
"education/training",
"computer/IT",
"engineering",
"manufacturing",
"building/construction",
"science",
"healthcare"
]
def call_openapi(query, documents=job_classification):
response = openai.Engine("ada").search(
documents = documents,
query=query,
max_rerank=5
)
return response
def sort_score(response,documents=job_classification):
response_scores = [i.score for i in response.data]
zipped_list = zip(response_scores,documents)
sorted_zipped_lists = sorted(zipped_list, reverse=True)
return sorted_zipped_lists
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment