Skip to content

Commit

Permalink
Merge pull request #11 from mldzs/feature/add_filter_by_intent_to_req…
Browse files Browse the repository at this point in the history
…uest_backend_get_examples

add filter by intent to request_backend_get_examples function
  • Loading branch information
mldzs committed Feb 8, 2021
2 parents d1a99f8 + 3066237 commit fe1bed7
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions bothub_backend/bothub.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ def get_langs(self):
print(f"Starting connection get_langs()")
time_start = time.time()
langs = requests.get(
"{}/v2/repository/nlp/authorization/langs/".format(self.backend,)
"{}/v2/repository/nlp/authorization/langs/".format(
self.backend,
)
).json()
print(f"End connection get_langs() {str(time.time() - time_start)}")
return langs
Expand Down Expand Up @@ -193,7 +195,11 @@ def request_backend_start_training_nlu(
"{}/v2/repository/nlp/authorization/train/start_training/".format(
self.backend
),
data={"repository_version": update_id, "by_user": by, "from_queue": from_queue},
data={
"repository_version": update_id,
"by_user": by,
"from_queue": from_queue,
},
headers={"Authorization": "Bearer {}".format(repository_authorization)},
).json()
print(
Expand Down Expand Up @@ -223,15 +229,24 @@ def request_backend_save_queue_id(
return update

def request_backend_get_examples(
self, update_id, use_pagination=False, page=None, repository_authorization=None
self,
update_id,
use_pagination=False,
page=None,
repository_authorization=None,
intent="",
):
print(f"Starting connection request_backend_get_examples()")
time_start = time.time()
if not use_pagination:
update = requests.get(
"{}/v2/repository/nlp/authorization/train/get_examples/?repository_version={}".format(
self.backend, update_id
"{}/v2/repository/nlp/authorization/train/get_examples".format(
self.backend
),
params={
"repository_version": update_id,
"intent": intent
},
headers={"Authorization": "Bearer {}".format(repository_authorization)},
).json()
else:
Expand Down Expand Up @@ -298,7 +313,7 @@ def request_backend_traininglog_nlu(
return update

def request_backend_parse_nlu_persistor(
self, update_id, repository_authorization, rasa_version, no_bot_data=False
self, update_id, repository_authorization, rasa_version, no_bot_data=False
):
print(f"Starting connection request_backend_parse_nlu_persistor()")
time_start = time.time()
Expand Down Expand Up @@ -364,7 +379,9 @@ def send_log_nlp_parse(self, data):
update = requests.post(
"{}/v2/repository/nlp/log/".format(self.backend),
json=data,
headers={"Content-Type": "application/json",},
headers={
"Content-Type": "application/json",
},
).json()
print(f"End connection send_log_nlp_parse() {str(time.time() - time_start)}")
return update

0 comments on commit fe1bed7

Please sign in to comment.