Merge pull request #1783 from danielaskdd/remove-max-token-summary
feat: remove deprecated MAX_TOKEN_SUMMARY parameter to prevent LLM output truncation
This commit is contained in:
commit
aa638fb94d
7 changed files with 1 additions and 16 deletions
|
|
@ -242,7 +242,6 @@ if __name__ == "__main__":
|
|||
| **tokenizer** | `Tokenizer` | 用于将文本转换为 tokens(数字)以及使用遵循 TokenizerInterface 协议的 .encode() 和 .decode() 函数将 tokens 转换回文本的函数。 如果您不指定,它将使用默认的 Tiktoken tokenizer。 | `TiktokenTokenizer` |
|
||||
| **tiktoken_model_name** | `str` | 如果您使用的是默认的 Tiktoken tokenizer,那么这是要使用的特定 Tiktoken 模型的名称。如果您提供自己的 tokenizer,则忽略此设置。 | `gpt-4o-mini` |
|
||||
| **entity_extract_max_gleaning** | `int` | 实体提取过程中的循环次数,附加历史消息 | `1` |
|
||||
| **entity_summary_to_max_tokens** | `int` | 每个实体摘要的最大令牌大小 | `500` |
|
||||
| **node_embedding_algorithm** | `str` | 节点嵌入算法(当前未使用) | `node2vec` |
|
||||
| **node2vec_params** | `dict` | 节点嵌入的参数 | `{"dimensions": 1536,"num_walks": 10,"walk_length": 40,"window_size": 2,"iterations": 3,"random_seed": 3,}` |
|
||||
| **embedding_func** | `EmbeddingFunc` | 从文本生成嵌入向量的函数 | `openai_embed` |
|
||||
|
|
|
|||
|
|
@ -249,7 +249,6 @@ A full list of LightRAG init parameters:
|
|||
| **tokenizer** | `Tokenizer` | The function used to convert text into tokens (numbers) and back using .encode() and .decode() functions following `TokenizerInterface` protocol. If you don't specify one, it will use the default Tiktoken tokenizer. | `TiktokenTokenizer` |
|
||||
| **tiktoken_model_name** | `str` | If you're using the default Tiktoken tokenizer, this is the name of the specific Tiktoken model to use. This setting is ignored if you provide your own tokenizer. | `gpt-4o-mini` |
|
||||
| **entity_extract_max_gleaning** | `int` | Number of loops in the entity extraction process, appending history messages | `1` |
|
||||
| **entity_summary_to_max_tokens** | `int` | Maximum token size for each entity summary | `500` |
|
||||
| **node_embedding_algorithm** | `str` | Algorithm for node embedding (currently not used) | `node2vec` |
|
||||
| **node2vec_params** | `dict` | Parameters for node embedding | `{"dimensions": 1536,"num_walks": 10,"walk_length": 40,"window_size": 2,"iterations": 3,"random_seed": 3,}` |
|
||||
| **embedding_func** | `EmbeddingFunc` | Function to generate embedding vectors from text | `openai_embed` |
|
||||
|
|
|
|||
|
|
@ -72,8 +72,6 @@ OLLAMA_EMULATING_MODEL_TAG=latest
|
|||
SUMMARY_LANGUAGE=English
|
||||
### Number of duplicated entities/edges to trigger LLM re-summary on merge ( at least 3 is recommented)
|
||||
# FORCE_LLM_SUMMARY_ON_MERGE=6
|
||||
### Max tokens for entity/relations description after merge
|
||||
# MAX_TOKEN_SUMMARY=500
|
||||
### Maximum number of entity extraction attempts for ambiguous content
|
||||
# MAX_GLEANING=1
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ from ascii_colors import ASCIIColors
|
|||
from lightrag.api import __api_version__ as api_version
|
||||
from lightrag import __version__ as core_version
|
||||
from lightrag.constants import (
|
||||
DEFAULT_MAX_TOKEN_SUMMARY,
|
||||
DEFAULT_FORCE_LLM_SUMMARY_ON_MERGE,
|
||||
)
|
||||
from fastapi import HTTPException, Security, Request, status
|
||||
|
|
@ -280,9 +279,6 @@ def display_splash_screen(args: argparse.Namespace) -> None:
|
|||
ASCIIColors.white(" ├─ Top-K: ", end="")
|
||||
ASCIIColors.yellow(f"{args.top_k}")
|
||||
ASCIIColors.white(" ├─ Max Token Summary: ", end="")
|
||||
ASCIIColors.yellow(
|
||||
f"{get_env_value('MAX_TOKEN_SUMMARY', DEFAULT_MAX_TOKEN_SUMMARY, int)}"
|
||||
)
|
||||
ASCIIColors.white(" └─ Force LLM Summary on Merge: ", end="")
|
||||
ASCIIColors.yellow(
|
||||
f"{get_env_value('FORCE_LLM_SUMMARY_ON_MERGE', DEFAULT_FORCE_LLM_SUMMARY_ON_MERGE, int)}"
|
||||
|
|
|
|||
|
|
@ -8,8 +8,7 @@ consistency and makes maintenance easier.
|
|||
|
||||
# Default values for environment variables
|
||||
DEFAULT_MAX_GLEANING = 1
|
||||
DEFAULT_MAX_TOKEN_SUMMARY = 500
|
||||
DEFAULT_FORCE_LLM_SUMMARY_ON_MERGE = 6
|
||||
DEFAULT_FORCE_LLM_SUMMARY_ON_MERGE = 4
|
||||
DEFAULT_WOKERS = 2
|
||||
DEFAULT_TIMEOUT = 150
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ from typing import (
|
|||
)
|
||||
from lightrag.constants import (
|
||||
DEFAULT_MAX_GLEANING,
|
||||
DEFAULT_MAX_TOKEN_SUMMARY,
|
||||
DEFAULT_FORCE_LLM_SUMMARY_ON_MERGE,
|
||||
)
|
||||
from lightrag.utils import get_env_value
|
||||
|
|
@ -134,10 +133,6 @@ class LightRAG:
|
|||
)
|
||||
"""Maximum number of entity extraction attempts for ambiguous content."""
|
||||
|
||||
summary_to_max_tokens: int = field(
|
||||
default=get_env_value("MAX_TOKEN_SUMMARY", DEFAULT_MAX_TOKEN_SUMMARY, int)
|
||||
)
|
||||
|
||||
force_llm_summary_on_merge: int = field(
|
||||
default=get_env_value(
|
||||
"FORCE_LLM_SUMMARY_ON_MERGE", DEFAULT_FORCE_LLM_SUMMARY_ON_MERGE, int
|
||||
|
|
|
|||
|
|
@ -118,7 +118,6 @@ async def _handle_entity_relation_summary(
|
|||
|
||||
tokenizer: Tokenizer = global_config["tokenizer"]
|
||||
llm_max_tokens = global_config["llm_model_max_token_size"]
|
||||
# summary_max_tokens = global_config["summary_to_max_tokens"]
|
||||
|
||||
language = global_config["addon_params"].get(
|
||||
"language", PROMPTS["DEFAULT_LANGUAGE"]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue