From 8837b02de6de95c94ef9efe363d635ab4123ba9e Mon Sep 17 00:00:00 2001 From: Saba Date: Sun, 28 Nov 2021 12:26:07 -0500 Subject: [PATCH] dump updated config to a yaml file --- config.yml | 48 +++++++++++++++++++----------------------------- src/main.py | 5 +++-- 2 files changed, 22 insertions(+), 31 deletions(-) diff --git a/config.yml b/config.yml index ef75c19f..701af2a2 100644 --- a/config.yml +++ b/config.yml @@ -1,32 +1,22 @@ -content-type: +content_type: + image: null + ledger: null + music: null org: - input-files: ["/home/saba/notes/notes.org", "/home/saba/notes/writing.org"] - input-filter: null - compressed-jsonl: ".notes.json.gz" - embeddings-file: ".note_embeddings.pt" - - # ledger: - # input-files: /home/projects/personal-finance/bon.beancount - # input-filter: null - # compressed-jsonl: .transactions.jsonl.gz - # embeddings-file: .transaction_embeddings.pt - - # image: - # input-directory: "tests/data" - # embeddings-file: "tests/data/.image_embeddings.pt" - # batch-size: 50 - # use-xmp-metadata: "no" - - # music: - # input-files: ["tests/data/music.org"] - # input-filter: null - # compressed-jsonl: "tests/data/.songs.jsonl.gz" - # embeddings-file: "tests/data/.song_embeddings.pt" - -search-type: + compressed_jsonl: .notes.json.gz + embeddings_file: .note_embeddings.pt + input_files: + - /home/saba/notes/notes.org + - /home/saba/notes/writing.org + input_filter: null +processor: + conversation: + conversation_history: '' + conversation_logfile: .conversation_logs.json + open_api_key: null +search_type: asymmetric: - encoder: "sentence-transformers/msmarco-MiniLM-L-6-v3" - cross-encoder: "cross-encoder/ms-marco-MiniLM-L-6-v2" - + cross_encoder: cross-encoder/ms-marco-MiniLM-L-6-v2 + encoder: sentence-transformers/msmarco-MiniLM-L-6-v3 image: - encoder: "clip-ViT-B-32" + encoder: clip-ViT-B-32 diff --git a/src/main.py b/src/main.py index 31b6c085..aa36fd45 100644 --- a/src/main.py +++ b/src/main.py @@ -37,8 +37,9 @@ def config(): @app.post('/config') async def config(updated_config: FullConfig): - to_yaml = yaml.dump(updated_config.json()) - print(to_yaml) + with open('config.yml', 'w') as outfile: + yaml.dump(yaml.safe_load(updated_config.json()), outfile) + outfile.close() return updated_config @app.get('/search')