mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-13 21:47:12 +00:00
agent serialization (#4642)
This commit is contained in:
19
tests/unit_tests/agents/test_serialization.py
Normal file
19
tests/unit_tests/agents/test_serialization.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from pathlib import Path
|
||||
from tempfile import TemporaryDirectory
|
||||
|
||||
from langchain.agents.agent_types import AgentType
|
||||
from langchain.agents.initialize import initialize_agent, load_agent
|
||||
from langchain.llms.fake import FakeListLLM
|
||||
|
||||
|
||||
def test_mrkl_serialization() -> None:
|
||||
agent = initialize_agent(
|
||||
[],
|
||||
FakeListLLM(responses=[]),
|
||||
agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
|
||||
verbose=True,
|
||||
)
|
||||
with TemporaryDirectory() as tempdir:
|
||||
file = Path(tempdir) / "agent.json"
|
||||
agent.save_agent(file)
|
||||
load_agent(file)
|
Reference in New Issue
Block a user