Builder for creating tree-based response synthesizer instances.
Provides factory method to create configured synthesizers that use
hierarchical summarization for response generation.
Source code in src/common/builders/synthesizer_builders.py
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58 | class TreeSynthesizerBuilder:
"""Builder for creating tree-based response synthesizer instances.
Provides factory method to create configured synthesizers that use
hierarchical summarization for response generation.
"""
@staticmethod
@inject
def build(
llm: BoundLLM,
configuration: TreeSynthesizerConfiguration,
) -> BaseSynthesizer:
"""Creates a configured tree-based response synthesizer.
Args:
llm: Language model for response generation.
configuration: Synthesizer settings including response mode
and streaming options.
Returns:
BaseSynthesizer: Configured synthesizer instance using tree
summarization strategy.
"""
return get_response_synthesizer(
llm=llm,
response_mode=configuration.response_mode,
streaming=configuration.streaming,
summary_template=CUSTOM_PROMPT_TEMPLATE,
)
|
build(llm, configuration)
staticmethod
Creates a configured tree-based response synthesizer.
Parameters: |
-
llm
(BoundLLM )
–
Language model for response generation.
-
configuration
(TreeSynthesizerConfiguration )
–
Synthesizer settings including response mode
and streaming options.
|
Returns: |
-
BaseSynthesizer ( BaseSynthesizer
) –
Configured synthesizer instance using tree
summarization strategy.
|
Source code in src/common/builders/synthesizer_builders.py
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58 | @staticmethod
@inject
def build(
llm: BoundLLM,
configuration: TreeSynthesizerConfiguration,
) -> BaseSynthesizer:
"""Creates a configured tree-based response synthesizer.
Args:
llm: Language model for response generation.
configuration: Synthesizer settings including response mode
and streaming options.
Returns:
BaseSynthesizer: Configured synthesizer instance using tree
summarization strategy.
"""
return get_response_synthesizer(
llm=llm,
response_mode=configuration.response_mode,
streaming=configuration.streaming,
summary_template=CUSTOM_PROMPT_TEMPLATE,
)
|