Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

fix: Fix langchain integration tests - add missing settings and fix API calls

LearningCircuit2049bccd396a
diff --git a/tests/langchain_integration/test_combined_llm_retriever.py b/tests/langchain_integration/test_combined_llm_retriever.py
index 5753d995fb..c14b593179 100644
--- a/tests/langchain_integration/test_combined_llm_retriever.py
+++ b/tests/langchain_integration/test_combined_llm_retriever.py
@@ -202,7 +202,12 @@ class TestCombinedLLMRetriever:
"search.cross_engine_max_results": {"value": 100, "type": "int"},
"search.cross_engine_use_reddit": {"value": False, "type": "bool"},
"search.cross_engine_min_date": {"value": None, "type": "str"},
- "search.region": {"value": "wt-wt", "type": "str"},
+ "search.region": {"value": "us", "type": "str"},
+ "search.time_period": {"value": "y", "type": "str"},
+ "search.safe_search": {"value": True, "type": "bool"},
+ "search.snippets_only": {"value": True, "type": "bool"},
+ "search.search_language": {"value": "English", "type": "str"},
+ "search.max_filtered_results": {"value": 20, "type": "int"},
}
def test_engineering_research_with_custom_components(
@@ -217,19 +222,16 @@ class TestCombinedLLMRetriever:
model_version="v1", use_company_style=True
)
- with patch(
- "random.randint",
- return_value=10001,
- ):
- result = quick_summary(
- query="What are our engineering best practices for microservices?",
- llm=custom_llm,
- retrievers={"eng_kb": eng_retriever},
- search_tool="eng_kb",
- settings_snapshot=settings_snapshot,
- iterations=1,
- questions_per_iteration=2,
- )
+ result = quick_summary(
+ query="What are our engineering best practices for microservices?",
+ research_id=10001,
+ llms={"custom": custom_llm},
+ retrievers={"eng_kb": eng_retriever},
+ search_tool="eng_kb",
+ settings_snapshot=settings_snapshot,
+ iterations=1,
+ questions_per_iteration=2,
+ )
assert result["research_id"] == 10001
assert "engineering" in result["summary"].lower()
@@ -263,7 +265,7 @@ class TestCombinedLLMRetriever:
):
result = detailed_research(
query="How do our engineering practices align with product roadmap?",
- llm=custom_llm,
+ llms={"custom": custom_llm},
retrievers={
"engineering": eng_retriever,
"product": product_retriever,
@@ -330,7 +332,7 @@ class TestCombinedLLMRetriever:
):
result = quick_summary(
query="Security best practices",
- llm=llm,
+ llms={"corporate": llm},
retrievers={"company_kb": retriever},
search_tool="company_kb",
settings_snapshot=settings_snapshot,
@@ -383,7 +385,7 @@ class TestCombinedLLMRetriever:
with pytest.raises(RuntimeError, match="Temporary retriever failure"):
quick_summary(
query="Test query",
- llm=custom_llm,
+ llms={"custom": custom_llm},
retrievers={"unreliable": unreliable_retriever},
search_tool="unreliable",
settings_snapshot=settings_snapshot,
@@ -475,7 +477,7 @@ class TestCombinedLLMRetriever:
):
result = detailed_research(
query="Compare our engineering practices with industry standards",
- llm=custom_llm,
+ llms={"custom": custom_llm},
retrievers={
"internal_eng": eng_retriever,
"internal_product": product_retriever,
diff --git a/tests/langchain_integration/test_custom_langchain_llm.py b/tests/langchain_integration/test_custom_langchain_llm.py
index 1d89910cdb..66518e4a31 100644
--- a/tests/langchain_integration/test_custom_langchain_llm.py
+++ b/tests/langchain_integration/test_custom_langchain_llm.py
@@ -84,7 +84,12 @@ class TestCustomLangChainLLM:
"search.cross_engine_max_results": {"value": 100, "type": "int"},
"search.cross_engine_use_reddit": {"value": False, "type": "bool"},
"search.cross_engine_min_date": {"value": None, "type": "str"},
- "search.region": {"value": "wt-wt", "type": "str"},
+ "search.region": {"value": "us", "type": "str"},
+ "search.time_period": {"value": "y", "type": "str"},
+ "search.safe_search": {"value": True, "type": "bool"},
+ "search.snippets_only": {"value": True, "type": "bool"},
+ "search.search_language": {"value": "English", "type": "str"},
+ "search.max_filtered_results": {"value": 20, "type": "int"},
}
def test_custom_llm_basic_usage(self, settings_snapshot):
@@ -108,19 +113,16 @@ class TestCustomLangChainLLM:
_mock_get_search.return_value = mock_search_engine
- # Mock the research ID generation
- with patch(
- "random.randint",
- return_value=12345,
- ):
- # Run quick summary with custom LLM
- result = quick_summary(
- query="What is quantum computing?",
- llm=custom_llm,
- settings_snapshot=settings_snapshot,
- iterations=1,
- questions_per_iteration=2,
- )
+ # Run quick summary with custom LLM
+ result = quick_summary(
+ query="What is quantum computing?",
+ research_id=12345,
+ llms={"custom": custom_llm},
+ settings_snapshot=settings_snapshot,
+ search_tool="wikipedia",
+ iterations=1,
+ questions_per_iteration=2,
+ )
# Verify results
assert result is not None
@@ -160,7 +162,7 @@ class TestCustomLangChainLLM:
):
result = detailed_research(
query="Explain machine learning applications",
- llm=custom_llm,
+ llms={"custom": custom_llm},
settings_snapshot=settings_snapshot,
iterations=2,
questions_per_iteration=3,
@@ -216,7 +218,7 @@ class TestCustomLangChainLLM:
):
result = quick_summary(
query="Impact of climate change",
- llm=custom_llm,
+ llms={"custom": custom_llm},
settings_snapshot=settings_snapshot,
iterations=1,
)
@@ -262,7 +264,7 @@ class TestCustomLangChainLLM:
with pytest.raises(RuntimeError, match="LLM call failed"):
quick_summary(
query="Test query",
- llm=failing_llm,
+ llms={"failing": failing_llm},
settings_snapshot=settings_snapshot,
iterations=1,
)
@@ -283,7 +285,7 @@ class TestCustomLangChainLLM:
result = quick_summary(
query="Test query",
- llm=custom_llm,
+ llms={"custom": custom_llm},
settings_snapshot=settings_snapshot,
iterations=1,
)
@@ -337,7 +339,7 @@ class TestCustomLangChainLLM:
):
result = quick_summary(
query="Quantum computing basics",
- llm=streaming_llm,
+ llms={"streaming": streaming_llm},
settings_snapshot=settings_snapshot,
iterations=1,
)
diff --git a/tests/langchain_integration/test_custom_langchain_retriever.py b/tests/langchain_integration/test_custom_langchain_retriever.py
index e9d2962ee4..48647634a3 100644
--- a/tests/langchain_integration/test_custom_langchain_retriever.py
+++ b/tests/langchain_integration/test_custom_langchain_retriever.py
@@ -120,7 +120,12 @@ class TestCustomLangChainRetriever:
"search.cross_engine_max_results": {"value": 100, "type": "int"},
"search.cross_engine_use_reddit": {"value": False, "type": "bool"},
"search.cross_engine_min_date": {"value": None, "type": "str"},
- "search.region": {"value": "wt-wt", "type": "str"},
+ "search.region": {"value": "us", "type": "str"},
+ "search.time_period": {"value": "y", "type": "str"},
+ "search.safe_search": {"value": True, "type": "bool"},
+ "search.snippets_only": {"value": True, "type": "bool"},
+ "search.search_language": {"value": "English", "type": "str"},
+ "search.max_filtered_results": {"value": 20, "type": "int"},
}
@pytest.fixture
@@ -323,7 +328,7 @@ class TestCustomLangChainRetriever:
# Use both custom LLM and retriever
result = quick_summary(
query="Explain machine learning concepts",
- llm=custom_llm,
+ llms={"custom": custom_llm},
retrievers={"custom_kb": custom_retriever},
search_tool="custom_kb",
settings_snapshot=settings_snapshot,