@@ -484,3 +484,38 @@ def test_query_tim_urban_default_model():
484484 )
485485 final_answer = out ["final_answer" ]
486486 assert "monkey" in final_answer .lower ()
487+
488+
489+ @pytest .mark .api
490+ @pytest .mark .skipif (
491+ " -m api" not in " " .join (sys .argv ),
492+ reason = "Skip tests using external APIs by default, use '-m api' to run them." ,
493+ )
494+ def test_query_duckduckgo_search ():
495+ """Test DuckDuckGo search functionality."""
496+ inst = wdoc (
497+ task = "query" ,
498+ path = "How is nvidia doing this month" ,
499+ query = "How is nvidia doing this month" ,
500+ filetype = "ddg" ,
501+ ddg_max_result = 3 ,
502+ ddg_region = us - US ,
503+ model = f"openai/{ WDOC_TEST_OPENAI_MODEL } " ,
504+ query_eval_model = f"openai/{ WDOC_TEST_OPENAI_EVAL_MODEL } " ,
505+ embed_model = f"openai/{ WDOC_TEST_OPENAI_EMBED_MODEL } " ,
506+ disable_llm_cache = True ,
507+ debug = True ,
508+ verbose = True ,
509+ file_loader_parallel_backend = "threading" ,
510+ loading_failure = "warn" ,
511+ )
512+ out = inst .query_task (
513+ query = "How is nvidia doing this month" ,
514+ )
515+
516+ # Basic validation that the function runs without crashing
517+ assert isinstance (out , dict )
518+ assert "final_answer" in out
519+ assert isinstance (out ["final_answer" ], str )
520+ assert len (out ["final_answer" ]) > 0
521+ # Don't check the content deeply as requested, just ensure it returns something
0 commit comments