Find answers from the community

Updated 9 months ago

I have a question about the use of

At a glance

The community member has a question about the use of Settings in the context of the SentenceSplitter class from the LlamaIndex repository. They note that the default chunk size is used if arguments are not specified, but for other classes, argument values are taken from Settings. The community member asks if there are rules that allow them to know when to rely on Settings and when not to.

In the comments, another community member suggests that Settings should be considered as a global scope. They explain that if you have an LLM and embedding model that you plan to use, you can either define them in Settings and not worry about passing them everywhere, or you can choose not to define them globally and instead pass them explicitly wherever they are needed.

There is no explicitly marked answer in the provided information.

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