Skip to content

Instantly share code, notes, and snippets.

@amin3141
Last active May 7, 2021
Embed
What would you like to do?
Sending a semantic search query using HTTP REST
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