From bf44f80420989cfaa8538c4884ccb3e078bc5a09 Mon Sep 17 00:00:00 2001 From: pratacosmin Date: Tue, 2 Apr 2024 16:05:15 +0300 Subject: [PATCH 1/3] add ask pythia query --- src/wisecube_sdk/client.py | 11 +++++++++++ src/wisecube_sdk/string_query.py | 7 +++++++ 2 files changed, 18 insertions(+) diff --git a/src/wisecube_sdk/client.py b/src/wisecube_sdk/client.py index a42bc7c..e7d0ad4 100644 --- a/src/wisecube_sdk/client.py +++ b/src/wisecube_sdk/client.py @@ -134,6 +134,17 @@ def get_admet_predictions(self, smiles: [str], model: WisecubeModel): response = api_calls.create_api_call(payload, headers, self.url, "json") return create_response.basic(response) + def ask_pythia(self, references: [str], response: str, question: str): + variables = { + "reference": references, + "response": response, + "question": question + } + payload = create_payload.create(string_query.ask_pythia, variables) + headers = self.get_headers() + response = api_calls.create_api_call(payload, headers, self.url, "json") + return create_response.basic(response) + class OpenClient: def __init__(self, url): diff --git a/src/wisecube_sdk/string_query.py b/src/wisecube_sdk/string_query.py index a569df4..050cd1b 100644 --- a/src/wisecube_sdk/string_query.py +++ b/src/wisecube_sdk/string_query.py @@ -162,3 +162,10 @@ } } """ + + +ask_pythia = """ +query askPythia($reference: [String!], $response: String!, $question: String) { + askPythia(reference: $reference, response: $response, question: $question) +} +""" From c90c67341b15bf8f514351f1fdbbd1e36ccb1a82 Mon Sep 17 00:00:00 2001 From: pratacosmin Date: Tue, 2 Apr 2024 17:41:19 +0300 Subject: [PATCH 2/3] add ask pythia query --- src/wisecube_sdk/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wisecube_sdk/client.py b/src/wisecube_sdk/client.py index e7d0ad4..67bd2c1 100644 --- a/src/wisecube_sdk/client.py +++ b/src/wisecube_sdk/client.py @@ -134,7 +134,7 @@ def get_admet_predictions(self, smiles: [str], model: WisecubeModel): response = api_calls.create_api_call(payload, headers, self.url, "json") return create_response.basic(response) - def ask_pythia(self, references: [str], response: str, question: str): + def ask_pythia(self, references: [str], response: str, question): variables = { "reference": references, "response": response, From 0692578d3e3d6392ae41191fda70503a69599f36 Mon Sep 17 00:00:00 2001 From: pratacosmin Date: Tue, 2 Apr 2024 17:49:29 +0300 Subject: [PATCH 3/3] add ask pythia query --- src/wisecube_sdk/client.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/wisecube_sdk/client.py b/src/wisecube_sdk/client.py index 67bd2c1..5b5b5fa 100644 --- a/src/wisecube_sdk/client.py +++ b/src/wisecube_sdk/client.py @@ -16,7 +16,6 @@ def __init__(self, *args): raise Exception("Invalid args") - class QueryMethods: def __init__(self, url, client_id): self.url = url @@ -76,7 +75,7 @@ def search_text(self, text): payload = create_payload.create(string_query.search_text, variables) headers = self.get_headers() response = api_calls.create_api_call(payload, headers, self.url, "json") - return create_response.search_text(response,self.output_format ) + return create_response.search_text(response, self.output_format) def execute_vector_function(self, graphIds: [str]): variables = { @@ -134,12 +133,13 @@ def get_admet_predictions(self, smiles: [str], model: WisecubeModel): response = api_calls.create_api_call(payload, headers, self.url, "json") return create_response.basic(response) - def ask_pythia(self, references: [str], response: str, question): + def ask_pythia(self, references: [str], response: str, question: str): variables = { "reference": references, - "response": response, - "question": question + "response": response } + if question is not None: + variables["question"] = question payload = create_payload.create(string_query.ask_pythia, variables) headers = self.get_headers() response = api_calls.create_api_call(payload, headers, self.url, "json")