Last active
May 7, 2021 19:08
-
-
Save amin3141/f71907738f5fe9aef7030546ba909be4 to your computer and use it in GitHub Desktop.
Sending a semantic search query using HTTP REST
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
data = """ | |
{ | |
"query": [ | |
{ | |
"query": "%s", | |
"num_results": 3, | |
"corpus_key": [ | |
{ | |
"customer_id": %s, | |
"corpus_id": %s | |
} | |
] | |
} | |
] | |
} | |
""" % (line.replace('"', '\\"'), self.customer_id, self.corpus_id) | |
# Send the request to the server. | |
response = requests.post( | |
self.url, | |
headers={ | |
"authorization": "Bearer %s" % self.token["access_token"], | |
"customer-id": str(self.customer_id) | |
}, | |
data=data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment