diff options
author | Nate Sesti <sestinj@gmail.com> | 2023-05-23 23:45:12 -0400 |
---|---|---|
committer | Nate Sesti <sestinj@gmail.com> | 2023-05-23 23:45:12 -0400 |
commit | f53768612b1e2268697b5444e502032ef9f3fb3c (patch) | |
tree | 4ed49b73e6bd3c2f8fceffa9643973033f87af95 /extension/scripts/replace.py | |
download | sncontinue-f53768612b1e2268697b5444e502032ef9f3fb3c.tar.gz sncontinue-f53768612b1e2268697b5444e502032ef9f3fb3c.tar.bz2 sncontinue-f53768612b1e2268697b5444e502032ef9f3fb3c.zip |
copying from old repo
Diffstat (limited to 'extension/scripts/replace.py')
-rw-r--r-- | extension/scripts/replace.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/extension/scripts/replace.py b/extension/scripts/replace.py new file mode 100644 index 00000000..08810243 --- /dev/null +++ b/extension/scripts/replace.py @@ -0,0 +1,17 @@ +import sys +from gpt_index import GPTSimpleVectorIndex, Document + +def replace_additional_index(info: str): + """Replace the additional index.""" + with open('data/additional_context.txt', 'w') as f: + f.write(info) + documents = [Document(info)] + index = GPTSimpleVectorIndex(documents) + index.save_to_disk('data/additional_index.json') + print("Additional index replaced") + +if __name__ == "__main__": + """python3 replace.py <info>""" + info = sys.argv[1] if len(sys.argv) > 1 else None + if info: + replace_additional_index(info)
\ No newline at end of file |