mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-16 23:41:43 +00:00
fix(a2a): filter agent-only litellm_params from acompletion kwargs; pass agent_id into body
This commit is contained in:
parent
ffdf63df76
commit
0ad29239eb
2 changed files with 8 additions and 2 deletions
|
|
@ -20,6 +20,11 @@ from litellm.a2a_protocol.litellm_completion_bridge.transformation import (
|
|||
)
|
||||
from litellm.a2a_protocol.providers.config_manager import A2AProviderConfigManager
|
||||
|
||||
# Agent metadata fields stored in litellm_params that are not valid litellm.acompletion() kwargs
|
||||
_AGENT_ONLY_PARAMS = frozenset(
|
||||
{"is_public", "agent_name", "agent_id", "agent_card_params"}
|
||||
)
|
||||
|
||||
|
||||
class A2ACompletionBridgeHandler:
|
||||
"""
|
||||
|
|
@ -99,7 +104,7 @@ class A2ACompletionBridgeHandler:
|
|||
litellm_params_to_add = {
|
||||
k: v
|
||||
for k, v in litellm_params.items()
|
||||
if k not in ("model", "custom_llm_provider")
|
||||
if k not in ("model", "custom_llm_provider") and k not in _AGENT_ONLY_PARAMS
|
||||
}
|
||||
completion_params.update(litellm_params_to_add)
|
||||
|
||||
|
|
@ -206,7 +211,7 @@ class A2ACompletionBridgeHandler:
|
|||
litellm_params_to_add = {
|
||||
k: v
|
||||
for k, v in litellm_params.items()
|
||||
if k not in ("model", "custom_llm_provider")
|
||||
if k not in ("model", "custom_llm_provider") and k not in _AGENT_ONLY_PARAMS
|
||||
}
|
||||
completion_params.update(litellm_params_to_add)
|
||||
|
||||
|
|
|
|||
|
|
@ -390,6 +390,7 @@ async def invoke_agent_a2a( # noqa: PLR0915
|
|||
if "metadata" not in body:
|
||||
body["metadata"] = {}
|
||||
body["metadata"]["agent_id"] = agent.agent_id
|
||||
body["agent_id"] = agent.agent_id
|
||||
|
||||
body.update(
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue