When using the node parser?
from llama_index import ServiceContext, GPTListIndex
from llama_index.node_parser import SimpleNodeParser
from llama_index.langchain_helpers.text_splitter import TokenTextSplitter
splitter = TokenTextSplitter(chunk_size=512)
parser = SimpleNodeParser(text_splitter=splitter)
nodes = parser.get_nodes_from_documents(documents)
index = GPTListIndex(nodes, service_context=ServiceContext.from_defaults(chunk_size_limit=512))
Without the node parser, just define it in the service context alone π
You can also use any text splitter you want (from langchain, or llama_index also has a sentence-based splitter)