0
0
LangChainframework~10 mins

Code-aware text splitting in LangChain - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import the RecursiveCharacterTextSplitter from langchain.text_splitter.

LangChain
from langchain.text_splitter import [1]
Drag options to blanks, or click blank then click option'
ATextSplitter
BRecursiveCharacterTextSplitter
CCharacterTextSplitter
DCodeTextSplitter
Attempts:
3 left
💡 Hint
Common Mistakes
Importing a non-existent class like CodeTextSplitter.
Using a generic name like TextSplitter which is not the correct class.
2fill in blank
medium

Complete the code to create a RecursiveCharacterTextSplitter with chunk size 1000.

LangChain
splitter = RecursiveCharacterTextSplitter(chunk_size=[1])
Drag options to blanks, or click blank then click option'
A1000
B500
C2000
D1500
Attempts:
3 left
💡 Hint
Common Mistakes
Using too small or too large chunk sizes that don't fit typical code chunks.
Confusing chunk size with chunk overlap.
3fill in blank
hard

Fix the error in the code to split text using the splitter's split_text method.

LangChain
chunks = splitter.[1](text)
Drag options to blanks, or click blank then click option'
Asplit_texts
Bsplit
Csplit_text
DsplitText
Attempts:
3 left
💡 Hint
Common Mistakes
Using split or splitText which are not valid methods.
Using split_texts which is plural and incorrect.
4fill in blank
hard

Fill both blanks to create a RecursiveCharacterTextSplitter with chunk size 500 and chunk overlap 50.

LangChain
splitter = RecursiveCharacterTextSplitter(chunk_size=[1], chunk_overlap=[2])
Drag options to blanks, or click blank then click option'
A500
B100
C50
D200
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up chunk size and overlap values.
Using too large overlap causing redundant chunks.
5fill in blank
hard

Fill all three blanks to create a splitter with chunk size 800, chunk overlap 100, and separators set to ['\n', ' ', ''].

LangChain
splitter = RecursiveCharacterTextSplitter(chunk_size=[1], chunk_overlap=[2], separators=[3])
Drag options to blanks, or click blank then click option'
A1000
B100
C['\n', ' ', '']
D800
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect separators format.
Confusing chunk size and overlap values.