prompt_helper = PromptHelper(max_input_size=3500,
chunk_size_limit=750,
num_output=256,
max_chunk_overlap=75)
node_parser = SimpleNodeParser(
text_splitter=TokenTextSplitter(
chunk_size=750,
chunk_overlap=75
)
)
service_context = ServiceContext.from_defaults(llm_predictor=self.llm_predictor,
prompt_helper=prompt_helper,
embed_model=self.embedding_model,
chunk_size_limit=75,
node_parser=node_parser
)
nodes = node_parser.get_nodes_from_documents(documents)
storage_context = StorageContext.from_defaults(
vector_store=ChromaVectorStore(chroma_collection=chroma_collection)
)
storage_context.docstore.add_documents(nodes)
self.index = GPTVectorStoreIndex(nodes=nodes,
storage_context=storage_context,
service_context=self.service_context
)