Skip to content

Trying to Change the Node ID while using TokenTextSplitter and IngestionPipeline #11015

Answered by dosubot bot
saadk8 asked this question in Q&A
Discussion options

You must be logged in to vote

🤖

Hey @saadk8, great to see you diving into LlamaIndex and reaching out for help! Always here to lend a hand.

I'm glad to hear that you're finding the LlamaIndex package useful. To change the Node IDs, you can provide your own function to the id_func parameter when you create an instance of TokenTextSplitter. This function will be used to generate the IDs for all nodes, including those in relationships.

Here's an example of how you can do this:

def my_id_func(index, document):
    return f"my-new-node-id-{index}"

text_splitter = TokenTextSplitter(
    separator="\n\nQuestion:", 
    chunk_size=512, 
    chunk_overlap=0,
    id_func=my_id_func,  # Use your custom function here
)

pipeline = 

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by saadk8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant