mirror of
https://github.com/home-assistant/core.git
synced 2026-09-27 18:08:37 -04:00
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2591 lines
83 KiB
Plaintext
2591 lines
83 KiB
Plaintext
# serializer version: 1
|
||
# name: test_bash_code_execution
|
||
list([
|
||
dict({
|
||
'attachments': None,
|
||
'content': "Write a file with a random number and save it to '/tmp/number.txt'",
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'content': "I'll create a file with a random number and save it to '/tmp/number.txt'.",
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'native': None,
|
||
'role': 'assistant',
|
||
'thinking_content': None,
|
||
'tool_calls': list([
|
||
dict({
|
||
'external': True,
|
||
'id': 'srvtoolu_12345ABC',
|
||
'tool_args': dict({
|
||
'command': 'echo $RANDOM > /tmp/number.txt && cat /tmp/number.txt',
|
||
}),
|
||
'tool_name': 'bash_code_execution',
|
||
}),
|
||
]),
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'role': 'tool_result',
|
||
'tool_call_id': 'srvtoolu_12345ABC',
|
||
'tool_name': 'bash_code_execution',
|
||
'tool_result': dict({
|
||
'content': list([
|
||
]),
|
||
'return_code': 0,
|
||
'stderr': '',
|
||
'stdout': '''
|
||
3268
|
||
|
||
''',
|
||
'type': 'bash_code_execution_result',
|
||
}),
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'content': "Done! I've created the file '/tmp/number.txt' with the random number 3268.",
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'native': dict({
|
||
'citation_details': list([
|
||
]),
|
||
'container': Container(id='container_1234567890ABCDEFGHIJKLMN', expires_at=HAFakeDatetime(2025, 10, 31, 12, 5, tzinfo=datetime.timezone.utc)),
|
||
'redacted_thinking': None,
|
||
'thinking_signature': None,
|
||
}),
|
||
'role': 'assistant',
|
||
'thinking_content': None,
|
||
'tool_calls': None,
|
||
}),
|
||
])
|
||
# ---
|
||
# name: test_bash_code_execution.1
|
||
list([
|
||
dict({
|
||
'content': "Write a file with a random number and save it to '/tmp/number.txt'",
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'content': list([
|
||
dict({
|
||
'text': "I'll create a file with a random number and save it to '/tmp/number.txt'.",
|
||
'type': 'text',
|
||
}),
|
||
dict({
|
||
'id': 'srvtoolu_12345ABC',
|
||
'input': dict({
|
||
'command': 'echo $RANDOM > /tmp/number.txt && cat /tmp/number.txt',
|
||
}),
|
||
'name': 'bash_code_execution',
|
||
'type': 'server_tool_use',
|
||
}),
|
||
dict({
|
||
'content': dict({
|
||
'content': list([
|
||
]),
|
||
'return_code': 0,
|
||
'stderr': '',
|
||
'stdout': '''
|
||
3268
|
||
|
||
''',
|
||
'type': 'bash_code_execution_result',
|
||
}),
|
||
'tool_use_id': 'srvtoolu_12345ABC',
|
||
'type': 'bash_code_execution_tool_result',
|
||
}),
|
||
dict({
|
||
'text': "Done! I've created the file '/tmp/number.txt' with the random number 3268.",
|
||
'type': 'text',
|
||
}),
|
||
]),
|
||
'role': 'assistant',
|
||
}),
|
||
])
|
||
# ---
|
||
# name: test_bash_code_execution_error
|
||
list([
|
||
dict({
|
||
'attachments': None,
|
||
'content': "Write a file with a random number and save it to '/tmp/number.txt'",
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'content': "I'll create a file with a random number and save it to '/tmp/number.txt'.",
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'native': None,
|
||
'role': 'assistant',
|
||
'thinking_content': None,
|
||
'tool_calls': list([
|
||
dict({
|
||
'external': True,
|
||
'id': 'srvtoolu_12345ABC',
|
||
'tool_args': dict({
|
||
'command': 'echo $RANDOM > /tmp/number.txt && cat /tmp/number.txt',
|
||
}),
|
||
'tool_name': 'bash_code_execution',
|
||
}),
|
||
]),
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'role': 'tool_result',
|
||
'tool_call_id': 'srvtoolu_12345ABC',
|
||
'tool_name': 'bash_code_execution',
|
||
'tool_result': dict({
|
||
'error_code': 'unavailable',
|
||
'type': 'bash_code_execution_tool_result_error',
|
||
}),
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'content': 'The container is currently unavailable.',
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'native': dict({
|
||
'citation_details': list([
|
||
]),
|
||
'container': Container(id='container_1234567890ABCDEFGHIJKLMN', expires_at=HAFakeDatetime(2025, 10, 31, 12, 5, tzinfo=datetime.timezone.utc)),
|
||
'redacted_thinking': None,
|
||
'thinking_signature': None,
|
||
}),
|
||
'role': 'assistant',
|
||
'thinking_content': None,
|
||
'tool_calls': None,
|
||
}),
|
||
])
|
||
# ---
|
||
# name: test_bash_code_execution_error.1
|
||
list([
|
||
dict({
|
||
'content': "Write a file with a random number and save it to '/tmp/number.txt'",
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'content': list([
|
||
dict({
|
||
'text': "I'll create a file with a random number and save it to '/tmp/number.txt'.",
|
||
'type': 'text',
|
||
}),
|
||
dict({
|
||
'id': 'srvtoolu_12345ABC',
|
||
'input': dict({
|
||
'command': 'echo $RANDOM > /tmp/number.txt && cat /tmp/number.txt',
|
||
}),
|
||
'name': 'bash_code_execution',
|
||
'type': 'server_tool_use',
|
||
}),
|
||
dict({
|
||
'content': dict({
|
||
'error_code': 'unavailable',
|
||
'type': 'bash_code_execution_tool_result_error',
|
||
}),
|
||
'tool_use_id': 'srvtoolu_12345ABC',
|
||
'type': 'bash_code_execution_tool_result',
|
||
}),
|
||
dict({
|
||
'text': 'The container is currently unavailable.',
|
||
'type': 'text',
|
||
}),
|
||
]),
|
||
'role': 'assistant',
|
||
}),
|
||
])
|
||
# ---
|
||
# name: test_disabled_thinking[subentry_data0]
|
||
list([
|
||
dict({
|
||
'content': '''
|
||
You are a voice assistant for Home Assistant.
|
||
Answer questions about the world truthfully.
|
||
Answer in plain text. Keep it simple and to the point.
|
||
Only if the user wants to control a device, tell them to expose entities to their voice assistant in Home Assistant.
|
||
''',
|
||
'created': HAFakeDatetime(2024, 5, 24, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'role': 'system',
|
||
}),
|
||
dict({
|
||
'attachments': None,
|
||
'content': 'hello',
|
||
'created': HAFakeDatetime(2024, 5, 24, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'content': 'Hello, how can I help you today?',
|
||
'created': HAFakeDatetime(2024, 5, 24, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'native': None,
|
||
'role': 'assistant',
|
||
'thinking_content': None,
|
||
'tool_calls': None,
|
||
}),
|
||
])
|
||
# ---
|
||
# name: test_disabled_thinking[subentry_data0].1
|
||
dict({
|
||
'container': None,
|
||
'max_tokens': 3000,
|
||
'messages': list([
|
||
dict({
|
||
'content': 'hello',
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'content': 'Hello, how can I help you today?',
|
||
'role': 'assistant',
|
||
}),
|
||
]),
|
||
'model': 'claude-haiku-4-5',
|
||
'stream': True,
|
||
'system': list([
|
||
dict({
|
||
'cache_control': dict({
|
||
'type': 'ephemeral',
|
||
}),
|
||
'text': '''
|
||
You are a voice assistant for Home Assistant.
|
||
Answer questions about the world truthfully.
|
||
Answer in plain text. Keep it simple and to the point.
|
||
Only if the user wants to control a device, tell them to expose entities to their voice assistant in Home Assistant.
|
||
''',
|
||
'type': 'text',
|
||
}),
|
||
]),
|
||
'thinking': dict({
|
||
'type': 'disabled',
|
||
}),
|
||
})
|
||
# ---
|
||
# name: test_disabled_thinking[subentry_data1]
|
||
list([
|
||
dict({
|
||
'content': '''
|
||
You are a voice assistant for Home Assistant.
|
||
Answer questions about the world truthfully.
|
||
Answer in plain text. Keep it simple and to the point.
|
||
Only if the user wants to control a device, tell them to expose entities to their voice assistant in Home Assistant.
|
||
''',
|
||
'created': HAFakeDatetime(2024, 5, 24, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'role': 'system',
|
||
}),
|
||
dict({
|
||
'attachments': None,
|
||
'content': 'hello',
|
||
'created': HAFakeDatetime(2024, 5, 24, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'content': 'Hello, how can I help you today?',
|
||
'created': HAFakeDatetime(2024, 5, 24, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'native': None,
|
||
'role': 'assistant',
|
||
'thinking_content': None,
|
||
'tool_calls': None,
|
||
}),
|
||
])
|
||
# ---
|
||
# name: test_disabled_thinking[subentry_data1].1
|
||
dict({
|
||
'container': None,
|
||
'max_tokens': 3000,
|
||
'messages': list([
|
||
dict({
|
||
'content': 'hello',
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'content': 'Hello, how can I help you today?',
|
||
'role': 'assistant',
|
||
}),
|
||
]),
|
||
'model': 'claude-opus-4-7',
|
||
'stream': True,
|
||
'system': list([
|
||
dict({
|
||
'cache_control': dict({
|
||
'type': 'ephemeral',
|
||
}),
|
||
'text': '''
|
||
You are a voice assistant for Home Assistant.
|
||
Answer questions about the world truthfully.
|
||
Answer in plain text. Keep it simple and to the point.
|
||
Only if the user wants to control a device, tell them to expose entities to their voice assistant in Home Assistant.
|
||
''',
|
||
'type': 'text',
|
||
}),
|
||
]),
|
||
'thinking': dict({
|
||
'type': 'disabled',
|
||
}),
|
||
})
|
||
# ---
|
||
# name: test_extended_thinking
|
||
dict({
|
||
'container': None,
|
||
'max_tokens': 3000,
|
||
'messages': list([
|
||
dict({
|
||
'content': 'hello',
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'content': list([
|
||
dict({
|
||
'signature': 'ErUBCkYIARgCIkCYXaVNJShe3A86Hp7XUzh9YsCYBbJTbQsrklTAPtJ2sP/NoB6tSzpK/nTL6CjSo2R6n0KNBIg5MH6asM2R/kmaEgyB/X1FtZq5OQAC7jUaDEPWCdcwGQ4RaBy5wiIwmRxExIlDhoY6tILoVPnOExkC/0igZxHEwxK8RU/fmw0b+o+TwAarzUitwzbo21E5Kh3pa3I6yqVROf1t2F8rFocNUeCegsWV/ytwYV+ayA==',
|
||
'thinking': 'The user has just greeted me with "Hi". This is a simple greeting and doesn\'t require any Home Assistant function calls. I should respond with a friendly greeting and let them know I\'m available to help with their smart home.',
|
||
'type': 'thinking',
|
||
}),
|
||
dict({
|
||
'text': 'Hello, how can I help you today?',
|
||
'type': 'text',
|
||
}),
|
||
]),
|
||
'role': 'assistant',
|
||
}),
|
||
]),
|
||
'model': 'claude-opus-4-5',
|
||
'output_config': dict({
|
||
'effort': 'medium',
|
||
}),
|
||
'stream': True,
|
||
'system': list([
|
||
dict({
|
||
'cache_control': dict({
|
||
'type': 'ephemeral',
|
||
}),
|
||
'text': '''
|
||
You are a voice assistant for Home Assistant.
|
||
Answer questions about the world truthfully.
|
||
Answer in plain text. Keep it simple and to the point.
|
||
Only if the user wants to control a device, tell them to expose entities to their voice assistant in Home Assistant.
|
||
''',
|
||
'type': 'text',
|
||
}),
|
||
]),
|
||
'thinking': dict({
|
||
'budget_tokens': 1500,
|
||
'display': 'summarized',
|
||
'type': 'enabled',
|
||
}),
|
||
})
|
||
# ---
|
||
# name: test_extended_thinking_tool_call
|
||
list([
|
||
dict({
|
||
'content': '''
|
||
You are a voice assistant for Home Assistant.
|
||
Answer questions about the world truthfully.
|
||
Answer in plain text. Keep it simple and to the point.
|
||
|
||
Current time is 16:00:00. Today's date is 2024-06-03.
|
||
''',
|
||
'created': HAFakeDatetime(2024, 6, 3, 23, 0, tzinfo=datetime.timezone.utc),
|
||
'role': 'system',
|
||
}),
|
||
dict({
|
||
'attachments': None,
|
||
'content': 'Please call the test function',
|
||
'created': HAFakeDatetime(2024, 6, 3, 23, 0, tzinfo=datetime.timezone.utc),
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'content': None,
|
||
'created': HAFakeDatetime(2024, 6, 3, 23, 0, tzinfo=datetime.timezone.utc),
|
||
'native': dict({
|
||
'citation_details': list([
|
||
]),
|
||
'container': None,
|
||
'redacted_thinking': 'EroBCkYIARgCKkBJDytPJhw//4vy3t7aE+LfIkxvkAh51cBPrAvBCo6AjgI57Zt9KWPnUVV50OQJ0KZzUFoGZG5sxg95zx4qMwkoEgz43Su3myJKckvj03waDBZLIBSeoAeRUeVsJCIwQ5edQN0sa+HNeB/KUBkoMUwV+IT0eIhcpFxnILdvxUAKM4R1o4KG3x+yO0eo/kyOKiKfrCPFQhvBVmTZPFhgA2Ow8L9gGDVipcz6x3Uu9YETGEny',
|
||
'thinking_signature': 'ErUBCkYIARgCIkCYXaVNJShe3A86Hp7XUzh9YsCYBbJTbQsrklTAPtJ2sP/NoB6tSzpK/nTL6CjSo2R6n0KNBIg5MH6asM2R/kmaEgyB/X1FtZq5OQAC7jUaDEPWCdcwGQ4RaBy5wiIwmRxExIlDhoY6tILoVPnOExkC/0igZxHEwxK8RU/fmw0b+o+TwAarzUitwzbo21E5Kh3pa3I6yqVROf1t2F8rFocNUeCegsWV/ytwYV+ayA==',
|
||
}),
|
||
'role': 'assistant',
|
||
'thinking_content': 'The user asked me to call a test function. Is it a test? What would the function do? Would it violate any privacy or security policies?',
|
||
'tool_calls': None,
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'content': 'Certainly, calling it now!',
|
||
'created': HAFakeDatetime(2024, 6, 3, 23, 0, tzinfo=datetime.timezone.utc),
|
||
'native': dict({
|
||
'citation_details': list([
|
||
]),
|
||
'container': None,
|
||
'redacted_thinking': None,
|
||
'thinking_signature': 'ErUBCkYIARgCIkCYXaVNJShe3A86Hp7XUzh9YsCYBbJTbQsrklTAPtJ2sP/NoB6tSzpK/nTL6CjSo2R6n0KNBIg5MH6asM2R/kmaEgyB/X1FtZq5OQAC7jUaDEPWCdcwGQ4RaBy5wiIwmRxExIlDhoY6tILoVPnOExkC/0igZxHEwxK8RU/fmw0b+o+TwAarzUitwzbo21E5Kh3pa3I6yqVROf1t2F8rFocNUeCegsWV/ytwYV+ayA==',
|
||
}),
|
||
'role': 'assistant',
|
||
'thinking_content': "Okay, let's give it a shot. Will I pass the test?",
|
||
'tool_calls': list([
|
||
dict({
|
||
'external': False,
|
||
'id': 'toolu_0123456789AbCdEfGhIjKlM',
|
||
'tool_args': dict({
|
||
'param1': 'test_value',
|
||
}),
|
||
'tool_name': 'test_tool',
|
||
}),
|
||
]),
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'created': HAFakeDatetime(2024, 6, 3, 23, 0, tzinfo=datetime.timezone.utc),
|
||
'role': 'tool_result',
|
||
'tool_call_id': 'toolu_0123456789AbCdEfGhIjKlM',
|
||
'tool_name': 'test_tool',
|
||
'tool_result': 'Test response',
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'content': 'I have successfully called the function',
|
||
'created': HAFakeDatetime(2024, 6, 3, 23, 0, tzinfo=datetime.timezone.utc),
|
||
'native': None,
|
||
'role': 'assistant',
|
||
'thinking_content': None,
|
||
'tool_calls': None,
|
||
}),
|
||
])
|
||
# ---
|
||
# name: test_extended_thinking_tool_call.1
|
||
list([
|
||
dict({
|
||
'content': 'Please call the test function',
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'content': list([
|
||
dict({
|
||
'signature': 'ErUBCkYIARgCIkCYXaVNJShe3A86Hp7XUzh9YsCYBbJTbQsrklTAPtJ2sP/NoB6tSzpK/nTL6CjSo2R6n0KNBIg5MH6asM2R/kmaEgyB/X1FtZq5OQAC7jUaDEPWCdcwGQ4RaBy5wiIwmRxExIlDhoY6tILoVPnOExkC/0igZxHEwxK8RU/fmw0b+o+TwAarzUitwzbo21E5Kh3pa3I6yqVROf1t2F8rFocNUeCegsWV/ytwYV+ayA==',
|
||
'thinking': 'The user asked me to call a test function. Is it a test? What would the function do? Would it violate any privacy or security policies?',
|
||
'type': 'thinking',
|
||
}),
|
||
dict({
|
||
'data': 'EroBCkYIARgCKkBJDytPJhw//4vy3t7aE+LfIkxvkAh51cBPrAvBCo6AjgI57Zt9KWPnUVV50OQJ0KZzUFoGZG5sxg95zx4qMwkoEgz43Su3myJKckvj03waDBZLIBSeoAeRUeVsJCIwQ5edQN0sa+HNeB/KUBkoMUwV+IT0eIhcpFxnILdvxUAKM4R1o4KG3x+yO0eo/kyOKiKfrCPFQhvBVmTZPFhgA2Ow8L9gGDVipcz6x3Uu9YETGEny',
|
||
'type': 'redacted_thinking',
|
||
}),
|
||
dict({
|
||
'signature': 'ErUBCkYIARgCIkCYXaVNJShe3A86Hp7XUzh9YsCYBbJTbQsrklTAPtJ2sP/NoB6tSzpK/nTL6CjSo2R6n0KNBIg5MH6asM2R/kmaEgyB/X1FtZq5OQAC7jUaDEPWCdcwGQ4RaBy5wiIwmRxExIlDhoY6tILoVPnOExkC/0igZxHEwxK8RU/fmw0b+o+TwAarzUitwzbo21E5Kh3pa3I6yqVROf1t2F8rFocNUeCegsWV/ytwYV+ayA==',
|
||
'thinking': "Okay, let's give it a shot. Will I pass the test?",
|
||
'type': 'thinking',
|
||
}),
|
||
dict({
|
||
'text': 'Certainly, calling it now!',
|
||
'type': 'text',
|
||
}),
|
||
dict({
|
||
'id': 'toolu_0123456789AbCdEfGhIjKlM',
|
||
'input': dict({
|
||
'param1': 'test_value',
|
||
}),
|
||
'name': 'test_tool',
|
||
'type': 'tool_use',
|
||
}),
|
||
]),
|
||
'role': 'assistant',
|
||
}),
|
||
dict({
|
||
'content': list([
|
||
dict({
|
||
'content': '"Test response"',
|
||
'tool_use_id': 'toolu_0123456789AbCdEfGhIjKlM',
|
||
'type': 'tool_result',
|
||
}),
|
||
]),
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'content': 'I have successfully called the function',
|
||
'role': 'assistant',
|
||
}),
|
||
])
|
||
# ---
|
||
# name: test_history_conversion[content0]
|
||
list([
|
||
dict({
|
||
'content': 'Are you sure?',
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'content': 'Yes, I am sure!',
|
||
'role': 'assistant',
|
||
}),
|
||
])
|
||
# ---
|
||
# name: test_history_conversion[content1]
|
||
list([
|
||
dict({
|
||
'content': 'What shape is a donut?',
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'content': 'A donut is a torus.',
|
||
'role': 'assistant',
|
||
}),
|
||
dict({
|
||
'content': 'Are you sure?',
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'content': 'Yes, I am sure!',
|
||
'role': 'assistant',
|
||
}),
|
||
])
|
||
# ---
|
||
# name: test_history_conversion[content2]
|
||
list([
|
||
dict({
|
||
'content': list([
|
||
dict({
|
||
'text': 'What shape is a donut?',
|
||
'type': 'text',
|
||
}),
|
||
dict({
|
||
'text': 'Can you tell me?',
|
||
'type': 'text',
|
||
}),
|
||
]),
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'content': list([
|
||
dict({
|
||
'text': 'A donut is a torus.',
|
||
'type': 'text',
|
||
}),
|
||
dict({
|
||
'text': 'Hope this helps.',
|
||
'type': 'text',
|
||
}),
|
||
]),
|
||
'role': 'assistant',
|
||
}),
|
||
dict({
|
||
'content': 'Are you sure?',
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'content': 'Yes, I am sure!',
|
||
'role': 'assistant',
|
||
}),
|
||
])
|
||
# ---
|
||
# name: test_history_conversion[content3]
|
||
list([
|
||
dict({
|
||
'content': list([
|
||
dict({
|
||
'text': 'What shape is a donut?',
|
||
'type': 'text',
|
||
}),
|
||
dict({
|
||
'text': 'Can you tell me?',
|
||
'type': 'text',
|
||
}),
|
||
dict({
|
||
'text': 'Please?',
|
||
'type': 'text',
|
||
}),
|
||
]),
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'content': list([
|
||
dict({
|
||
'text': 'A donut is a torus.',
|
||
'type': 'text',
|
||
}),
|
||
dict({
|
||
'text': 'Hope this helps.',
|
||
'type': 'text',
|
||
}),
|
||
dict({
|
||
'text': 'You are welcome.',
|
||
'type': 'text',
|
||
}),
|
||
]),
|
||
'role': 'assistant',
|
||
}),
|
||
dict({
|
||
'content': 'Are you sure?',
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'content': 'Yes, I am sure!',
|
||
'role': 'assistant',
|
||
}),
|
||
])
|
||
# ---
|
||
# name: test_history_conversion[content4]
|
||
list([
|
||
dict({
|
||
'content': 'Turn off the lights and make me coffee',
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'content': list([
|
||
dict({
|
||
'text': 'Sure.',
|
||
'type': 'text',
|
||
}),
|
||
dict({
|
||
'id': 'mock-tool-call-id',
|
||
'input': dict({
|
||
'domain': 'light',
|
||
}),
|
||
'name': 'HassTurnOff',
|
||
'type': 'tool_use',
|
||
}),
|
||
dict({
|
||
'id': 'mock-tool-call-id-2',
|
||
'input': dict({
|
||
}),
|
||
'name': 'MakeCoffee',
|
||
'type': 'tool_use',
|
||
}),
|
||
]),
|
||
'role': 'assistant',
|
||
}),
|
||
dict({
|
||
'content': list([
|
||
dict({
|
||
'text': 'Thank you',
|
||
'type': 'text',
|
||
}),
|
||
dict({
|
||
'content': '{"success":true,"response":"Lights are off."}',
|
||
'tool_use_id': 'mock-tool-call-id',
|
||
'type': 'tool_result',
|
||
}),
|
||
dict({
|
||
'content': '{"success":false,"response":"Not enough milk."}',
|
||
'tool_use_id': 'mock-tool-call-id-2',
|
||
'type': 'tool_result',
|
||
}),
|
||
]),
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'content': 'Should I add milk to the shopping list?',
|
||
'role': 'assistant',
|
||
}),
|
||
dict({
|
||
'content': 'Are you sure?',
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'content': 'Yes, I am sure!',
|
||
'role': 'assistant',
|
||
}),
|
||
])
|
||
# ---
|
||
# name: test_history_conversion[content5]
|
||
list([
|
||
dict({
|
||
'content': "What's on the news today?",
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'content': list([
|
||
dict({
|
||
'signature': 'ErU/V+ayA==',
|
||
'thinking': "The user is asking about today's news, which requires current, real-time information. This is clearly something that requires recent information beyond my knowledge cutoff. I should use the web_search tool to find today's news.",
|
||
'type': 'thinking',
|
||
}),
|
||
dict({
|
||
'text': "To get today's news, I'll perform a web search",
|
||
'type': 'text',
|
||
}),
|
||
dict({
|
||
'id': 'srvtoolu_12345ABC',
|
||
'input': dict({
|
||
'query': "today's news",
|
||
}),
|
||
'name': 'web_search',
|
||
'type': 'server_tool_use',
|
||
}),
|
||
dict({
|
||
'content': list([
|
||
dict({
|
||
'encrypted_content': 'ABCDEFG',
|
||
'page_age': '2 days ago',
|
||
'title': "Today's News - Example.com",
|
||
'type': 'web_search_result',
|
||
'url': 'https://www.example.com/todays-news',
|
||
}),
|
||
dict({
|
||
'encrypted_content': 'ABCDEFG',
|
||
'page_age': None,
|
||
'title': 'Breaking News - NewsSite.com',
|
||
'type': 'web_search_result',
|
||
'url': 'https://www.newssite.com/breaking-news',
|
||
}),
|
||
]),
|
||
'tool_use_id': 'srvtoolu_12345ABC',
|
||
'type': 'web_search_tool_result',
|
||
}),
|
||
dict({
|
||
'text': '''
|
||
Here's what I found on the web about today's news:
|
||
1.
|
||
''',
|
||
'type': 'text',
|
||
}),
|
||
dict({
|
||
'citations': list([
|
||
dict({
|
||
'cited_text': 'This release iterates on some of the features we introduced in the last couple of releases, but also...',
|
||
'encrypted_index': 'AAA==',
|
||
'title': 'Home Assistant Release',
|
||
'type': 'web_search_result_location',
|
||
'url': 'https://www.example.com/todays-news',
|
||
}),
|
||
]),
|
||
'text': 'New Home Assistant release',
|
||
'type': 'text',
|
||
}),
|
||
dict({
|
||
'text': '''
|
||
|
||
2.
|
||
''',
|
||
'type': 'text',
|
||
}),
|
||
dict({
|
||
'citations': list([
|
||
dict({
|
||
'cited_text': 'Breaking news from around the world today includes major events in technology, politics, and culture...',
|
||
'encrypted_index': 'AQE=',
|
||
'title': 'Breaking News',
|
||
'type': 'web_search_result_location',
|
||
'url': 'https://www.newssite.com/breaking-news',
|
||
}),
|
||
dict({
|
||
'cited_text': 'Well, this happened...',
|
||
'encrypted_index': 'AgI=',
|
||
'title': 'Breaking News',
|
||
'type': 'web_search_result_location',
|
||
'url': 'https://www.newssite.com/breaking-news',
|
||
}),
|
||
]),
|
||
'text': 'Something incredible happened',
|
||
'type': 'text',
|
||
}),
|
||
dict({
|
||
'text': '''
|
||
|
||
Those are the main headlines making news today.
|
||
''',
|
||
'type': 'text',
|
||
}),
|
||
]),
|
||
'role': 'assistant',
|
||
}),
|
||
dict({
|
||
'content': 'Are you sure?',
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'content': 'Yes, I am sure!',
|
||
'role': 'assistant',
|
||
}),
|
||
])
|
||
# ---
|
||
# name: test_history_conversion[content6]
|
||
list([
|
||
dict({
|
||
'content': "What's new in Home Assistant?",
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'content': list([
|
||
dict({
|
||
'signature': 'ErU/V+ayA==',
|
||
'thinking': 'I need to use the web_fetch tool to fetch the latest release notes from the Home Assistant website.',
|
||
'type': 'thinking',
|
||
}),
|
||
dict({
|
||
'text': 'Sure, let me check that for you!',
|
||
'type': 'text',
|
||
}),
|
||
dict({
|
||
'id': 'srvtoolu_12345ABC',
|
||
'input': dict({
|
||
'url': 'https://www.home-assistant.io/latest-release-notes/',
|
||
}),
|
||
'name': 'web_fetch',
|
||
'type': 'server_tool_use',
|
||
}),
|
||
dict({
|
||
'content': dict({
|
||
'content': dict({
|
||
'citations': dict({
|
||
'enabled': True,
|
||
}),
|
||
'source': dict({
|
||
'data': '''
|
||
Home Assistant new version is out!
|
||
Many new features.
|
||
Anthropic integration now supports web fetch tool.
|
||
Enjoy the release!
|
||
''',
|
||
'media_type': 'text/plain',
|
||
'type': 'text',
|
||
}),
|
||
'title': 'Latest Home Assistant Release Notes',
|
||
'type': 'document',
|
||
}),
|
||
'retrieved_at': '2026-04-04T10:30:00Z',
|
||
'type': 'web_fetch_result',
|
||
'url': 'https://www.home-assistant.io/latest-release-notes/',
|
||
}),
|
||
'tool_use_id': 'srvtoolu_12345ABC',
|
||
'type': 'web_fetch_tool_result',
|
||
}),
|
||
dict({
|
||
'text': '''
|
||
Here's what's great about the new release:
|
||
1. Lots of new features
|
||
2.
|
||
''',
|
||
'type': 'text',
|
||
}),
|
||
dict({
|
||
'citations': list([
|
||
dict({
|
||
'cited_text': 'Anthropic integration now supports web fetch tool.',
|
||
'document_index': 0,
|
||
'document_title': 'Latest Home Assistant Release Notes',
|
||
'end_char_index': 105,
|
||
'start_char_index': 56,
|
||
'type': 'char_location',
|
||
}),
|
||
]),
|
||
'text': 'New web fetch tool for Anthropic integration',
|
||
'type': 'text',
|
||
}),
|
||
dict({
|
||
'text': '''
|
||
|
||
Enjoy!
|
||
''',
|
||
'type': 'text',
|
||
}),
|
||
]),
|
||
'role': 'assistant',
|
||
}),
|
||
dict({
|
||
'content': 'Are you sure?',
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'content': 'Yes, I am sure!',
|
||
'role': 'assistant',
|
||
}),
|
||
])
|
||
# ---
|
||
# name: test_history_conversion[content7]
|
||
list([
|
||
dict({
|
||
'content': 'What time is it?',
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'content': list([
|
||
dict({
|
||
'text': 'Let me check the time for you.',
|
||
'type': 'text',
|
||
}),
|
||
dict({
|
||
'id': 'mock-tool-call-id',
|
||
'input': dict({
|
||
}),
|
||
'name': 'GetCurrentTime',
|
||
'type': 'tool_use',
|
||
}),
|
||
]),
|
||
'role': 'assistant',
|
||
}),
|
||
dict({
|
||
'content': list([
|
||
dict({
|
||
'content': '{"speech_slots":{"time":"14:30:00"},"message":"Current time retrieved"}',
|
||
'tool_use_id': 'mock-tool-call-id',
|
||
'type': 'tool_result',
|
||
}),
|
||
]),
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'content': 'It is currently 2:30 PM.',
|
||
'role': 'assistant',
|
||
}),
|
||
dict({
|
||
'content': 'Are you sure?',
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'content': 'Yes, I am sure!',
|
||
'role': 'assistant',
|
||
}),
|
||
])
|
||
# ---
|
||
# name: test_history_conversion[content8]
|
||
list([
|
||
dict({
|
||
'content': 'Set humidity to 50%',
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'content': list([
|
||
dict({
|
||
'signature': 'EuQBClkIDBE=',
|
||
'thinking': 'Let me search for a tool to set humidity.',
|
||
'type': 'thinking',
|
||
}),
|
||
dict({
|
||
'id': 'srvtoolu_015vXmtZNASLa7n9RsoDfcBC',
|
||
'input': dict({
|
||
'query': 'set humidity humidifier',
|
||
}),
|
||
'name': 'tool_search_tool_bm25',
|
||
'type': 'server_tool_use',
|
||
}),
|
||
dict({
|
||
'content': dict({
|
||
'tool_references': list([
|
||
dict({
|
||
'tool_name': 'HassHumidifierSetpoint',
|
||
'type': 'tool_reference',
|
||
}),
|
||
dict({
|
||
'tool_name': 'HassHumidifierMode',
|
||
'type': 'tool_reference',
|
||
}),
|
||
dict({
|
||
'tool_name': 'HassClimateSetTemperature',
|
||
'type': 'tool_reference',
|
||
}),
|
||
dict({
|
||
'tool_name': 'HassFanSetSpeed',
|
||
'type': 'tool_reference',
|
||
}),
|
||
dict({
|
||
'tool_name': 'HassSetVolume',
|
||
'type': 'tool_reference',
|
||
}),
|
||
]),
|
||
'type': 'tool_search_tool_search_result',
|
||
}),
|
||
'tool_use_id': 'srvtoolu_015vXmtZNASLa7n9RsoDfcBC',
|
||
'type': 'tool_search_tool_result',
|
||
}),
|
||
dict({
|
||
'id': 'toolu_01KNRWb3ZFufCa7WXtzCakhc',
|
||
'input': dict({
|
||
'humidity': 50,
|
||
'name': 'Hygrostat',
|
||
}),
|
||
'name': 'HassHumidifierSetpoint',
|
||
'type': 'tool_use',
|
||
}),
|
||
]),
|
||
'role': 'assistant',
|
||
}),
|
||
dict({
|
||
'content': list([
|
||
dict({
|
||
'content': '{"speech":{"plain":{"speech":"The Hygrostat is set to 50%","extra_data":null}},"response_type":"action_done","data":{"success":[],"failed":[]}}',
|
||
'tool_use_id': 'toolu_01KNRWb3ZFufCa7WXtzCakhc',
|
||
'type': 'tool_result',
|
||
}),
|
||
]),
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'content': 'The Hygrostat humidity has been set to **50%**. ✅',
|
||
'role': 'assistant',
|
||
}),
|
||
dict({
|
||
'content': 'Are you sure?',
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'content': 'Yes, I am sure!',
|
||
'role': 'assistant',
|
||
}),
|
||
])
|
||
# ---
|
||
# name: test_redacted_thinking
|
||
list([
|
||
dict({
|
||
'attachments': None,
|
||
'content': 'ANTHROPIC_MAGIC_STRING_TRIGGER_REDACTED_THINKING_46C9A13E193C177646C7398A98432ECCCE4C1253D5E2D82641AC0E52CC2876CB',
|
||
'created': HAFakeDatetime(2024, 5, 24, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'content': None,
|
||
'created': HAFakeDatetime(2024, 5, 24, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'native': dict({
|
||
'citation_details': list([
|
||
]),
|
||
'container': None,
|
||
'redacted_thinking': 'EroBCkYIARgCKkBJDytPJhw//4vy3t7aE+LfIkxvkAh51cBPrAvBCo6AjgI57Zt9KWPnUVV50OQJ0KZzUFoGZG5sxg95zx4qMwkoEgz43Su3myJKckvj03waDBZLIBSeoAeRUeVsJCIwQ5edQN0sa+HNeB/KUBkoMUwV+IT0eIhcpFxnILdvxUAKM4R1o4KG3x+yO0eo/kyOKiKfrCPFQhvBVmTZPFhgA2Ow8L9gGDVipcz6x3Uu9YETGEny',
|
||
'thinking_signature': None,
|
||
}),
|
||
'role': 'assistant',
|
||
'thinking_content': None,
|
||
'tool_calls': None,
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'content': None,
|
||
'created': HAFakeDatetime(2024, 5, 24, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'native': dict({
|
||
'citation_details': list([
|
||
]),
|
||
'container': None,
|
||
'redacted_thinking': 'EroBCkYIARgCKkBJDytPJhw//4vy3t7aE+LfIkxvkAh51cBPrAvBCo6AjgI57Zt9KWPnUVV50OQJ0KZzUFoGZG5sxg95zx4qMwkoEgz43Su3myJKckvj03waDBZLIBSeoAeRUeVsJCIwQ5edQN0sa+HNeB/KUBkoMUwV+IT0eIhcpFxnILdvxUAKM4R1o4KG3x+yO0eo/kyOKiKfrCPFQhvBVmTZPFhgA2Ow8L9gGDVipcz6x3Uu9YETGEny',
|
||
'thinking_signature': None,
|
||
}),
|
||
'role': 'assistant',
|
||
'thinking_content': None,
|
||
'tool_calls': None,
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'content': 'How can I help you today?',
|
||
'created': HAFakeDatetime(2024, 5, 24, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'native': dict({
|
||
'citation_details': list([
|
||
]),
|
||
'container': None,
|
||
'redacted_thinking': 'EroBCkYIARgCKkBJDytPJhw//4vy3t7aE+LfIkxvkAh51cBPrAvBCo6AjgI57Zt9KWPnUVV50OQJ0KZzUFoGZG5sxg95zx4qMwkoEgz43Su3myJKckvj03waDBZLIBSeoAeRUeVsJCIwQ5edQN0sa+HNeB/KUBkoMUwV+IT0eIhcpFxnILdvxUAKM4R1o4KG3x+yO0eo/kyOKiKfrCPFQhvBVmTZPFhgA2Ow8L9gGDVipcz6x3Uu9YETGEny',
|
||
'thinking_signature': None,
|
||
}),
|
||
'role': 'assistant',
|
||
'thinking_content': None,
|
||
'tool_calls': None,
|
||
}),
|
||
])
|
||
# ---
|
||
# name: test_text_editor_code_execution[args_parts0-content0]
|
||
list([
|
||
dict({
|
||
'attachments': None,
|
||
'content': 'Do the needful',
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'content': "I'll do it.",
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'native': None,
|
||
'role': 'assistant',
|
||
'thinking_content': None,
|
||
'tool_calls': list([
|
||
dict({
|
||
'external': True,
|
||
'id': 'srvtoolu_12345ABC',
|
||
'tool_args': dict({
|
||
'command': 'create',
|
||
'file_text': '3268',
|
||
'path': '/tmp/number.txt',
|
||
}),
|
||
'tool_name': 'text_editor_code_execution',
|
||
}),
|
||
]),
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'role': 'tool_result',
|
||
'tool_call_id': 'srvtoolu_12345ABC',
|
||
'tool_name': 'text_editor_code_execution',
|
||
'tool_result': dict({
|
||
'is_file_update': False,
|
||
'type': 'text_editor_code_execution_create_result',
|
||
}),
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'content': 'Done',
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'native': dict({
|
||
'citation_details': list([
|
||
]),
|
||
'container': Container(id='container_1234567890ABCDEFGHIJKLMN', expires_at=HAFakeDatetime(2025, 10, 31, 12, 5, tzinfo=datetime.timezone.utc)),
|
||
'redacted_thinking': None,
|
||
'thinking_signature': None,
|
||
}),
|
||
'role': 'assistant',
|
||
'thinking_content': None,
|
||
'tool_calls': None,
|
||
}),
|
||
])
|
||
# ---
|
||
# name: test_text_editor_code_execution[args_parts0-content0].1
|
||
list([
|
||
dict({
|
||
'content': 'Do the needful',
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'content': list([
|
||
dict({
|
||
'text': "I'll do it.",
|
||
'type': 'text',
|
||
}),
|
||
dict({
|
||
'id': 'srvtoolu_12345ABC',
|
||
'input': dict({
|
||
'command': 'create',
|
||
'file_text': '3268',
|
||
'path': '/tmp/number.txt',
|
||
}),
|
||
'name': 'text_editor_code_execution',
|
||
'type': 'server_tool_use',
|
||
}),
|
||
dict({
|
||
'content': dict({
|
||
'is_file_update': False,
|
||
'type': 'text_editor_code_execution_create_result',
|
||
}),
|
||
'tool_use_id': 'srvtoolu_12345ABC',
|
||
'type': 'text_editor_code_execution_tool_result',
|
||
}),
|
||
dict({
|
||
'text': 'Done',
|
||
'type': 'text',
|
||
}),
|
||
]),
|
||
'role': 'assistant',
|
||
}),
|
||
])
|
||
# ---
|
||
# name: test_text_editor_code_execution[args_parts1-content1]
|
||
list([
|
||
dict({
|
||
'attachments': None,
|
||
'content': 'Do the needful',
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'content': "I'll do it.",
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'native': None,
|
||
'role': 'assistant',
|
||
'thinking_content': None,
|
||
'tool_calls': list([
|
||
dict({
|
||
'external': True,
|
||
'id': 'srvtoolu_12345ABC',
|
||
'tool_args': dict({
|
||
'command': 'str_replace',
|
||
'new_str': '8623',
|
||
'old_str': '3268',
|
||
'path': '/tmp/number.txt',
|
||
}),
|
||
'tool_name': 'text_editor_code_execution',
|
||
}),
|
||
]),
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'role': 'tool_result',
|
||
'tool_call_id': 'srvtoolu_12345ABC',
|
||
'tool_name': 'text_editor_code_execution',
|
||
'tool_result': dict({
|
||
'lines': list([
|
||
'-3268',
|
||
'\\ No newline at end of file',
|
||
'+8623',
|
||
'\\ No newline at end of file',
|
||
]),
|
||
'new_lines': 1,
|
||
'new_start': 1,
|
||
'old_lines': 1,
|
||
'old_start': 1,
|
||
'type': 'text_editor_code_execution_str_replace_result',
|
||
}),
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'content': 'Done',
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'native': dict({
|
||
'citation_details': list([
|
||
]),
|
||
'container': Container(id='container_1234567890ABCDEFGHIJKLMN', expires_at=HAFakeDatetime(2025, 10, 31, 12, 5, tzinfo=datetime.timezone.utc)),
|
||
'redacted_thinking': None,
|
||
'thinking_signature': None,
|
||
}),
|
||
'role': 'assistant',
|
||
'thinking_content': None,
|
||
'tool_calls': None,
|
||
}),
|
||
])
|
||
# ---
|
||
# name: test_text_editor_code_execution[args_parts1-content1].1
|
||
list([
|
||
dict({
|
||
'content': 'Do the needful',
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'content': list([
|
||
dict({
|
||
'text': "I'll do it.",
|
||
'type': 'text',
|
||
}),
|
||
dict({
|
||
'id': 'srvtoolu_12345ABC',
|
||
'input': dict({
|
||
'command': 'str_replace',
|
||
'new_str': '8623',
|
||
'old_str': '3268',
|
||
'path': '/tmp/number.txt',
|
||
}),
|
||
'name': 'text_editor_code_execution',
|
||
'type': 'server_tool_use',
|
||
}),
|
||
dict({
|
||
'content': dict({
|
||
'lines': list([
|
||
'-3268',
|
||
'\\ No newline at end of file',
|
||
'+8623',
|
||
'\\ No newline at end of file',
|
||
]),
|
||
'new_lines': 1,
|
||
'new_start': 1,
|
||
'old_lines': 1,
|
||
'old_start': 1,
|
||
'type': 'text_editor_code_execution_str_replace_result',
|
||
}),
|
||
'tool_use_id': 'srvtoolu_12345ABC',
|
||
'type': 'text_editor_code_execution_tool_result',
|
||
}),
|
||
dict({
|
||
'text': 'Done',
|
||
'type': 'text',
|
||
}),
|
||
]),
|
||
'role': 'assistant',
|
||
}),
|
||
])
|
||
# ---
|
||
# name: test_text_editor_code_execution[args_parts2-content2]
|
||
list([
|
||
dict({
|
||
'attachments': None,
|
||
'content': 'Do the needful',
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'content': "I'll do it.",
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'native': None,
|
||
'role': 'assistant',
|
||
'thinking_content': None,
|
||
'tool_calls': list([
|
||
dict({
|
||
'external': True,
|
||
'id': 'srvtoolu_12345ABC',
|
||
'tool_args': dict({
|
||
'command': 'view',
|
||
'path': '/tmp/number.txt',
|
||
}),
|
||
'tool_name': 'text_editor_code_execution',
|
||
}),
|
||
]),
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'role': 'tool_result',
|
||
'tool_call_id': 'srvtoolu_12345ABC',
|
||
'tool_name': 'text_editor_code_execution',
|
||
'tool_result': dict({
|
||
'content': '8623',
|
||
'file_type': 'text',
|
||
'num_lines': 1,
|
||
'start_line': 1,
|
||
'total_lines': 1,
|
||
'type': 'text_editor_code_execution_view_result',
|
||
}),
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'content': 'Done',
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'native': dict({
|
||
'citation_details': list([
|
||
]),
|
||
'container': Container(id='container_1234567890ABCDEFGHIJKLMN', expires_at=HAFakeDatetime(2025, 10, 31, 12, 5, tzinfo=datetime.timezone.utc)),
|
||
'redacted_thinking': None,
|
||
'thinking_signature': None,
|
||
}),
|
||
'role': 'assistant',
|
||
'thinking_content': None,
|
||
'tool_calls': None,
|
||
}),
|
||
])
|
||
# ---
|
||
# name: test_text_editor_code_execution[args_parts2-content2].1
|
||
list([
|
||
dict({
|
||
'content': 'Do the needful',
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'content': list([
|
||
dict({
|
||
'text': "I'll do it.",
|
||
'type': 'text',
|
||
}),
|
||
dict({
|
||
'id': 'srvtoolu_12345ABC',
|
||
'input': dict({
|
||
'command': 'view',
|
||
'path': '/tmp/number.txt',
|
||
}),
|
||
'name': 'text_editor_code_execution',
|
||
'type': 'server_tool_use',
|
||
}),
|
||
dict({
|
||
'content': dict({
|
||
'content': '8623',
|
||
'file_type': 'text',
|
||
'num_lines': 1,
|
||
'start_line': 1,
|
||
'total_lines': 1,
|
||
'type': 'text_editor_code_execution_view_result',
|
||
}),
|
||
'tool_use_id': 'srvtoolu_12345ABC',
|
||
'type': 'text_editor_code_execution_tool_result',
|
||
}),
|
||
dict({
|
||
'text': 'Done',
|
||
'type': 'text',
|
||
}),
|
||
]),
|
||
'role': 'assistant',
|
||
}),
|
||
])
|
||
# ---
|
||
# name: test_text_editor_code_execution[args_parts3-content3]
|
||
list([
|
||
dict({
|
||
'attachments': None,
|
||
'content': 'Do the needful',
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'content': "I'll do it.",
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'native': None,
|
||
'role': 'assistant',
|
||
'thinking_content': None,
|
||
'tool_calls': list([
|
||
dict({
|
||
'external': True,
|
||
'id': 'srvtoolu_12345ABC',
|
||
'tool_args': dict({
|
||
'command': 'view',
|
||
'path': '/tmp/number2.txt',
|
||
}),
|
||
'tool_name': 'text_editor_code_execution',
|
||
}),
|
||
]),
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'role': 'tool_result',
|
||
'tool_call_id': 'srvtoolu_12345ABC',
|
||
'tool_name': 'text_editor_code_execution',
|
||
'tool_result': dict({
|
||
'error_code': 'unavailable',
|
||
'error_message': 'Tool response parsing error for view: Failed to parse tool response as JSON: unexpected character: line 1 column 1 (char 0)',
|
||
'type': 'text_editor_code_execution_tool_result_error',
|
||
}),
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'content': 'Done',
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'native': dict({
|
||
'citation_details': list([
|
||
]),
|
||
'container': Container(id='container_1234567890ABCDEFGHIJKLMN', expires_at=HAFakeDatetime(2025, 10, 31, 12, 5, tzinfo=datetime.timezone.utc)),
|
||
'redacted_thinking': None,
|
||
'thinking_signature': None,
|
||
}),
|
||
'role': 'assistant',
|
||
'thinking_content': None,
|
||
'tool_calls': None,
|
||
}),
|
||
])
|
||
# ---
|
||
# name: test_text_editor_code_execution[args_parts3-content3].1
|
||
list([
|
||
dict({
|
||
'content': 'Do the needful',
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'content': list([
|
||
dict({
|
||
'text': "I'll do it.",
|
||
'type': 'text',
|
||
}),
|
||
dict({
|
||
'id': 'srvtoolu_12345ABC',
|
||
'input': dict({
|
||
'command': 'view',
|
||
'path': '/tmp/number2.txt',
|
||
}),
|
||
'name': 'text_editor_code_execution',
|
||
'type': 'server_tool_use',
|
||
}),
|
||
dict({
|
||
'content': dict({
|
||
'error_code': 'unavailable',
|
||
'error_message': 'Tool response parsing error for view: Failed to parse tool response as JSON: unexpected character: line 1 column 1 (char 0)',
|
||
'type': 'text_editor_code_execution_tool_result_error',
|
||
}),
|
||
'tool_use_id': 'srvtoolu_12345ABC',
|
||
'type': 'text_editor_code_execution_tool_result',
|
||
}),
|
||
dict({
|
||
'text': 'Done',
|
||
'type': 'text',
|
||
}),
|
||
]),
|
||
'role': 'assistant',
|
||
}),
|
||
])
|
||
# ---
|
||
# name: test_tool_search
|
||
list([
|
||
dict({
|
||
'attachments': None,
|
||
'content': 'Can you set humidifier setpoint?',
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'content': 'Sure, let me check that for you!',
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'native': dict({
|
||
'citation_details': list([
|
||
]),
|
||
'container': None,
|
||
'redacted_thinking': None,
|
||
'thinking_signature': 'ErUBCkYIARgCIkCYXaVNJShe3A86Hp7XUzh9YsCYBbJTbQsrklTAPtJ2sP/NoB6tSzpK/nTL6CjSo2R6n0KNBIg5MH6asM2R/kmaEgyB/X1FtZq5OQAC7jUaDEPWCdcwGQ4RaBy5wiIwmRxExIlDhoY6tILoVPnOExkC/0igZxHEwxK8RU/fmw0b+o+TwAarzUitwzbo21E5Kh3pa3I6yqVROf1t2F8rFocNUeCegsWV/ytwYV+ayA==',
|
||
}),
|
||
'role': 'assistant',
|
||
'thinking_content': 'I will fetch the available tools',
|
||
'tool_calls': list([
|
||
dict({
|
||
'external': True,
|
||
'id': 'srvtoolu_12345ABC',
|
||
'tool_args': dict({
|
||
'limit': 5,
|
||
'query': 'set humidifier humidity',
|
||
}),
|
||
'tool_name': 'tool_search_tool_bm25',
|
||
}),
|
||
]),
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'role': 'tool_result',
|
||
'tool_call_id': 'srvtoolu_12345ABC',
|
||
'tool_name': 'tool_search',
|
||
'tool_result': dict({
|
||
'tool_references': list([
|
||
dict({
|
||
'tool_name': 'HassHumidifierSetpoint',
|
||
'type': 'tool_reference',
|
||
}),
|
||
dict({
|
||
'tool_name': 'HassHumidifierMode',
|
||
'type': 'tool_reference',
|
||
}),
|
||
dict({
|
||
'tool_name': 'HassClimateSetTemperature',
|
||
'type': 'tool_reference',
|
||
}),
|
||
dict({
|
||
'tool_name': 'HassFanSetSpeed',
|
||
'type': 'tool_reference',
|
||
}),
|
||
dict({
|
||
'tool_name': 'HassSetVolume',
|
||
'type': 'tool_reference',
|
||
}),
|
||
]),
|
||
'type': 'tool_search_tool_search_result',
|
||
}),
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'content': 'Yes, I can!',
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'native': dict({
|
||
'citation_details': list([
|
||
]),
|
||
'container': None,
|
||
'redacted_thinking': None,
|
||
'thinking_signature': 'ErUBCkYIARgCIkCYXaVNJShe3A86Hp7XUzh9YsCYBbJTbQsrklTAPtJ2sP/NoB6tSzpK/nTL6CjSo2R6n0KNBIg5MH6asM2R/kmaEgyB/X1FtZq5OQAC7jUaDEPWCdcwGQ4RaBy5wiIwmRxExIlDhoY6tILoVPnOExkC/0igZxHEwxK8RU/fmw0b+o+TwAarzUitwzbo21E5Kh3pa3I6yqVROf1t2F8rFocNUeCegsWV/ytwYV+ayA==',
|
||
}),
|
||
'role': 'assistant',
|
||
'thinking_content': "Great! All clear, let's reply to the user!",
|
||
'tool_calls': None,
|
||
}),
|
||
])
|
||
# ---
|
||
# name: test_tool_search.1
|
||
list([
|
||
dict({
|
||
'content': 'Can you set humidifier setpoint?',
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'content': list([
|
||
dict({
|
||
'signature': 'ErUBCkYIARgCIkCYXaVNJShe3A86Hp7XUzh9YsCYBbJTbQsrklTAPtJ2sP/NoB6tSzpK/nTL6CjSo2R6n0KNBIg5MH6asM2R/kmaEgyB/X1FtZq5OQAC7jUaDEPWCdcwGQ4RaBy5wiIwmRxExIlDhoY6tILoVPnOExkC/0igZxHEwxK8RU/fmw0b+o+TwAarzUitwzbo21E5Kh3pa3I6yqVROf1t2F8rFocNUeCegsWV/ytwYV+ayA==',
|
||
'thinking': 'I will fetch the available tools',
|
||
'type': 'thinking',
|
||
}),
|
||
dict({
|
||
'text': 'Sure, let me check that for you!',
|
||
'type': 'text',
|
||
}),
|
||
dict({
|
||
'id': 'srvtoolu_12345ABC',
|
||
'input': dict({
|
||
'limit': 5,
|
||
'query': 'set humidifier humidity',
|
||
}),
|
||
'name': 'tool_search_tool_bm25',
|
||
'type': 'server_tool_use',
|
||
}),
|
||
dict({
|
||
'content': dict({
|
||
'tool_references': list([
|
||
dict({
|
||
'tool_name': 'HassHumidifierSetpoint',
|
||
'type': 'tool_reference',
|
||
}),
|
||
dict({
|
||
'tool_name': 'HassHumidifierMode',
|
||
'type': 'tool_reference',
|
||
}),
|
||
dict({
|
||
'tool_name': 'HassClimateSetTemperature',
|
||
'type': 'tool_reference',
|
||
}),
|
||
dict({
|
||
'tool_name': 'HassFanSetSpeed',
|
||
'type': 'tool_reference',
|
||
}),
|
||
dict({
|
||
'tool_name': 'HassSetVolume',
|
||
'type': 'tool_reference',
|
||
}),
|
||
]),
|
||
'type': 'tool_search_tool_search_result',
|
||
}),
|
||
'tool_use_id': 'srvtoolu_12345ABC',
|
||
'type': 'tool_search_tool_result',
|
||
}),
|
||
dict({
|
||
'signature': 'ErUBCkYIARgCIkCYXaVNJShe3A86Hp7XUzh9YsCYBbJTbQsrklTAPtJ2sP/NoB6tSzpK/nTL6CjSo2R6n0KNBIg5MH6asM2R/kmaEgyB/X1FtZq5OQAC7jUaDEPWCdcwGQ4RaBy5wiIwmRxExIlDhoY6tILoVPnOExkC/0igZxHEwxK8RU/fmw0b+o+TwAarzUitwzbo21E5Kh3pa3I6yqVROf1t2F8rFocNUeCegsWV/ytwYV+ayA==',
|
||
'thinking': "Great! All clear, let's reply to the user!",
|
||
'type': 'thinking',
|
||
}),
|
||
dict({
|
||
'text': 'Yes, I can!',
|
||
'type': 'text',
|
||
}),
|
||
]),
|
||
'role': 'assistant',
|
||
}),
|
||
])
|
||
# ---
|
||
# name: test_tool_search_error
|
||
list([
|
||
dict({
|
||
'attachments': None,
|
||
'content': 'Do you have a tool to launch a rocket to the moon?',
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'content': 'Sure, let me check that for you!',
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'native': dict({
|
||
'citation_details': list([
|
||
]),
|
||
'container': None,
|
||
'redacted_thinking': None,
|
||
'thinking_signature': 'ErUBCkYIARgCIkCYXaVNJShe3A86Hp7XUzh9YsCYBbJTbQsrklTAPtJ2sP/NoB6tSzpK/nTL6CjSo2R6n0KNBIg5MH6asM2R/kmaEgyB/X1FtZq5OQAC7jUaDEPWCdcwGQ4RaBy5wiIwmRxExIlDhoY6tILoVPnOExkC/0igZxHEwxK8RU/fmw0b+o+TwAarzUitwzbo21E5Kh3pa3I6yqVROf1t2F8rFocNUeCegsWV/ytwYV+ayA==',
|
||
}),
|
||
'role': 'assistant',
|
||
'thinking_content': 'I will fetch the available tools',
|
||
'tool_calls': list([
|
||
dict({
|
||
'external': True,
|
||
'id': 'srvtoolu_12345ABC',
|
||
'tool_args': dict({
|
||
'limit': 5,
|
||
'query': 'set humidifier humidity',
|
||
}),
|
||
'tool_name': 'tool_search_tool_bm25',
|
||
}),
|
||
]),
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'role': 'tool_result',
|
||
'tool_call_id': 'srvtoolu_12345ABC',
|
||
'tool_name': 'tool_search',
|
||
'tool_result': dict({
|
||
'error_code': 'too_many_requests',
|
||
'type': 'tool_search_tool_result_error',
|
||
}),
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'content': 'I am unable to perform the tool search at this time.',
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'native': None,
|
||
'role': 'assistant',
|
||
'thinking_content': None,
|
||
'tool_calls': None,
|
||
}),
|
||
])
|
||
# ---
|
||
# name: test_tool_search_error.1
|
||
list([
|
||
dict({
|
||
'content': 'Do you have a tool to launch a rocket to the moon?',
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'content': list([
|
||
dict({
|
||
'signature': 'ErUBCkYIARgCIkCYXaVNJShe3A86Hp7XUzh9YsCYBbJTbQsrklTAPtJ2sP/NoB6tSzpK/nTL6CjSo2R6n0KNBIg5MH6asM2R/kmaEgyB/X1FtZq5OQAC7jUaDEPWCdcwGQ4RaBy5wiIwmRxExIlDhoY6tILoVPnOExkC/0igZxHEwxK8RU/fmw0b+o+TwAarzUitwzbo21E5Kh3pa3I6yqVROf1t2F8rFocNUeCegsWV/ytwYV+ayA==',
|
||
'thinking': 'I will fetch the available tools',
|
||
'type': 'thinking',
|
||
}),
|
||
dict({
|
||
'text': 'Sure, let me check that for you!',
|
||
'type': 'text',
|
||
}),
|
||
dict({
|
||
'id': 'srvtoolu_12345ABC',
|
||
'input': dict({
|
||
'limit': 5,
|
||
'query': 'set humidifier humidity',
|
||
}),
|
||
'name': 'tool_search_tool_bm25',
|
||
'type': 'server_tool_use',
|
||
}),
|
||
dict({
|
||
'content': dict({
|
||
'error_code': 'too_many_requests',
|
||
'type': 'tool_search_tool_result_error',
|
||
}),
|
||
'tool_use_id': 'srvtoolu_12345ABC',
|
||
'type': 'tool_search_tool_result',
|
||
}),
|
||
dict({
|
||
'text': 'I am unable to perform the tool search at this time.',
|
||
'type': 'text',
|
||
}),
|
||
]),
|
||
'role': 'assistant',
|
||
}),
|
||
])
|
||
# ---
|
||
# name: test_unknown_hass_api
|
||
dict({
|
||
'continue_conversation': False,
|
||
'conversation_id': '1234',
|
||
'response': IntentResponse(
|
||
card=dict({
|
||
}),
|
||
error_code=<IntentResponseErrorCode.UNKNOWN: 'unknown'>,
|
||
failed_results=list([
|
||
]),
|
||
intent=None,
|
||
language='en',
|
||
matched_states=list([
|
||
]),
|
||
reprompt=dict({
|
||
}),
|
||
response_type=<IntentResponseType.ERROR: 'error'>,
|
||
speech=dict({
|
||
'plain': dict({
|
||
'extra_data': None,
|
||
'speech': 'Error preparing LLM API',
|
||
}),
|
||
}),
|
||
speech_slots=dict({
|
||
}),
|
||
success_results=list([
|
||
]),
|
||
unmatched_states=list([
|
||
]),
|
||
),
|
||
})
|
||
# ---
|
||
# name: test_web_fetch
|
||
list([
|
||
dict({
|
||
'attachments': None,
|
||
'content': "What's new in Home Assistant? Please check on https://www.home-assistant.io/latest-release-notes/",
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'content': 'Sure, let me check that for you!',
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'native': dict({
|
||
'citation_details': list([
|
||
]),
|
||
'container': None,
|
||
'redacted_thinking': None,
|
||
'thinking_signature': 'ErUBCkYIARgCIkCYXaVNJShe3A86Hp7XUzh9YsCYBbJTbQsrklTAPtJ2sP/NoB6tSzpK/nTL6CjSo2R6n0KNBIg5MH6asM2R/kmaEgyB/X1FtZq5OQAC7jUaDEPWCdcwGQ4RaBy5wiIwmRxExIlDhoY6tILoVPnOExkC/0igZxHEwxK8RU/fmw0b+o+TwAarzUitwzbo21E5Kh3pa3I6yqVROf1t2F8rFocNUeCegsWV/ytwYV+ayA==',
|
||
}),
|
||
'role': 'assistant',
|
||
'thinking_content': 'I will fetch the latest release notes',
|
||
'tool_calls': list([
|
||
dict({
|
||
'external': True,
|
||
'id': 'srvtoolu_12345ABC',
|
||
'tool_args': dict({
|
||
'url': 'https://www.home-assistant.io/latest-release-notes/',
|
||
}),
|
||
'tool_name': 'web_fetch',
|
||
}),
|
||
]),
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'role': 'tool_result',
|
||
'tool_call_id': 'srvtoolu_12345ABC',
|
||
'tool_name': 'web_fetch',
|
||
'tool_result': dict({
|
||
'content': dict({
|
||
'citations': None,
|
||
'source': dict({
|
||
'data': '''
|
||
Home Assistant new version is out!
|
||
Many new features.
|
||
Anthropic integration now supports web fetch tool.
|
||
Enjoy the release!
|
||
''',
|
||
'media_type': 'text/plain',
|
||
'type': 'text',
|
||
}),
|
||
'title': 'Latest Home Assistant Release Notes',
|
||
'type': 'document',
|
||
}),
|
||
'retrieved_at': '2025-10-31T12:00:00.637242Z',
|
||
'type': 'web_fetch_result',
|
||
'url': 'https://www.home-assistant.io/latest-release-notes/',
|
||
}),
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'content': '''
|
||
Here's what's great about the new release:
|
||
|
||
''',
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'native': dict({
|
||
'citation_details': list([
|
||
]),
|
||
'container': None,
|
||
'redacted_thinking': None,
|
||
'thinking_signature': 'ErUBCkYIARgCIkCYXaVNJShe3A86Hp7XUzh9YsCYBbJTbQsrklTAPtJ2sP/NoB6tSzpK/nTL6CjSo2R6n0KNBIg5MH6asM2R/kmaEgyB/X1FtZq5OQAC7jUaDEPWCdcwGQ4RaBy5wiIwmRxExIlDhoY6tILoVPnOExkC/0igZxHEwxK8RU/fmw0b+o+TwAarzUitwzbo21E5Kh3pa3I6yqVROf1t2F8rFocNUeCegsWV/ytwYV+ayA==',
|
||
}),
|
||
'role': 'assistant',
|
||
'thinking_content': "Great! All clear, let's reply to the user!",
|
||
'tool_calls': None,
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'content': '''
|
||
1. Many new features
|
||
2. New web fetch tool for Anthropic integration
|
||
What a release!
|
||
''',
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'native': dict({
|
||
'citation_details': list([
|
||
dict({
|
||
'citations': list([
|
||
dict({
|
||
'cited_text': 'Anthropic integration now supports web fetch tool.',
|
||
'document_index': 0,
|
||
'document_title': 'Latest Home Assistant Release Notes',
|
||
'end_char_index': 105,
|
||
'start_char_index': 56,
|
||
'type': 'char_location',
|
||
}),
|
||
]),
|
||
'index': 24,
|
||
'length': 44,
|
||
}),
|
||
]),
|
||
'container': None,
|
||
'redacted_thinking': None,
|
||
'thinking_signature': None,
|
||
}),
|
||
'role': 'assistant',
|
||
'thinking_content': None,
|
||
'tool_calls': None,
|
||
}),
|
||
])
|
||
# ---
|
||
# name: test_web_fetch.1
|
||
list([
|
||
dict({
|
||
'content': "What's new in Home Assistant? Please check on https://www.home-assistant.io/latest-release-notes/",
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'content': list([
|
||
dict({
|
||
'signature': 'ErUBCkYIARgCIkCYXaVNJShe3A86Hp7XUzh9YsCYBbJTbQsrklTAPtJ2sP/NoB6tSzpK/nTL6CjSo2R6n0KNBIg5MH6asM2R/kmaEgyB/X1FtZq5OQAC7jUaDEPWCdcwGQ4RaBy5wiIwmRxExIlDhoY6tILoVPnOExkC/0igZxHEwxK8RU/fmw0b+o+TwAarzUitwzbo21E5Kh3pa3I6yqVROf1t2F8rFocNUeCegsWV/ytwYV+ayA==',
|
||
'thinking': 'I will fetch the latest release notes',
|
||
'type': 'thinking',
|
||
}),
|
||
dict({
|
||
'text': 'Sure, let me check that for you!',
|
||
'type': 'text',
|
||
}),
|
||
dict({
|
||
'id': 'srvtoolu_12345ABC',
|
||
'input': dict({
|
||
'url': 'https://www.home-assistant.io/latest-release-notes/',
|
||
}),
|
||
'name': 'web_fetch',
|
||
'type': 'server_tool_use',
|
||
}),
|
||
dict({
|
||
'content': dict({
|
||
'content': dict({
|
||
'citations': None,
|
||
'source': dict({
|
||
'data': '''
|
||
Home Assistant new version is out!
|
||
Many new features.
|
||
Anthropic integration now supports web fetch tool.
|
||
Enjoy the release!
|
||
''',
|
||
'media_type': 'text/plain',
|
||
'type': 'text',
|
||
}),
|
||
'title': 'Latest Home Assistant Release Notes',
|
||
'type': 'document',
|
||
}),
|
||
'retrieved_at': '2025-10-31T12:00:00.637242Z',
|
||
'type': 'web_fetch_result',
|
||
'url': 'https://www.home-assistant.io/latest-release-notes/',
|
||
}),
|
||
'tool_use_id': 'srvtoolu_12345ABC',
|
||
'type': 'web_fetch_tool_result',
|
||
}),
|
||
dict({
|
||
'signature': 'ErUBCkYIARgCIkCYXaVNJShe3A86Hp7XUzh9YsCYBbJTbQsrklTAPtJ2sP/NoB6tSzpK/nTL6CjSo2R6n0KNBIg5MH6asM2R/kmaEgyB/X1FtZq5OQAC7jUaDEPWCdcwGQ4RaBy5wiIwmRxExIlDhoY6tILoVPnOExkC/0igZxHEwxK8RU/fmw0b+o+TwAarzUitwzbo21E5Kh3pa3I6yqVROf1t2F8rFocNUeCegsWV/ytwYV+ayA==',
|
||
'thinking': "Great! All clear, let's reply to the user!",
|
||
'type': 'thinking',
|
||
}),
|
||
dict({
|
||
'text': '''
|
||
Here's what's great about the new release:
|
||
|
||
''',
|
||
'type': 'text',
|
||
}),
|
||
dict({
|
||
'text': '''
|
||
1. Many new features
|
||
2.
|
||
''',
|
||
'type': 'text',
|
||
}),
|
||
dict({
|
||
'citations': list([
|
||
dict({
|
||
'cited_text': 'Anthropic integration now supports web fetch tool.',
|
||
'document_index': 0,
|
||
'document_title': 'Latest Home Assistant Release Notes',
|
||
'end_char_index': 105,
|
||
'start_char_index': 56,
|
||
'type': 'char_location',
|
||
}),
|
||
]),
|
||
'text': 'New web fetch tool for Anthropic integration',
|
||
'type': 'text',
|
||
}),
|
||
dict({
|
||
'text': '''
|
||
|
||
What a release!
|
||
''',
|
||
'type': 'text',
|
||
}),
|
||
]),
|
||
'role': 'assistant',
|
||
}),
|
||
])
|
||
# ---
|
||
# name: test_web_fetch_error
|
||
list([
|
||
dict({
|
||
'attachments': None,
|
||
'content': "What's new in Home Assistant?",
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'content': 'Sure, let me check that for you!',
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'native': dict({
|
||
'citation_details': list([
|
||
]),
|
||
'container': None,
|
||
'redacted_thinking': None,
|
||
'thinking_signature': 'ErUBCkYIARgCIkCYXaVNJShe3A86Hp7XUzh9YsCYBbJTbQsrklTAPtJ2sP/NoB6tSzpK/nTL6CjSo2R6n0KNBIg5MH6asM2R/kmaEgyB/X1FtZq5OQAC7jUaDEPWCdcwGQ4RaBy5wiIwmRxExIlDhoY6tILoVPnOExkC/0igZxHEwxK8RU/fmw0b+o+TwAarzUitwzbo21E5Kh3pa3I6yqVROf1t2F8rFocNUeCegsWV/ytwYV+ayA==',
|
||
}),
|
||
'role': 'assistant',
|
||
'thinking_content': 'I will fetch the latest release notes',
|
||
'tool_calls': list([
|
||
dict({
|
||
'external': True,
|
||
'id': 'srvtoolu_12345ABC',
|
||
'tool_args': dict({
|
||
'url': 'https://www.home-assistant.io/latest-release-notes/',
|
||
}),
|
||
'tool_name': 'web_fetch',
|
||
}),
|
||
]),
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'role': 'tool_result',
|
||
'tool_call_id': 'srvtoolu_12345ABC',
|
||
'tool_name': 'web_fetch',
|
||
'tool_result': dict({
|
||
'error_code': 'url_not_allowed',
|
||
'type': 'web_fetch_tool_result_error',
|
||
}),
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'content': 'I am unable to perform the web fetch at this time.',
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'native': None,
|
||
'role': 'assistant',
|
||
'thinking_content': None,
|
||
'tool_calls': None,
|
||
}),
|
||
])
|
||
# ---
|
||
# name: test_web_fetch_error.1
|
||
list([
|
||
dict({
|
||
'content': "What's new in Home Assistant?",
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'content': list([
|
||
dict({
|
||
'signature': 'ErUBCkYIARgCIkCYXaVNJShe3A86Hp7XUzh9YsCYBbJTbQsrklTAPtJ2sP/NoB6tSzpK/nTL6CjSo2R6n0KNBIg5MH6asM2R/kmaEgyB/X1FtZq5OQAC7jUaDEPWCdcwGQ4RaBy5wiIwmRxExIlDhoY6tILoVPnOExkC/0igZxHEwxK8RU/fmw0b+o+TwAarzUitwzbo21E5Kh3pa3I6yqVROf1t2F8rFocNUeCegsWV/ytwYV+ayA==',
|
||
'thinking': 'I will fetch the latest release notes',
|
||
'type': 'thinking',
|
||
}),
|
||
dict({
|
||
'text': 'Sure, let me check that for you!',
|
||
'type': 'text',
|
||
}),
|
||
dict({
|
||
'id': 'srvtoolu_12345ABC',
|
||
'input': dict({
|
||
'url': 'https://www.home-assistant.io/latest-release-notes/',
|
||
}),
|
||
'name': 'web_fetch',
|
||
'type': 'server_tool_use',
|
||
}),
|
||
dict({
|
||
'content': dict({
|
||
'error_code': 'url_not_allowed',
|
||
'type': 'web_fetch_tool_result_error',
|
||
}),
|
||
'tool_use_id': 'srvtoolu_12345ABC',
|
||
'type': 'web_fetch_tool_result',
|
||
}),
|
||
dict({
|
||
'text': 'I am unable to perform the web fetch at this time.',
|
||
'type': 'text',
|
||
}),
|
||
]),
|
||
'role': 'assistant',
|
||
}),
|
||
])
|
||
# ---
|
||
# name: test_web_search
|
||
list([
|
||
dict({
|
||
'attachments': None,
|
||
'content': "What's on the news today?",
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'content': "To get today's news, I'll perform a web search",
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'native': dict({
|
||
'citation_details': list([
|
||
]),
|
||
'container': None,
|
||
'redacted_thinking': None,
|
||
'thinking_signature': 'ErUBCkYIARgCIkCYXaVNJShe3A86Hp7XUzh9YsCYBbJTbQsrklTAPtJ2sP/NoB6tSzpK/nTL6CjSo2R6n0KNBIg5MH6asM2R/kmaEgyB/X1FtZq5OQAC7jUaDEPWCdcwGQ4RaBy5wiIwmRxExIlDhoY6tILoVPnOExkC/0igZxHEwxK8RU/fmw0b+o+TwAarzUitwzbo21E5Kh3pa3I6yqVROf1t2F8rFocNUeCegsWV/ytwYV+ayA==',
|
||
}),
|
||
'role': 'assistant',
|
||
'thinking_content': "The user is asking about today's news, which requires current, real-time information. This is clearly something that requires recent information beyond my knowledge cutoff. I should use the web_search tool to find today's news.",
|
||
'tool_calls': list([
|
||
dict({
|
||
'external': True,
|
||
'id': 'srvtoolu_12345ABC',
|
||
'tool_args': dict({
|
||
'query': "today's news",
|
||
}),
|
||
'tool_name': 'web_search',
|
||
}),
|
||
]),
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'role': 'tool_result',
|
||
'tool_call_id': 'srvtoolu_12345ABC',
|
||
'tool_name': 'web_search',
|
||
'tool_result': dict({
|
||
'content': list([
|
||
dict({
|
||
'encrypted_content': 'ABCDEFG',
|
||
'page_age': '2 days ago',
|
||
'title': "Today's News - Example.com",
|
||
'type': 'web_search_result',
|
||
'url': 'https://www.example.com/todays-news',
|
||
}),
|
||
dict({
|
||
'encrypted_content': 'ABCDEFG',
|
||
'page_age': None,
|
||
'title': 'Breaking News - NewsSite.com',
|
||
'type': 'web_search_result',
|
||
'url': 'https://www.newssite.com/breaking-news',
|
||
}),
|
||
]),
|
||
}),
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'content': '''
|
||
Here's what I found on the web about today's news:
|
||
|
||
''',
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'native': dict({
|
||
'citation_details': list([
|
||
]),
|
||
'container': None,
|
||
'redacted_thinking': None,
|
||
'thinking_signature': 'ErUBCkYIARgCIkCYXaVNJShe3A86Hp7XUzh9YsCYBbJTbQsrklTAPtJ2sP/NoB6tSzpK/nTL6CjSo2R6n0KNBIg5MH6asM2R/kmaEgyB/X1FtZq5OQAC7jUaDEPWCdcwGQ4RaBy5wiIwmRxExIlDhoY6tILoVPnOExkC/0igZxHEwxK8RU/fmw0b+o+TwAarzUitwzbo21E5Kh3pa3I6yqVROf1t2F8rFocNUeCegsWV/ytwYV+ayA==',
|
||
}),
|
||
'role': 'assistant',
|
||
'thinking_content': "Great! All clear, let's reply to the user!",
|
||
'tool_calls': None,
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'content': '''
|
||
1. New Home Assistant release
|
||
2. Something incredible happened
|
||
Those are the main headlines making news today.
|
||
''',
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'native': dict({
|
||
'citation_details': list([
|
||
dict({
|
||
'citations': list([
|
||
dict({
|
||
'cited_text': 'This release iterates on some of the features we introduced in the last couple of releases, but also...',
|
||
'encrypted_index': 'AAA==',
|
||
'title': 'Home Assistant Release',
|
||
'type': 'web_search_result_location',
|
||
'url': 'https://www.example.com/todays-news',
|
||
}),
|
||
]),
|
||
'index': 3,
|
||
'length': 26,
|
||
}),
|
||
dict({
|
||
'citations': list([
|
||
dict({
|
||
'cited_text': 'Breaking news from around the world today includes major events in technology, politics, and culture...',
|
||
'encrypted_index': 'AQE=',
|
||
'title': 'Breaking News',
|
||
'type': 'web_search_result_location',
|
||
'url': 'https://www.newssite.com/breaking-news',
|
||
}),
|
||
dict({
|
||
'cited_text': 'Well, this happened...',
|
||
'encrypted_index': 'AgI=',
|
||
'title': 'Breaking News',
|
||
'type': 'web_search_result_location',
|
||
'url': 'https://www.newssite.com/breaking-news',
|
||
}),
|
||
]),
|
||
'index': 33,
|
||
'length': 29,
|
||
}),
|
||
]),
|
||
'container': None,
|
||
'redacted_thinking': None,
|
||
'thinking_signature': None,
|
||
}),
|
||
'role': 'assistant',
|
||
'thinking_content': None,
|
||
'tool_calls': None,
|
||
}),
|
||
])
|
||
# ---
|
||
# name: test_web_search.1
|
||
list([
|
||
dict({
|
||
'content': "What's on the news today?",
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'content': list([
|
||
dict({
|
||
'signature': 'ErUBCkYIARgCIkCYXaVNJShe3A86Hp7XUzh9YsCYBbJTbQsrklTAPtJ2sP/NoB6tSzpK/nTL6CjSo2R6n0KNBIg5MH6asM2R/kmaEgyB/X1FtZq5OQAC7jUaDEPWCdcwGQ4RaBy5wiIwmRxExIlDhoY6tILoVPnOExkC/0igZxHEwxK8RU/fmw0b+o+TwAarzUitwzbo21E5Kh3pa3I6yqVROf1t2F8rFocNUeCegsWV/ytwYV+ayA==',
|
||
'thinking': "The user is asking about today's news, which requires current, real-time information. This is clearly something that requires recent information beyond my knowledge cutoff. I should use the web_search tool to find today's news.",
|
||
'type': 'thinking',
|
||
}),
|
||
dict({
|
||
'text': "To get today's news, I'll perform a web search",
|
||
'type': 'text',
|
||
}),
|
||
dict({
|
||
'id': 'srvtoolu_12345ABC',
|
||
'input': dict({
|
||
'query': "today's news",
|
||
}),
|
||
'name': 'web_search',
|
||
'type': 'server_tool_use',
|
||
}),
|
||
dict({
|
||
'content': list([
|
||
dict({
|
||
'encrypted_content': 'ABCDEFG',
|
||
'page_age': '2 days ago',
|
||
'title': "Today's News - Example.com",
|
||
'type': 'web_search_result',
|
||
'url': 'https://www.example.com/todays-news',
|
||
}),
|
||
dict({
|
||
'encrypted_content': 'ABCDEFG',
|
||
'page_age': None,
|
||
'title': 'Breaking News - NewsSite.com',
|
||
'type': 'web_search_result',
|
||
'url': 'https://www.newssite.com/breaking-news',
|
||
}),
|
||
]),
|
||
'tool_use_id': 'srvtoolu_12345ABC',
|
||
'type': 'web_search_tool_result',
|
||
}),
|
||
dict({
|
||
'signature': 'ErUBCkYIARgCIkCYXaVNJShe3A86Hp7XUzh9YsCYBbJTbQsrklTAPtJ2sP/NoB6tSzpK/nTL6CjSo2R6n0KNBIg5MH6asM2R/kmaEgyB/X1FtZq5OQAC7jUaDEPWCdcwGQ4RaBy5wiIwmRxExIlDhoY6tILoVPnOExkC/0igZxHEwxK8RU/fmw0b+o+TwAarzUitwzbo21E5Kh3pa3I6yqVROf1t2F8rFocNUeCegsWV/ytwYV+ayA==',
|
||
'thinking': "Great! All clear, let's reply to the user!",
|
||
'type': 'thinking',
|
||
}),
|
||
dict({
|
||
'text': '''
|
||
Here's what I found on the web about today's news:
|
||
|
||
''',
|
||
'type': 'text',
|
||
}),
|
||
dict({
|
||
'text': '1. ',
|
||
'type': 'text',
|
||
}),
|
||
dict({
|
||
'citations': list([
|
||
dict({
|
||
'cited_text': 'This release iterates on some of the features we introduced in the last couple of releases, but also...',
|
||
'encrypted_index': 'AAA==',
|
||
'title': 'Home Assistant Release',
|
||
'type': 'web_search_result_location',
|
||
'url': 'https://www.example.com/todays-news',
|
||
}),
|
||
]),
|
||
'text': 'New Home Assistant release',
|
||
'type': 'text',
|
||
}),
|
||
dict({
|
||
'text': '''
|
||
|
||
2.
|
||
''',
|
||
'type': 'text',
|
||
}),
|
||
dict({
|
||
'citations': list([
|
||
dict({
|
||
'cited_text': 'Breaking news from around the world today includes major events in technology, politics, and culture...',
|
||
'encrypted_index': 'AQE=',
|
||
'title': 'Breaking News',
|
||
'type': 'web_search_result_location',
|
||
'url': 'https://www.newssite.com/breaking-news',
|
||
}),
|
||
dict({
|
||
'cited_text': 'Well, this happened...',
|
||
'encrypted_index': 'AgI=',
|
||
'title': 'Breaking News',
|
||
'type': 'web_search_result_location',
|
||
'url': 'https://www.newssite.com/breaking-news',
|
||
}),
|
||
]),
|
||
'text': 'Something incredible happened',
|
||
'type': 'text',
|
||
}),
|
||
dict({
|
||
'text': '''
|
||
|
||
Those are the main headlines making news today.
|
||
''',
|
||
'type': 'text',
|
||
}),
|
||
]),
|
||
'role': 'assistant',
|
||
}),
|
||
])
|
||
# ---
|
||
# name: test_web_search_dynamic_filtering
|
||
list([
|
||
dict({
|
||
'attachments': None,
|
||
'content': 'Who won the Nobel for Chemistry in 2025?',
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'content': None,
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'native': dict({
|
||
'citation_details': list([
|
||
]),
|
||
'container': None,
|
||
'redacted_thinking': None,
|
||
'thinking_signature': 'ErUBCkYIARgCIkCYXaVNJShe3A86Hp7XUzh9YsCYBbJTbQsrklTAPtJ2sP/NoB6tSzpK/nTL6CjSo2R6n0KNBIg5MH6asM2R/kmaEgyB/X1FtZq5OQAC7jUaDEPWCdcwGQ4RaBy5wiIwmRxExIlDhoY6tILoVPnOExkC/0igZxHEwxK8RU/fmw0b+o+TwAarzUitwzbo21E5Kh3pa3I6yqVROf1t2F8rFocNUeCegsWV/ytwYV+ayA==',
|
||
}),
|
||
'role': 'assistant',
|
||
'thinking_content': 'Let me search for this information.',
|
||
'tool_calls': list([
|
||
dict({
|
||
'external': True,
|
||
'id': 'srvtoolu_01Qh4oTgPkNfRxjJA3N6jgzT',
|
||
'tool_args': dict({
|
||
'code': '''
|
||
|
||
import json
|
||
result = await web_search({"query": "Nobel Prize chemistry 2025 winner"})
|
||
parsed = json.loads(result)
|
||
for r in parsed[:3]:
|
||
print(r.get("title", ""))
|
||
print(r.get("content", "")[:300])
|
||
print("---")
|
||
|
||
''',
|
||
}),
|
||
'tool_name': 'code_execution',
|
||
}),
|
||
dict({
|
||
'external': True,
|
||
'id': 'srvtoolu_016vjte6G4Lj6yzLc2ak1vY4',
|
||
'tool_args': dict({
|
||
'query': 'Nobel Prize chemistry 2025 winner',
|
||
}),
|
||
'tool_name': 'web_search',
|
||
}),
|
||
]),
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'role': 'tool_result',
|
||
'tool_call_id': 'srvtoolu_016vjte6G4Lj6yzLc2ak1vY4',
|
||
'tool_name': 'web_search',
|
||
'tool_result': dict({
|
||
'content': list([
|
||
dict({
|
||
'encrypted_content': 'ABCDEFG',
|
||
'page_age': None,
|
||
'title': 'Press release: Nobel Prize in Chemistry 2025 - Example.com',
|
||
'type': 'web_search_result',
|
||
'url': 'https://www.example.com/prizes/chemistry/2025/press-release/',
|
||
}),
|
||
dict({
|
||
'encrypted_content': 'ABCDEFG',
|
||
'page_age': None,
|
||
'title': 'Nobel Prize in Chemistry 2025 - NewsSite.com',
|
||
'type': 'web_search_result',
|
||
'url': 'https://www.newssite.com/prizes/chemistry/2025/summary/',
|
||
}),
|
||
]),
|
||
}),
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'role': 'tool_result',
|
||
'tool_call_id': 'srvtoolu_01Qh4oTgPkNfRxjJA3N6jgzT',
|
||
'tool_name': 'code_execution',
|
||
'tool_result': dict({
|
||
'content': list([
|
||
]),
|
||
'encrypted_stdout': 'EuQJCioIDRgCIiRj',
|
||
'return_code': 0,
|
||
'stderr': '',
|
||
'type': 'encrypted_code_execution_result',
|
||
}),
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'content': 'The 2025 Nobel Prize in Chemistry was awarded jointly to **Susumu Kitagawa**, **Richard Robson**, and **Omar M. Yaghi** "for the development of metal–organic frameworks."',
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'native': dict({
|
||
'citation_details': list([
|
||
]),
|
||
'container': Container(id='container_1234567890ABCDEFGHIJKLMN', expires_at=HAFakeDatetime(2025, 10, 31, 12, 5, tzinfo=datetime.timezone.utc)),
|
||
'redacted_thinking': None,
|
||
'thinking_signature': None,
|
||
}),
|
||
'role': 'assistant',
|
||
'thinking_content': None,
|
||
'tool_calls': None,
|
||
}),
|
||
])
|
||
# ---
|
||
# name: test_web_search_dynamic_filtering.1
|
||
list([
|
||
dict({
|
||
'content': 'Who won the Nobel for Chemistry in 2025?',
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'content': list([
|
||
dict({
|
||
'signature': 'ErUBCkYIARgCIkCYXaVNJShe3A86Hp7XUzh9YsCYBbJTbQsrklTAPtJ2sP/NoB6tSzpK/nTL6CjSo2R6n0KNBIg5MH6asM2R/kmaEgyB/X1FtZq5OQAC7jUaDEPWCdcwGQ4RaBy5wiIwmRxExIlDhoY6tILoVPnOExkC/0igZxHEwxK8RU/fmw0b+o+TwAarzUitwzbo21E5Kh3pa3I6yqVROf1t2F8rFocNUeCegsWV/ytwYV+ayA==',
|
||
'thinking': 'Let me search for this information.',
|
||
'type': 'thinking',
|
||
}),
|
||
dict({
|
||
'id': 'srvtoolu_01Qh4oTgPkNfRxjJA3N6jgzT',
|
||
'input': dict({
|
||
'code': '''
|
||
|
||
import json
|
||
result = await web_search({"query": "Nobel Prize chemistry 2025 winner"})
|
||
parsed = json.loads(result)
|
||
for r in parsed[:3]:
|
||
print(r.get("title", ""))
|
||
print(r.get("content", "")[:300])
|
||
print("---")
|
||
|
||
''',
|
||
}),
|
||
'name': 'code_execution',
|
||
'type': 'server_tool_use',
|
||
}),
|
||
dict({
|
||
'id': 'srvtoolu_016vjte6G4Lj6yzLc2ak1vY4',
|
||
'input': dict({
|
||
'query': 'Nobel Prize chemistry 2025 winner',
|
||
}),
|
||
'name': 'web_search',
|
||
'type': 'server_tool_use',
|
||
}),
|
||
dict({
|
||
'content': list([
|
||
dict({
|
||
'encrypted_content': 'ABCDEFG',
|
||
'page_age': None,
|
||
'title': 'Press release: Nobel Prize in Chemistry 2025 - Example.com',
|
||
'type': 'web_search_result',
|
||
'url': 'https://www.example.com/prizes/chemistry/2025/press-release/',
|
||
}),
|
||
dict({
|
||
'encrypted_content': 'ABCDEFG',
|
||
'page_age': None,
|
||
'title': 'Nobel Prize in Chemistry 2025 - NewsSite.com',
|
||
'type': 'web_search_result',
|
||
'url': 'https://www.newssite.com/prizes/chemistry/2025/summary/',
|
||
}),
|
||
]),
|
||
'tool_use_id': 'srvtoolu_016vjte6G4Lj6yzLc2ak1vY4',
|
||
'type': 'web_search_tool_result',
|
||
}),
|
||
dict({
|
||
'content': dict({
|
||
'content': list([
|
||
]),
|
||
'encrypted_stdout': 'EuQJCioIDRgCIiRj',
|
||
'return_code': 0,
|
||
'stderr': '',
|
||
'type': 'encrypted_code_execution_result',
|
||
}),
|
||
'tool_use_id': 'srvtoolu_01Qh4oTgPkNfRxjJA3N6jgzT',
|
||
'type': 'code_execution_tool_result',
|
||
}),
|
||
dict({
|
||
'text': 'The 2025 Nobel Prize in Chemistry was awarded jointly to **Susumu Kitagawa**, **Richard Robson**, and **Omar M. Yaghi** "for the development of metal–organic frameworks."',
|
||
'type': 'text',
|
||
}),
|
||
]),
|
||
'role': 'assistant',
|
||
}),
|
||
])
|
||
# ---
|
||
# name: test_web_search_error
|
||
list([
|
||
dict({
|
||
'attachments': None,
|
||
'content': "What's on the news today?",
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'content': "To get today's news, I'll perform a web search",
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'native': dict({
|
||
'citation_details': list([
|
||
]),
|
||
'container': None,
|
||
'redacted_thinking': None,
|
||
'thinking_signature': 'ErUBCkYIARgCIkCYXaVNJShe3A86Hp7XUzh9YsCYBbJTbQsrklTAPtJ2sP/NoB6tSzpK/nTL6CjSo2R6n0KNBIg5MH6asM2R/kmaEgyB/X1FtZq5OQAC7jUaDEPWCdcwGQ4RaBy5wiIwmRxExIlDhoY6tILoVPnOExkC/0igZxHEwxK8RU/fmw0b+o+TwAarzUitwzbo21E5Kh3pa3I6yqVROf1t2F8rFocNUeCegsWV/ytwYV+ayA==',
|
||
}),
|
||
'role': 'assistant',
|
||
'thinking_content': "The user is asking about today's news, which requires current, real-time information. This is clearly something that requires recent information beyond my knowledge cutoff. I should use the web_search tool to find today's news.",
|
||
'tool_calls': list([
|
||
dict({
|
||
'external': True,
|
||
'id': 'srvtoolu_12345ABC',
|
||
'tool_args': dict({
|
||
'query': "today's news",
|
||
}),
|
||
'tool_name': 'web_search',
|
||
}),
|
||
]),
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'role': 'tool_result',
|
||
'tool_call_id': 'srvtoolu_12345ABC',
|
||
'tool_name': 'web_search',
|
||
'tool_result': dict({
|
||
'error_code': 'too_many_requests',
|
||
'type': 'web_search_tool_result_error',
|
||
}),
|
||
}),
|
||
dict({
|
||
'agent_id': 'conversation.claude_conversation',
|
||
'content': 'I am unable to perform the web search at this time.',
|
||
'created': HAFakeDatetime(2025, 10, 31, 12, 0, tzinfo=datetime.timezone.utc),
|
||
'native': None,
|
||
'role': 'assistant',
|
||
'thinking_content': None,
|
||
'tool_calls': None,
|
||
}),
|
||
])
|
||
# ---
|
||
# name: test_web_search_error.1
|
||
list([
|
||
dict({
|
||
'content': "What's on the news today?",
|
||
'role': 'user',
|
||
}),
|
||
dict({
|
||
'content': list([
|
||
dict({
|
||
'signature': 'ErUBCkYIARgCIkCYXaVNJShe3A86Hp7XUzh9YsCYBbJTbQsrklTAPtJ2sP/NoB6tSzpK/nTL6CjSo2R6n0KNBIg5MH6asM2R/kmaEgyB/X1FtZq5OQAC7jUaDEPWCdcwGQ4RaBy5wiIwmRxExIlDhoY6tILoVPnOExkC/0igZxHEwxK8RU/fmw0b+o+TwAarzUitwzbo21E5Kh3pa3I6yqVROf1t2F8rFocNUeCegsWV/ytwYV+ayA==',
|
||
'thinking': "The user is asking about today's news, which requires current, real-time information. This is clearly something that requires recent information beyond my knowledge cutoff. I should use the web_search tool to find today's news.",
|
||
'type': 'thinking',
|
||
}),
|
||
dict({
|
||
'text': "To get today's news, I'll perform a web search",
|
||
'type': 'text',
|
||
}),
|
||
dict({
|
||
'id': 'srvtoolu_12345ABC',
|
||
'input': dict({
|
||
'query': "today's news",
|
||
}),
|
||
'name': 'web_search',
|
||
'type': 'server_tool_use',
|
||
}),
|
||
dict({
|
||
'content': dict({
|
||
'error_code': 'too_many_requests',
|
||
'type': 'web_search_tool_result_error',
|
||
}),
|
||
'tool_use_id': 'srvtoolu_12345ABC',
|
||
'type': 'web_search_tool_result',
|
||
}),
|
||
dict({
|
||
'text': 'I am unable to perform the web search at this time.',
|
||
'type': 'text',
|
||
}),
|
||
]),
|
||
'role': 'assistant',
|
||
}),
|
||
])
|
||
# ---
|