Remove deprecated history_turns and ids parameters from query API endpoint

• Update QueryParam documentation
• Mark history_turns as deprecated
• Clean up splash screen display
• Clarify conversation_history usage
This commit is contained in:
yangdx 2025-09-25 04:58:57 +08:00
parent 41a6da6786
commit 699ca3ba00
7 changed files with 6 additions and 29 deletions

View file

@ -335,15 +335,12 @@ class QueryParam:
ll_keywords: list[str] = field(default_factory=list) ll_keywords: list[str] = field(default_factory=list)
"""List of low-level keywords to refine retrieval focus.""" """List of low-level keywords to refine retrieval focus."""
# History mesages is only send to LLM for context, not used for retrieval
conversation_history: list[dict[str, str]] = field(default_factory=list) conversation_history: list[dict[str, str]] = field(default_factory=list)
"""Stores past conversation history to maintain context. """Stores past conversation history to maintain context.
Format: [{"role": "user/assistant", "content": "message"}]. Format: [{"role": "user/assistant", "content": "message"}].
""" """
# Deprated: history message have negtive effect on query performance
history_turns: int = 0
"""Number of complete conversation turns (user-assistant pairs) to consider in the response context."""
ids: list[str] | None = None ids: list[str] | None = None
"""List of ids to filter the results.""" """List of ids to filter the results."""

View file

@ -336,15 +336,12 @@ class QueryParam:
max_total_tokens: int = int(os.getenv("MAX_TOTAL_TOKENS", "30000")) max_total_tokens: int = int(os.getenv("MAX_TOTAL_TOKENS", "30000"))
"""Maximum total tokens budget for the entire query context (entities + relations + chunks + system prompt).""" """Maximum total tokens budget for the entire query context (entities + relations + chunks + system prompt)."""
# History mesages is only send to LLM for context, not used for retrieval
conversation_history: list[dict[str, str]] = field(default_factory=list) conversation_history: list[dict[str, str]] = field(default_factory=list)
"""Stores past conversation history to maintain context. """Stores past conversation history to maintain context.
Format: [{"role": "user/assistant", "content": "message"}]. Format: [{"role": "user/assistant", "content": "message"}].
""" """
# Deprated: history message have negtive effect on query performance
history_turns: int = 0
"""Number of complete conversation turns (user-assistant pairs) to consider in the response context."""
ids: list[str] | None = None ids: list[str] | None = None
"""List of ids to filter the results.""" """List of ids to filter the results."""

View file

@ -510,12 +510,6 @@ class OllamaAPI:
if user_prompt is not None: if user_prompt is not None:
param_dict["user_prompt"] = user_prompt param_dict["user_prompt"] = user_prompt
if (
hasattr(self.rag, "args")
and self.rag.args.history_turns is not None
):
param_dict["history_turns"] = self.rag.args.history_turns
query_param = QueryParam(**param_dict) query_param = QueryParam(**param_dict)
if request.stream: if request.stream:

View file

@ -78,16 +78,6 @@ class QueryRequest(BaseModel):
description="Stores past conversation history to maintain context. Format: [{'role': 'user/assistant', 'content': 'message'}].", description="Stores past conversation history to maintain context. Format: [{'role': 'user/assistant', 'content': 'message'}].",
) )
history_turns: Optional[int] = Field(
ge=0,
default=None,
description="Number of complete conversation turns (user-assistant pairs) to consider in the response context.",
)
ids: list[str] | None = Field(
default=None, description="List of ids to filter the results."
)
user_prompt: Optional[str] = Field( user_prompt: Optional[str] = Field(
default=None, default=None,
description="User-provided prompt for the query. If provided, this will be used instead of the default value from prompt template.", description="User-provided prompt for the query. If provided, this will be used instead of the default value from prompt template.",

View file

@ -218,8 +218,6 @@ def display_splash_screen(args: argparse.Namespace) -> None:
ASCIIColors.yellow(f"{args.log_level}") ASCIIColors.yellow(f"{args.log_level}")
ASCIIColors.white(" ├─ Verbose Debug: ", end="") ASCIIColors.white(" ├─ Verbose Debug: ", end="")
ASCIIColors.yellow(f"{args.verbose}") ASCIIColors.yellow(f"{args.verbose}")
ASCIIColors.white(" ├─ History Turns: ", end="")
ASCIIColors.yellow(f"{args.history_turns}")
ASCIIColors.white(" ├─ API Key: ", end="") ASCIIColors.white(" ├─ API Key: ", end="")
ASCIIColors.yellow("Set" if args.key else "Not Set") ASCIIColors.yellow("Set" if args.key else "Not Set")
ASCIIColors.white(" └─ JWT Auth: ", end="") ASCIIColors.white(" └─ JWT Auth: ", end="")

View file

@ -132,13 +132,13 @@ class QueryParam:
ll_keywords: list[str] = field(default_factory=list) ll_keywords: list[str] = field(default_factory=list)
"""List of low-level keywords to refine retrieval focus.""" """List of low-level keywords to refine retrieval focus."""
# TODO: Deprecated - history message have negtive effect on query performance # History mesages is only send to LLM for context, not used for retrieval
conversation_history: list[dict[str, str]] = field(default_factory=list) conversation_history: list[dict[str, str]] = field(default_factory=list)
"""Stores past conversation history to maintain context. """Stores past conversation history to maintain context.
Format: [{"role": "user/assistant", "content": "message"}]. Format: [{"role": "user/assistant", "content": "message"}].
""" """
# TODO: Deprecated - history message have negtive effect on query performance # TODO: deprecated. No longer used in the codebase, all conversation_history messages is send to LLM
history_turns: int = int(os.getenv("HISTORY_TURNS", str(DEFAULT_HISTORY_TURNS))) history_turns: int = int(os.getenv("HISTORY_TURNS", str(DEFAULT_HISTORY_TURNS)))
"""Number of complete conversation turns (user-assistant pairs) to consider in the response context.""" """Number of complete conversation turns (user-assistant pairs) to consider in the response context."""

View file

@ -49,7 +49,8 @@ DEFAULT_MAX_TOTAL_TOKENS = 30000
DEFAULT_COSINE_THRESHOLD = 0.2 DEFAULT_COSINE_THRESHOLD = 0.2
DEFAULT_RELATED_CHUNK_NUMBER = 5 DEFAULT_RELATED_CHUNK_NUMBER = 5
DEFAULT_KG_CHUNK_PICK_METHOD = "VECTOR" DEFAULT_KG_CHUNK_PICK_METHOD = "VECTOR"
# Deprated: history message have negtive effect on query performance
# TODO: Deprated. All conversation_history messages is send to LLM.
DEFAULT_HISTORY_TURNS = 0 DEFAULT_HISTORY_TURNS = 0
# Rerank configuration defaults # Rerank configuration defaults