演示了使用SQLiteSession进行基本会话内存管理,以实现自动对话历史记录。
.to_input_list()安装OpenAI Agents SDK:
pip install openai-agents
设置环境:
cp ../env.example .env # Edit .env and add your OpenAI API key
运行代理:
import asyncio from agent import in_memory_session_example, persistent_session_example # Test in-memory sessions asyncio.run(in_memory_session_example()) # Test persistent sessions asyncio.run(persistent_session_example())
免责声明:
本文档采用基于机器的 AI 翻译服务进行翻译。尽管我们力求准确,但请注意,自动翻译可能存在错误或不准确之处。应以原文语言版本的文档作为权威依据。如需获取关键信息,建议使用专业的人工翻译。对于因使用本翻译而产生的任何误解或误读,我们概不负责。