graphragzen.merge.merge_features.merge_item_feature
- graphragzen.merge.merge_features.merge_item_feature(entity_name, feature_list, llm, prompt=MergeFeaturesPromptConfig(prompt='\nYou are a helpful assistant responsible for generating a comprehensive summary of the data provided below.\nGiven one or two entities, and a list of descriptions, all related to the same entity or group of entities.\nPlease concatenate all of these into a single, comprehensive description. Make sure to include information collected from all the descriptions.\nIf the provided descriptions are contradictory, please resolve the contradictions and provide a single, coherent summary.\nMake sure it is written in third person, and include the entity names so we the have full context.\n\n#######\n-Data-\nEntities: {entity_name}\nDescription List: {description_list}\n#######\nOutput:\n', formatting=MergeFeaturesPromptFormatting(entity_name=None, description_list=None)), how='LLM', max_input_tokens=4000, max_output_tokens=500)[source]
For a single node or edge, merge one feature that is however a list.
- Parameters:
entity_name (str) – Name of the node or edge
feature_list (List[str]) – List of values assigned to the one feature
llm (LLM, optional) – Only used if how is set to ‘LLM’. Dedaults to None.
prompt (MergeFeaturesPromptConfig, optional) – Will be formatted with the feature to send to the LLM. Only used if how is set to ‘LLM’. See graphragzen.typing.MergeFeaturesPromptConfig. Defaults to MergeFeaturesPromptConfig.
how (Literal['LLM', 'count', 'mean'], optional) – ‘LLM’ summarizes the features. ‘count’ takes the feature that occurs most. ‘mean’ takes the mean of the feature. Defaults to ‘LLM’..
max_input_tokens (int, optional) – Only used when how==’LLM’. Maximum input tokens until a summary is made. Remaining items in the list will be appended to the summary until max_input_tokens is reached again or no items are left. Defaults to 4000.
max_output_tokens (int, optional) – Only used when how==’LLM’. Maximum number of tokens a summary can have. Defaults to 500.
- Returns:
summary
- Return type:
str