Skip to content

Commit c81e883

Browse files
committed
fix tests
1 parent 428c85e commit c81e883

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

backend/tests/unit/onyx/agent_search/test_use_tool_response.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
from onyx.context.search.models import IndexFilters
3131
from onyx.context.search.models import InferenceChunk
3232
from onyx.context.search.models import InferenceSection
33-
from onyx.context.search.models import SearchRequest
33+
from onyx.context.search.models import RerankingDetails
34+
from onyx.db.models import Persona
3435
from onyx.llm.interfaces import LLM
3536
from onyx.tools.force import ForceUseTool
3637
from onyx.tools.message import ToolCallSummary
@@ -44,6 +45,8 @@
4445
FINAL_CONTEXT_DOCUMENTS_ID,
4546
)
4647

48+
TEST_PROMPT = "test prompt"
49+
4750

4851
def create_test_inference_chunk(
4952
document_id: str,
@@ -86,9 +89,7 @@ def mock_state() -> BasicState:
8689
mock_tool.build_next_prompt = MagicMock(
8790
return_value=MagicMock(spec=AnswerPromptBuilder)
8891
)
89-
mock_tool.build_next_prompt.return_value.build = MagicMock(
90-
return_value="test prompt"
91-
)
92+
mock_tool.build_next_prompt.return_value.build = MagicMock(return_value=TEST_PROMPT)
9293

9394
mock_tool_choice = MagicMock(spec=ToolChoice)
9495
mock_tool_choice.tool = mock_tool
@@ -124,15 +125,16 @@ def mock_config() -> RunnableConfig:
124125
mock_search_tool = MagicMock(spec=SearchTool)
125126
mock_force_use_tool = MagicMock(spec=ForceUseTool)
126127
mock_prompt_builder = MagicMock(spec=AnswerPromptBuilder)
127-
mock_search_request = MagicMock(spec=SearchRequest)
128+
mock_persona = MagicMock(spec=Persona)
129+
mock_rerank_settings = MagicMock(spec=RerankingDetails)
128130
mock_db_session = MagicMock(spec=Session)
129131

130-
mock_prompt_builder.raw_user_query = mock_search_request.query
132+
mock_prompt_builder.raw_user_query = TEST_PROMPT
131133

132134
# Create the GraphConfig components
133135
graph_inputs = GraphInputs(
134-
persona=mock_search_request.persona,
135-
rerank_settings=mock_search_request.rerank_settings,
136+
persona=mock_persona,
137+
rerank_settings=mock_rerank_settings,
136138
prompt_builder=mock_prompt_builder,
137139
files=None,
138140
structured_response_format=None,
@@ -336,7 +338,7 @@ def test_basic_use_tool_response_with_search_results(
336338
mock_config["metadata"][
337339
"config"
338340
].tooling.primary_llm.stream.assert_called_once_with(
339-
prompt="test prompt",
341+
prompt=TEST_PROMPT,
340342
structured_response_format=None,
341343
)
342344

0 commit comments

Comments
 (0)