blob: 0881024316c7ebcd3b62e0a314ec38c159d503d3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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)
|