Created
May 17, 2021 14:38
-
-
Save ikanez/9692272b0f2dcc71d05a0f1a46b7b76f to your computer and use it in GitHub Desktop.
Prompt for GPT-3 for search capability
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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