Find answers from the community

Updated 7 months ago

I have a question about the use of

I have a question about the use of Settings. Consider the constructor of SentenceSplitter, taken from the LlamaIndex repository:
Plain Text
class SentenceSplitter(MetadataAwareTextSplitter):
    """Parse text with a preference for complete sentences.

    In general, this class tries to keep sentences and paragraphs together. Therefore
    compared to the original TokenTextSplitter, there are less likely to be
    hanging sentences or parts of sentences at the end of the node chunk.
    """

    chunk_size: int = Field(
        default=DEFAULT_CHUNK_SIZE,
        description="The token chunk size for each chunk.",
        gt=0,
    )
...

Clearly, the default chunk size is used if arguments are not specified. For other classes, argument values are taken from Settings. Are there rules that allow us to know when to rely on Settings and when not to? Thanks.
W
1 comment
Consider Settings as global scope. Let say you have llm and embed model that you are going to use.

You can do two things:
  • Either define it with settings and not worry as your defined llm and other items will be used everywhere
  • Let say you do not want to define it as global then you will have to pass it everywhere else it will go to use default ones
Add a reply
Sign up and join the conversation on Discord