Files
letta-server/tests/utils.py
Vivian Fang 11326ec24e Remove AsyncAgent and async from cli (#400)
* Remove AsyncAgent and async from cli

Refactor agent.py memory.py

Refactor interface.py

Refactor main.py

Refactor openai_tools.py

Refactor cli/cli.py

stray asyncs

save

make legacy embeddings not use async

Refactor presets

Remove deleted function from import

* remove stray prints

* typo

* another stray print

* patch test

---------

Co-authored-by: cpacker <packercharles@gmail.com>
2023-11-09 14:51:12 -08:00

46 lines
1.3 KiB
Python

import pexpect
from .constants import TIMEOUT
def configure_memgpt(enable_openai=True, enable_azure=False):
child = pexpect.spawn("memgpt configure")
child.expect("Do you want to enable MemGPT with OpenAI?", timeout=TIMEOUT)
if enable_openai:
child.sendline("y")
else:
child.sendline("n")
child.expect("Do you want to enable MemGPT with Azure?", timeout=TIMEOUT)
if enable_azure:
child.sendline("y")
else:
child.sendline("n")
child.expect("Select default inference endpoint:", timeout=TIMEOUT)
child.sendline()
child.expect("Select default embedding endpoint:", timeout=TIMEOUT)
child.sendline()
child.expect("Select default preset:", timeout=TIMEOUT)
child.sendline()
child.expect("Select default model", timeout=TIMEOUT)
child.sendline()
child.expect("Select default persona:", timeout=TIMEOUT)
child.sendline()
child.expect("Select default human:", timeout=TIMEOUT)
child.sendline()
child.expect("Select storage backend for archival data:", timeout=TIMEOUT)
child.sendline()
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."