disable Agent Search refinement by default (#4638)

- created env variable  AGENT_ALLOW_REFINEMENT  with default "". Must be set to true to enable Refinement.
 - added an environment variable for the upper limit of docs that can be sent to verification
This commit is contained in:
joachim-danswer
2025-04-30 12:51:08 -07:00
committed by GitHub
parent e254fdc066
commit f68b74ff4a
4 changed files with 13 additions and 7 deletions

View File

@@ -26,7 +26,7 @@ def decide_refinement_need(
graph_config = cast(GraphConfig, config["metadata"]["config"]) graph_config = cast(GraphConfig, config["metadata"]["config"])
decision = True # TODO: just for current testing purposes decision = graph_config.behavior.allow_refinement
if state.answer_error: if state.answer_error:
return RequireRefinemenEvalUpdate( return RequireRefinemenEvalUpdate(

View File

@@ -10,6 +10,7 @@ from onyx.agents.agent_search.deep_search.shared.expanded_retrieval.states impor
from onyx.agents.agent_search.deep_search.shared.expanded_retrieval.states import ( from onyx.agents.agent_search.deep_search.shared.expanded_retrieval.states import (
ExpandedRetrievalState, ExpandedRetrievalState,
) )
from onyx.configs.agent_configs import AGENT_MAX_VERIFICATION_HITS
def kickoff_verification( def kickoff_verification(
@@ -22,7 +23,7 @@ def kickoff_verification(
are done here, so this could be replaced with an edge. But we may choose to make state are done here, so this could be replaced with an edge. But we may choose to make state
updates later.) updates later.)
""" """
retrieved_documents = state.retrieved_documents retrieved_documents = state.retrieved_documents[:AGENT_MAX_VERIFICATION_HITS]
verification_question = state.question verification_question = state.question
sub_question_id = state.sub_question_id sub_question_id = state.sub_question_id

View File

@@ -30,7 +30,7 @@ from onyx.chat.models import StreamStopInfo
from onyx.chat.models import SubQueryPiece from onyx.chat.models import SubQueryPiece
from onyx.chat.models import SubQuestionPiece from onyx.chat.models import SubQuestionPiece
from onyx.chat.models import ToolResponse from onyx.chat.models import ToolResponse
from onyx.configs.agent_configs import ALLOW_REFINEMENT from onyx.configs.agent_configs import AGENT_ALLOW_REFINEMENT
from onyx.configs.agent_configs import INITIAL_SEARCH_DECOMPOSITION_ENABLED from onyx.configs.agent_configs import INITIAL_SEARCH_DECOMPOSITION_ENABLED
from onyx.context.search.models import SearchRequest from onyx.context.search.models import SearchRequest
from onyx.db.engine import get_session_context_manager from onyx.db.engine import get_session_context_manager
@@ -104,7 +104,7 @@ def run_graph(
config.behavior.perform_initial_search_decomposition = ( config.behavior.perform_initial_search_decomposition = (
INITIAL_SEARCH_DECOMPOSITION_ENABLED INITIAL_SEARCH_DECOMPOSITION_ENABLED
) )
config.behavior.allow_refinement = ALLOW_REFINEMENT config.behavior.allow_refinement = AGENT_ALLOW_REFINEMENT
for event in manage_sync_streaming( for event in manage_sync_streaming(
compiled_graph=compiled_graph, config=config, graph_input=input compiled_graph=compiled_graph, config=config, graph_input=input

View File

@@ -1,7 +1,5 @@
import os import os
INITIAL_SEARCH_DECOMPOSITION_ENABLED = True
ALLOW_REFINEMENT = True
AGENT_DEFAULT_RETRIEVAL_HITS = 15 AGENT_DEFAULT_RETRIEVAL_HITS = 15
AGENT_DEFAULT_RERANKING_HITS = 10 AGENT_DEFAULT_RERANKING_HITS = 10
@@ -19,10 +17,10 @@ AGENT_DEFAULT_MAX_ANSWER_CONTEXT_DOCS = 10
AGENT_DEFAULT_MAX_STATIC_HISTORY_WORD_LENGTH = 2000 AGENT_DEFAULT_MAX_STATIC_HISTORY_WORD_LENGTH = 2000
INITIAL_SEARCH_DECOMPOSITION_ENABLED = True INITIAL_SEARCH_DECOMPOSITION_ENABLED = True
ALLOW_REFINEMENT = True
AGENT_DEFAULT_RETRIEVAL_HITS = 15 AGENT_DEFAULT_RETRIEVAL_HITS = 15
AGENT_DEFAULT_RERANKING_HITS = 10 AGENT_DEFAULT_RERANKING_HITS = 10
AGENT_DEFAULT_MAX_VERIFIVATION_HITS = 30
AGENT_DEFAULT_SUB_QUESTION_MAX_CONTEXT_HITS = 8 AGENT_DEFAULT_SUB_QUESTION_MAX_CONTEXT_HITS = 8
AGENT_DEFAULT_NUM_DOCS_FOR_INITIAL_DECOMPOSITION = 3 AGENT_DEFAULT_NUM_DOCS_FOR_INITIAL_DECOMPOSITION = 3
AGENT_DEFAULT_NUM_DOCS_FOR_REFINED_DECOMPOSITION = 5 AGENT_DEFAULT_NUM_DOCS_FOR_REFINED_DECOMPOSITION = 5
@@ -31,6 +29,9 @@ AGENT_DEFAULT_MIN_ORIG_QUESTION_DOCS = 3
AGENT_DEFAULT_MAX_ANSWER_CONTEXT_DOCS = 10 AGENT_DEFAULT_MAX_ANSWER_CONTEXT_DOCS = 10
AGENT_DEFAULT_MAX_STATIC_HISTORY_WORD_LENGTH = 2000 AGENT_DEFAULT_MAX_STATIC_HISTORY_WORD_LENGTH = 2000
AGENT_ALLOW_REFINEMENT = os.environ.get("AGENT_ALLOW_REFINEMENT", "").lower() == "true"
AGENT_ANSWER_GENERATION_BY_FAST_LLM = ( AGENT_ANSWER_GENERATION_BY_FAST_LLM = (
os.environ.get("AGENT_ANSWER_GENERATION_BY_FAST_LLM", "").lower() == "true" os.environ.get("AGENT_ANSWER_GENERATION_BY_FAST_LLM", "").lower() == "true"
) )
@@ -40,6 +41,10 @@ AGENT_RETRIEVAL_STATS = (
) or True # default True ) or True # default True
AGENT_MAX_VERIFICATION_HITS = int(
os.environ.get("AGENT_MAX_VERIFICATION_HITS") or AGENT_DEFAULT_MAX_VERIFIVATION_HITS
) # 30
AGENT_MAX_QUERY_RETRIEVAL_RESULTS = int( AGENT_MAX_QUERY_RETRIEVAL_RESULTS = int(
os.environ.get("AGENT_MAX_QUERY_RETRIEVAL_RESULTS") or AGENT_DEFAULT_RETRIEVAL_HITS os.environ.get("AGENT_MAX_QUERY_RETRIEVAL_RESULTS") or AGENT_DEFAULT_RETRIEVAL_HITS
) # 15 ) # 15