refactor: move API to standardized pydantic schemas across CLI, Python client, REST server (#1579)
Co-authored-by: cpacker <packercharles@gmail.com> Co-authored-by: matthew zhou <matthewzhou@matthews-MacBook-Pro.local> Co-authored-by: Zack Field <field.zackery@gmail.com>
This commit is contained in:
@@ -1,17 +1,12 @@
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
subprocess.check_call([sys.executable, "-m", "pip", "install", "pexpect"])
|
||||
import pexpect
|
||||
from prettytable.colortable import ColorTable
|
||||
|
||||
from memgpt.cli.cli_config import ListChoice, add, delete
|
||||
from memgpt.cli.cli_config import list as list_command
|
||||
|
||||
from .constants import TIMEOUT
|
||||
from .utils import create_config
|
||||
|
||||
# def test_configure_memgpt():
|
||||
# configure_memgpt()
|
||||
|
||||
@@ -47,41 +42,3 @@ def test_cli_config():
|
||||
assert "test data" in row
|
||||
# delete
|
||||
delete(option=option, name="test")
|
||||
|
||||
|
||||
def test_save_load():
|
||||
# configure_memgpt() # rely on configure running first^
|
||||
if os.getenv("OPENAI_API_KEY"):
|
||||
create_config("openai")
|
||||
else:
|
||||
create_config("memgpt_hosted")
|
||||
|
||||
child = pexpect.spawn("poetry run memgpt run --agent test_save_load --first --strip-ui")
|
||||
|
||||
child.expect("Enter your message:", timeout=TIMEOUT)
|
||||
child.sendline()
|
||||
|
||||
child.expect("Empty input received. Try again!", timeout=TIMEOUT)
|
||||
child.sendline("/save")
|
||||
|
||||
child.expect("Enter your message:", timeout=TIMEOUT)
|
||||
child.sendline("/exit")
|
||||
|
||||
child.expect(pexpect.EOF, timeout=TIMEOUT) # Wait for child to exit
|
||||
child.close()
|
||||
assert child.isalive() is False, "CLI should have terminated."
|
||||
assert child.exitstatus == 0, "CLI did not exit cleanly."
|
||||
|
||||
child = pexpect.spawn("poetry run memgpt run --agent test_save_load --first --strip-ui")
|
||||
child.expect("Using existing agent test_save_load", timeout=TIMEOUT)
|
||||
child.expect("Enter your message:", timeout=TIMEOUT)
|
||||
child.sendline("/exit")
|
||||
child.expect(pexpect.EOF, timeout=TIMEOUT) # Wait for child to exit
|
||||
child.close()
|
||||
assert child.isalive() is False, "CLI should have terminated."
|
||||
assert child.exitstatus == 0, "CLI did not exit cleanly."
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# test_configure_memgpt()
|
||||
test_save_load()
|
||||
|
||||
Reference in New Issue
Block a user