Skip to content
This repository has been archived by the owner on Aug 27, 2024. It is now read-only.

Commit

Permalink
Rename DP APIs to be more intuitive
Browse files Browse the repository at this point in the history
  • Loading branch information
maxyu1115 committed Aug 22, 2023
1 parent f4be560 commit 070d870
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions memas/dataplane.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
dataplane = Blueprint("dp", __name__, url_prefix="/dp")


@dataplane.route('/recollect', methods=["POST"])
def recollect():
@dataplane.route('/recall', methods=["POST"])
def recall():
namespace_pathname: str = request.json["namespace_pathname"]
clue: str = request.json["clue"]

current_app.logger.info(f"Recollecting [namespace_pathname=\"{namespace_pathname}\"]")
current_app.logger.info(f"Recalling [namespace_pathname=\"{namespace_pathname}\"]")

corpus_ids = ctx.memas_metadata.get_query_corpora(namespace_pathname)

Expand All @@ -34,13 +34,13 @@ def recollect():
return [{"document": doc, "citation": asdict(citation)} for doc, citation in search_results[0:5]]


@dataplane.route('/remember', methods=["POST"])
def remember():
@dataplane.route('/memorize', methods=["POST"])
def memorize():
corpus_pathname: str = request.json["corpus_pathname"]
document: str = request.json["document"]
document_name: str = request.json.get("document_name", "")

current_app.logger.info(f"Remembering [corpus_pathname=\"{corpus_pathname}\"] [document_name=\"{document_name}\"]")
current_app.logger.info(f"Memorizing [corpus_pathname=\"{corpus_pathname}\"] [document_name=\"{document_name}\"]")

# TODO : need to be able to fetch the corpus name for citation purposes
corpus_name = split_corpus_pathname(corpus_pathname)[1]
Expand All @@ -53,5 +53,5 @@ def remember():
corpus: Corpus = ctx.corpus_provider.get_corpus(corpus_info.corpus_id, corpus_type=corpus_info.corpus_type)
success = corpus.store_and_index(document, document_name, citation)

current_app.logger.info(f"Remember finished [success={success}]")
current_app.logger.info(f"Memorize finished [success={success}]")
return {"success": success}

0 comments on commit 070d870

Please sign in to comment.