from pathlib import Path from .dump import dump # noqa: F401 def safe_abs_path(res): "Gives an abs path, which safely returns a full (not 8.3) windows path" res = Path(res).resolve() return str(res) def show_messages(messages, title=None, functions=None): if title: print(title.upper(), "*" * 50) for msg in messages: role = msg["role"].upper() content = msg.get("content") if content: for line in content.splitlines(): print(role, line) content = msg.get("function_call") if content: print(role, content) if functions: dump(functions)