Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
EItanya committed Feb 5, 2025
1 parent 0e6b107 commit da526f3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
10 changes: 7 additions & 3 deletions python/packages/autogen-agentchat/tests/test_assistant_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import logging
from typing import Any, AsyncGenerator, List

from autogen_core._component_config import ComponentModel
import pytest
from autogen_agentchat import EVENT_LOGGER_NAME
from autogen_agentchat.agents import AssistantAgent
Expand All @@ -19,7 +18,7 @@
ToolCallRequestEvent,
ToolCallSummaryMessage,
)
from autogen_core import FunctionCall, Image
from autogen_core import ComponentModel, FunctionCall, Image
from autogen_core.memory import ListMemory, Memory, MemoryContent, MemoryMimeType, MemoryQueryResult
from autogen_core.model_context import BufferedChatCompletionContext
from autogen_core.models import (
Expand Down Expand Up @@ -755,7 +754,12 @@ async def test_run_with_memory(monkeypatch: pytest.MonkeyPatch) -> None:
"test_agent", model_client=OpenAIChatCompletionClient(model=model, api_key=""), memory=[memory2]
)

result = await agent.run(task="test task")
# Test dump and load component with memory
agent_config: ComponentModel = agent.dump_component()
assert agent_config.provider == "autogen_agentchat.agents.AssistantAgent"
agent2 = AssistantAgent.load_component(agent_config)

result = await agent2.run(task="test task")
assert len(result.messages) > 0
memory_event = next((msg for msg in result.messages if isinstance(msg, MemoryQueryEvent)), None)
assert memory_event is not None
Expand Down
3 changes: 1 addition & 2 deletions python/packages/autogen-core/tests/test_memory.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from typing import Any

import pytest
from autogen_core import CancellationToken
from autogen_core._component_config import ComponentModel
from autogen_core import CancellationToken, ComponentModel
from autogen_core.memory import (
ListMemory,
Memory,
Expand Down

0 comments on commit da526f3

Please sign in to comment.