mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-03 02:11:48 +00:00
36 lines
1.2 KiB
Python
36 lines
1.2 KiB
Python
import pytest
|
|
from acp.schema import ImageContentBlock, TextContentBlock
|
|
|
|
from acp_adapter.server import HermesACPAgent, _content_blocks_to_openai_user_content
|
|
|
|
|
|
def test_acp_image_blocks_convert_to_openai_multimodal_content():
|
|
content = _content_blocks_to_openai_user_content([
|
|
TextContentBlock(type="text", text="What is in this image?"),
|
|
ImageContentBlock(type="image", data="aGVsbG8=", mimeType="image/png"),
|
|
])
|
|
|
|
assert content == [
|
|
{"type": "text", "text": "What is in this image?"},
|
|
{
|
|
"type": "image_url",
|
|
"image_url": {"url": "data:image/png;base64,aGVsbG8="},
|
|
},
|
|
]
|
|
|
|
|
|
def test_text_only_acp_blocks_stay_string_for_legacy_prompt_path():
|
|
content = _content_blocks_to_openai_user_content([
|
|
TextContentBlock(type="text", text="/help"),
|
|
])
|
|
|
|
assert content == "/help"
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_initialize_advertises_image_prompt_capability():
|
|
response = await HermesACPAgent().initialize()
|
|
|
|
assert response.agent_capabilities is not None
|
|
assert response.agent_capabilities.prompt_capabilities is not None
|
|
assert response.agent_capabilities.prompt_capabilities.image is True
|