deerflow2/tests/unit
Willem Jiang 4a78cfe12a
fix(llm): filter unexpected config keys to prevent LangChain warnings (#411) (#726)
* fix(llm): filter unexpected config keys to prevent LangChain warnings (#411)

Add allowlist validation for LLM configuration keys to prevent unexpected
parameters like SEARCH_ENGINE from being passed to LLM constructors.

Changes:
- Add ALLOWED_LLM_CONFIG_KEYS set with valid LLM configuration parameters
- Filter out unexpected keys before creating LLM instances
- Log clear warning messages when unexpected keys are removed
- Add unit test for configuration key filtering

This fixes the confusing LangChain warning "WARNING! SEARCH_ENGINE is not
default parameter. SEARCH_ENGINE was transferred to model_kwargs" that
occurred when users accidentally placed configuration keys in wrong sections
of conf.yaml.

* Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-11-29 16:13:05 +08:00
..
agents security: add log injection attack prevention with input sanitization (#667) 2025-10-27 20:57:23 +08:00
checkpoint feat: support dify in rag module (#550) 2025-09-16 20:30:45 +08:00
config feat: 1. replace black with ruff for fomatting and sort import (#489) 2025-08-17 22:57:23 +08:00
crawler fix: the crawling error when encountering PDF URLs (#707) 2025-11-25 09:24:52 +08:00
graph feat: add analysis step type for non-code reasoning tasks (#677) (#723) 2025-11-29 09:46:55 +08:00
llms fix(llm): filter unexpected config keys to prevent LangChain warnings (#411) (#726) 2025-11-29 16:13:05 +08:00
prompt_enhancer Upgrade langchain version to 1.x (#720) 2025-11-28 22:09:13 +08:00
rag feat: Qdrant Vector Search Support (#684) 2025-11-11 19:35:00 +08:00
server security: add log injection attack prevention with input sanitization (#667) 2025-10-27 20:57:23 +08:00
tools Upgrade langchain version to 1.x (#720) 2025-11-28 22:09:13 +08:00
utils security: add log injection attack prevention with input sanitization (#667) 2025-10-27 20:57:23 +08:00