Skip to content

Instantly share code, notes, and snippets.

@amin3141
Last active May 7, 2021 19:08
Show Gist options
  • Save amin3141/f71907738f5fe9aef7030546ba909be4 to your computer and use it in GitHub Desktop.
Save amin3141/f71907738f5fe9aef7030546ba909be4 to your computer and use it in GitHub Desktop.
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