mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
Drop user prompt from LLMContext (#146787)
This commit is contained in:
parent
56aa809074
commit
059c12798d
@ -395,7 +395,6 @@ class ChatLog:
|
||||
llm_context = llm.LLMContext(
|
||||
platform=conversing_domain,
|
||||
context=user_input.context,
|
||||
user_prompt=user_input.text,
|
||||
language=user_input.language,
|
||||
assistant=DOMAIN,
|
||||
device_id=user_input.device_id,
|
||||
|
@ -88,7 +88,6 @@ class ModelContextProtocolSSEView(HomeAssistantView):
|
||||
context = llm.LLMContext(
|
||||
platform=DOMAIN,
|
||||
context=self.context(request),
|
||||
user_prompt=None,
|
||||
language="*",
|
||||
assistant=conversation.DOMAIN,
|
||||
device_id=None,
|
||||
|
@ -160,11 +160,19 @@ class LLMContext:
|
||||
"""Tool input to be processed."""
|
||||
|
||||
platform: str
|
||||
"""Integration that is handling the LLM request."""
|
||||
|
||||
context: Context | None
|
||||
user_prompt: str | None
|
||||
"""Context of the LLM request."""
|
||||
|
||||
language: str | None
|
||||
"""Language of the LLM request."""
|
||||
|
||||
assistant: str | None
|
||||
"""Assistant domain that is handling the LLM request."""
|
||||
|
||||
device_id: str | None
|
||||
"""Device that is making the request."""
|
||||
|
||||
|
||||
@dataclass(slots=True)
|
||||
@ -302,7 +310,7 @@ class IntentTool(Tool):
|
||||
platform=llm_context.platform,
|
||||
intent_type=self.name,
|
||||
slots=slots,
|
||||
text_input=llm_context.user_prompt,
|
||||
text_input=None,
|
||||
context=llm_context.context,
|
||||
language=llm_context.language,
|
||||
assistant=llm_context.assistant,
|
||||
|
@ -415,7 +415,6 @@ async def test_function_call(
|
||||
llm.LLMContext(
|
||||
platform="anthropic",
|
||||
context=context,
|
||||
user_prompt="Please call the test function",
|
||||
language="en",
|
||||
assistant="conversation",
|
||||
device_id=None,
|
||||
@ -510,7 +509,6 @@ async def test_function_exception(
|
||||
llm.LLMContext(
|
||||
platform="anthropic",
|
||||
context=context,
|
||||
user_prompt="Please call the test function",
|
||||
language="en",
|
||||
assistant="conversation",
|
||||
device_id=None,
|
||||
|
@ -58,7 +58,6 @@ def create_llm_context() -> llm.LLMContext:
|
||||
return llm.LLMContext(
|
||||
platform="test_platform",
|
||||
context=Context(),
|
||||
user_prompt="test_text",
|
||||
language="*",
|
||||
assistant="conversation",
|
||||
device_id=None,
|
||||
|
@ -284,7 +284,6 @@ async def test_function_call(
|
||||
llm.LLMContext(
|
||||
platform="ollama",
|
||||
context=context,
|
||||
user_prompt="Please call the test function",
|
||||
language="en",
|
||||
assistant="conversation",
|
||||
device_id=None,
|
||||
@ -369,7 +368,6 @@ async def test_function_exception(
|
||||
llm.LLMContext(
|
||||
platform="ollama",
|
||||
context=context,
|
||||
user_prompt="Please call the test function",
|
||||
language="en",
|
||||
assistant="conversation",
|
||||
device_id=None,
|
||||
|
@ -36,7 +36,6 @@ def llm_context() -> llm.LLMContext:
|
||||
return llm.LLMContext(
|
||||
platform="",
|
||||
context=None,
|
||||
user_prompt=None,
|
||||
language=None,
|
||||
assistant=None,
|
||||
device_id=None,
|
||||
@ -162,7 +161,6 @@ async def test_assist_api(
|
||||
llm_context = llm.LLMContext(
|
||||
platform="test_platform",
|
||||
context=test_context,
|
||||
user_prompt="test_text",
|
||||
language="*",
|
||||
assistant="conversation",
|
||||
device_id=None,
|
||||
@ -237,7 +235,7 @@ async def test_assist_api(
|
||||
"area": {"value": "kitchen"},
|
||||
"floor": {"value": "ground_floor"},
|
||||
},
|
||||
text_input="test_text",
|
||||
text_input=None,
|
||||
context=test_context,
|
||||
language="*",
|
||||
assistant="conversation",
|
||||
@ -296,7 +294,7 @@ async def test_assist_api(
|
||||
"preferred_area_id": {"value": area.id},
|
||||
"preferred_floor_id": {"value": floor.floor_id},
|
||||
},
|
||||
text_input="test_text",
|
||||
text_input=None,
|
||||
context=test_context,
|
||||
language="*",
|
||||
assistant="conversation",
|
||||
@ -412,7 +410,6 @@ async def test_assist_api_prompt(
|
||||
llm_context = llm.LLMContext(
|
||||
platform="test_platform",
|
||||
context=context,
|
||||
user_prompt="test_text",
|
||||
language="*",
|
||||
assistant="conversation",
|
||||
device_id=None,
|
||||
@ -760,7 +757,6 @@ async def test_script_tool(
|
||||
llm_context = llm.LLMContext(
|
||||
platform="test_platform",
|
||||
context=context,
|
||||
user_prompt="test_text",
|
||||
language="*",
|
||||
assistant="conversation",
|
||||
device_id=None,
|
||||
@ -961,7 +957,6 @@ async def test_script_tool_name(hass: HomeAssistant) -> None:
|
||||
llm_context = llm.LLMContext(
|
||||
platform="test_platform",
|
||||
context=context,
|
||||
user_prompt="test_text",
|
||||
language="*",
|
||||
assistant="conversation",
|
||||
device_id=None,
|
||||
@ -1241,7 +1236,6 @@ async def test_calendar_get_events_tool(hass: HomeAssistant) -> None:
|
||||
llm_context = llm.LLMContext(
|
||||
platform="test_platform",
|
||||
context=context,
|
||||
user_prompt="test_text",
|
||||
language="*",
|
||||
assistant="conversation",
|
||||
device_id=None,
|
||||
@ -1344,7 +1338,6 @@ async def test_todo_get_items_tool(hass: HomeAssistant) -> None:
|
||||
llm_context = llm.LLMContext(
|
||||
platform="test_platform",
|
||||
context=context,
|
||||
user_prompt="test_text",
|
||||
language="*",
|
||||
assistant="conversation",
|
||||
device_id=None,
|
||||
@ -1451,7 +1444,6 @@ async def test_no_tools_exposed(hass: HomeAssistant) -> None:
|
||||
llm_context = llm.LLMContext(
|
||||
platform="test_platform",
|
||||
context=context,
|
||||
user_prompt="test_text",
|
||||
language="*",
|
||||
assistant="conversation",
|
||||
device_id=None,
|
||||
|
Loading…
x
Reference in New Issue
Block a user