Spaces:
Sleeping
Sleeping
Download src/qa_langgraph/config.py from helmfridsson/qa-agent-langgraph: direct link, hf CLI and curl.
- Browser
- Download file 1.18 kB
-
https://huggingface.co/spaces/helmfridsson/qa-agent-langgraph/resolve/main/src/qa_langgraph/config.py
- Command line
-
hf download hf://spaces/helmfridsson/qa-agent-langgraph/src/qa_langgraph/config.py
-
curl -L -o config.py https://huggingface.co/spaces/helmfridsson/qa-agent-langgraph/resolve/main/src/qa_langgraph/config.py
1.18 kB
| from __future__ import annotations | |
| from typing import Any | |
| from .registry import get_agent | |
| def agent_config_map(agent_configs: list[dict[str, Any]]) -> dict[str, dict[str, Any]]: | |
| return {config.get("agent_key", ""): config for config in agent_configs} | |
| def resolve_agent_config( | |
| global_config: dict[str, Any], | |
| agent_configs: list[dict[str, Any]], | |
| agent_key: str, | |
| ) -> dict[str, Any]: | |
| merged = dict(global_config) | |
| per_agent = agent_config_map(agent_configs).get(agent_key, {}) | |
| provider = per_agent.get("provider_strategy") | |
| if provider and provider != "global": | |
| merged["provider"] = provider | |
| for field in ("model_id", "model_override", "timeout_seconds"): | |
| value = per_agent.get(field) | |
| if value not in (None, ""): | |
| merged["model_id" if field == "model_override" else field] = value | |
| default_directives = get_agent(agent_key).default_directives | |
| user_directives = per_agent.get("directives") or "" | |
| merged["directives"] = f"{default_directives}\n\nAdditional directives:\n{user_directives}".strip() | |
| merged["execution_mode"] = per_agent.get("execution_mode", "Service-backed") | |
| return merged | |