letta –logo –rgb_greyontransparent_cropped_small.png“> letta -logo -rgb_offblackontranstarent_cropped_small.png“>
letta (以前的记忆)
主页// documentation // ade // letta云
letta是一个开源框架,用于构建具有先进推理能力和透明长期记忆的状态代理。 letta框架是白色框和模型不可替代的。
重要的
寻找记忆?你在正确的地方!
Memgpt软件包和Docker映像已重命名为letta ,以阐明Memgpt代理与运行LLM代理作为服务的letta API服务器/运行时之间的区别。在此处阅读有关Memgpt和letta之间关系的更多信息。
⚡快速启动
使用letta的推荐方法是运行使用Docker。要安装Docker,请参见Docker的安装指南。有关安装Docker的问题,请参见Docker的故障排除指南。您也可以使用PIP安装letta (请参见下面的说明)。
?运行letta服务器
笔记
letta代理生活在letta服务器内,该服务器将它们持续到数据库。您可以通过REST API + PYTHON / TYSPERCRIPT SDK和代理开发环境(图形接口)与letta服务器内部的letta代理进行交互。
letta服务器可以连接到各种LLM API后端(OpenAI,人类,VLLM,Ollama等)。要启用访问这些LLM API提供商,请在使用Docker Run时设置适当的环境变量:
letta/.persist/pgdata` with wherever you want to store your agent data
docker run \\
-v ~/. letta /.persist/pgdata:/var/lib/postgresql/data \\
-p 8283:8283 \\
-e OPENAI_API_KEY=\”your_openai_api_key\” \\
letta / letta :latest\”>
# replace `~/. letta /.persist/pgdata` with wherever you want to store your agent data docker run \\ -v ~ /. letta /.persist/pgdata:/var/lib/postgresql/data \\ -p 8283:8283 \\ -e OPENAI_API_KEY= \" your_openai_api_key \" \\ letta / letta :latest
如果您有许多不同的LLM API键,也可以设置一个.env文件,然后将其传递给Docker运行:
letta/.persist/pgdata:/var/lib/postgresql/data \\
-p 8283:8283 \\
–env-file .env \\
letta / letta :latest\”>
# using a .env file instead of passing environment variables docker run \\ -v ~ /. letta /.persist/pgdata:/var/lib/postgresql/data \\ -p 8283:8283 \\ --env-file .env \\ letta / letta :latest
运行letta服务器后,您可以通过端口8283访问它(例如将REST API请求发送到http:// localhost:8283/v1)。您也可以将服务器连接到Letta Ade,以在Web界面中访问和管理代理。
?访问ADE(代理开发环境)
笔记
要进行ADE的导游,请在YouTube上观看我们的ADE演练,或阅读我们的博客文章和开发人员文档。
letta ADE是用于与letta代理创建,部署,交互和观察的图形用户界面。例如,如果您正在运行letta服务器来为最终用户应用程序供电(例如客户支持聊天机器人),则可以使用ADE测试,调试和观察服务器中的代理。您也可以将ADE用作一般聊天接口与letta代理进行交互。
letta/refs/heads/main/assets/example_ade_screenshot_light.png“>
ADE可以连接到自托管letta服务器(例如,笔记本电脑上运行的letta服务器)以及letta Cloud Service。当连接到自托管 /专用服务器时,ADE使用letta Rest API与您的服务器进行通信。
将ADE连接到您的本地letta服务器
要将ADE与您的本地letta服务器连接,请简单地:
- 启动您的letta服务器(Docker Run …)
- 访问https://app.*l**etta.com,您将在左图中看到“本地服务器”作为选项
letta/refs/heads/main/assets/example_ade_screenshot_agents_light.png“>
?要密码保护您的服务器,请包括Secure = True和letta _Server_Password = yourpassword在您的Docker Run命令中:
letta_SERVER_PASSWORD isn\’t set, the server will autogenerate a password
docker run \\
-v ~/. letta /.persist/pgdata:/var/lib/postgresql/data \\
-p 8283:8283 \\
–env-file .env \\
-e SECURE=true \\
-e letta _SERVER_PASSWORD=yourpassword \\
letta / letta :latest\”>
# If letta _SERVER_PASSWORD isn\'t set, the server will autogenerate a password docker run \\ -v ~ /. letta /.persist/pgdata:/var/lib/postgresql/data \\ -p 8283:8283 \\ --env-file .env \\ -e SECURE=true \\ -e letta _SERVER_PASSWORD=yourpassword \\ letta / letta :latest
将ADE连接到外部(自构建) letta服务器
如果您的letta服务器未在Localhost上运行(例如,您将其部署在EC2之类的外部服务上):
- 单击“添加远程服务器”
- 输入您所需的服务器名称,服务器的IP地址和服务器密码(如果设置)
?经常询问的问题(FAQ)
“我需要安装Docker以使用letta吗?”
不,您可以使用PIP(通过PIP INSTALS -U letta )以及来源(通过诗歌安装)安装letta 。请参阅下面的说明。
“使用PIP与Docker安装有什么区别?”
letta通过将所有代理数据存储在数据库中,从而使您的代理商(无限期地生存)。 letta设计用于与PostgreSQL(世界上最受欢迎的数据库)一起使用,但是,不可能通过PIP安装PostgreSQL,因此PIP安装letta默认值用于使用SQLITE。如果您在自己的计算机上运行了一个PostgreSQL实例,则可以通过设置环境变量letta _pg_uri将letta (通过PIP安装)连接到PostgreSQL。
使用SQLITE时,数据库迁移不正式支持letta ,因此,如果您想确保能够升级到最新的letta版本并迁移letta代理数据,请确保您将Postgresql用作letta数据库后端。完整兼容性表下面:
| 安装方法 | 启动服务器命令 | 数据库后端 | 支持数据迁移? |
|---|---|---|---|
| PIP安装letta | letta服务器 | sqlite | |
| PIP安装letta | 导出letta _pg_uri = … + letta服务器 | Postgresql | ✅ |
| 安装Docker | Docker Run …(完整命令) | Postgresql | ✅ |
“我如何在本地使用ADE?”
要将ADE连接到本地letta服务器,只需运行letta服务器(确保您可以访问LocalHost:8283),然后访问https://app.**let*ta.com。如果您想使用ADE的旧版本(在Localhost上运行),请降级为letta版本<= 0.5.0。
“如果我将ADE连接到本地服务器,我的代理数据是否会上传到letta .com?”
不, letta服务器数据库中的数据停留在您的计算机上。 letta ADE Web应用程序只需连接到您的本地letta服务器(通过REST API),并在其顶部提供图形接口,以在浏览器的本地状态下可视化您的本地letta数据。
“我必须使用您的ADE吗?我可以自己建造吗?”
ADE建立在(完全开源的letta服务器和letta代理API的顶部。您可以在REST API顶部构建自己的应用程序(例如在此处查看文档)。
“我可以通过CLI与letta代理互动吗?”
使用letta的推荐方法是通过REST API和ADE,但是您也可以通过CLI访问代理。
查看运行letta CLI的说明
您可以通过letta CLI工具( letta RUN)与代理商聊天。如果您运行了letta Docker容器,则可以使用Docker Exec在容器内运行letta CLI:
letta container, found via `docker ps`
docker exec -it < letta _container_id> letta run\”>
# replace `< letta _container_id>` with the ID of your letta container, found via `docker ps` docker exec -it < letta _container_id > letta run
您还可以在命令中使用Docker PS来自动找到letta容器的ID:
letta ) letta run\”>
docker exec -it $(docker ps -q -f ancestor= letta / letta ) letta run
在CLI工具中,您将能够创建新代理或加载现有代理:
letta-free [type=openai] [ip=https://inference.*le*t*ta.com]
? Select embedding model: letta -free [type=hugging-face] [ip=https://embeddings.mem**g*pt.ai]
-> ? Using persona profile: \’sam_pov\’
-> ? Using human profile: \’basic\’
-> 8 tools: send_message, pause_heartbeats, conversation_search, conversation_search_date, archival_memory_insert, archival_memory_search, core_memory_append, core_memory_replace
? Created new agent \’InspiringSpinach\’
Hit enter to begin (will request first letta message)
? User engaged. Recognize as Chad. Acknowledge presence and establish connection. Explore interests and engage in meaningful discourse.
? Hello, Chad. It\’s nice to meet you. I am keen on learning and exploring new ideas and concepts. Is there a specific topic you\’d like to discuss today?
> Enter your message: my name is Brad, not Chad…
? A discrepancy in identity. Reflect this change in core memory. Apologize for the oversight, and rectify the error.
⚡? [function] updating memory with core_memory_replace
First name: Chad
→ First name: Brad
? Apologize for the mistake in recognizing his name, and begin the conversation anew, addressing him by the correct name this time.
? I apologize for the oversight, Brad. Let\’s restart. It\’s a pleasure to meet you, Brad. Is there a specific topic you\’d like to discuss today?
> Enter your message:\”>
? Creating new agent...
? Select LLM model: letta -free [type=openai] [ip=https://inference.*le*t*ta.com]
? Select embedding model: letta -free [type=hugging-face] [ip=https://embeddings.mem**g*pt.ai]
-> ? Using persona profile: \'sam_pov\'
-> ? Using human profile: \'basic\'
-> 8 tools: send_message, pause_heartbeats, conversation_search, conversation_search_date, archival_memory_insert, archival_memory_search, core_memory_append, core_memory_replace
? Created new agent \'InspiringSpinach\'
Hit enter to begin (will request first letta message)
? User engaged. Recognize as Chad. Acknowledge presence and establish connection. Explore interests and engage in meaningful discourse.
? Hello, Chad. It\'s nice to meet you. I am keen on learning and exploring new ideas and concepts. Is there a specific topic you\'d like to discuss today?
> Enter your message: my name is Brad, not Chad...
? A discrepancy in identity. Reflect this change in core memory. Apologize for the oversight, and rectify the error.
⚡? [function] updating memory with core_memory_replace
First name: Chad
→ First name: Brad
? Apologize for the mistake in recognizing his name, and begin the conversation anew, addressing him by the correct name this time.
? I apologize for the oversight, Brad. Let\'s restart. It\'s a pleasure to meet you, Brad. Is there a specific topic you\'d like to discuss today?
> Enter your message:
⚡QuickStart(pip)
警告
数据库迁移不受SQLite的正式支持
使用PIP安装letta时,默认数据库后端为SQLITE(您仍然可以通过设置letta _PG_URI来使用letta的PIP安装外部Postgres服务)。
我们不正式支持具有SQLite后端的letta版本之间的迁移,只有Postgres。如果您想将代理数据保留在多个letta版本中,我们强烈建议使用Docker Install方法,这是将Postgres与letta一起使用的最简单方法。
查看使用PIP安装的说明
您也可以使用PIP安装letta ,默认将使用SQLITE用于数据库后端(而Docker默认将使用Postgres)。
步骤1-使用PIP安装letta
pip install -U letta
步骤2-为您选择的LLM /嵌入提供商设置环境变量
export OPENAI_API_KEY=sk-...
对于Ollama(有关如何设置各种提供商的示例,请参见我们的完整文档):
export OLLAMA_BASE_URL=http://l*oc*alhost*:11434
步骤3-运行letta CLI
您可以通过letta CLI工具( letta RUN)创建代理并与他们聊天:
letta run
letta-free [type=openai] [ip=https://inference.*le*t*ta.com]
? Select embedding model: letta -free [type=hugging-face] [ip=https://embeddings.mem**g*pt.ai]
-> ? Using persona profile: \’sam_pov\’
-> ? Using human profile: \’basic\’
-> 8 tools: send_message, pause_heartbeats, conversation_search, conversation_search_date, archival_memory_insert, archival_memory_search, core_memory_append, core_memory_replace
? Created new agent \’InspiringSpinach\’
Hit enter to begin (will request first letta message)
? User engaged. Recognize as Chad. Acknowledge presence and establish connection. Explore interests and engage in meaningful discourse.
? Hello, Chad. It\’s nice to meet you. I am keen on learning and exploring new ideas and concepts. Is there a specific topic you\’d like to discuss today?
> Enter your message: my name is Brad, not Chad…
? A discrepancy in identity. Reflect this change in core memory. Apologize for the oversight, and rectify the error.
⚡? [function] updating memory with core_memory_replace
First name: Chad
→ First name: Brad
? Apologize for the mistake in recognizing his name, and begin the conversation anew, addressing him by the correct name this time.
? I apologize for the oversight, Brad. Let\’s restart. It\’s a pleasure to meet you, Brad. Is there a specific topic you\’d like to discuss today?
> Enter your message:\”>
? Creating new agent...
? Select LLM model: letta -free [type=openai] [ip=https://inference.*le*t*ta.com]
? Select embedding model: letta -free [type=hugging-face] [ip=https://embeddings.mem**g*pt.ai]
-> ? Using persona profile: \'sam_pov\'
-> ? Using human profile: \'basic\'
-> 8 tools: send_message, pause_heartbeats, conversation_search, conversation_search_date, archival_memory_insert, archival_memory_search, core_memory_append, core_memory_replace
? Created new agent \'InspiringSpinach\'
Hit enter to begin (will request first letta message)
? User engaged. Recognize as Chad. Acknowledge presence and establish connection. Explore interests and engage in meaningful discourse.
? Hello, Chad. It\'s nice to meet you. I am keen on learning and exploring new ideas and concepts. Is there a specific topic you\'d like to discuss today?
> Enter your message: my name is Brad, not Chad...
? A discrepancy in identity. Reflect this change in core memory. Apologize for the oversight, and rectify the error.
⚡? [function] updating memory with core_memory_replace
First name: Chad
→ First name: Brad
? Apologize for the mistake in recognizing his name, and begin the conversation anew, addressing him by the correct name this time.
? I apologize for the oversight, Brad. Let\'s restart. It\'s a pleasure to meet you, Brad. Is there a specific topic you\'d like to discuss today?
> Enter your message:
步骤4-运行letta服务器
您可以使用letta服务器启动letta API服务器(请参阅此处的完整API参考):
letta server
Initializing database... Running: uvicorn server:app --host localhost --port 8283 INFO: Started server process [47750] INFO: Waiting for application startup. INFO: Application startup complete. INFO: Uvicorn running on http://*local*host*:8283 (Press CTRL+C to quit)
?如何贡献
letta是一个由一百多名贡献者构建的开源项目。有很多方法可以参与letta OSS项目!
- 为该项目做出贡献:有兴趣贡献吗?首先阅读我们的贡献指南。
- 提出一个问题:加入我们的社区,讨论不和谐,并将您的问题引向#Suppport频道。
- 报告问题或建议功能:有问题或功能请求吗?请通过我们的GitHub问题页面提交它们。
- 探索路线图:对未来发展感到好奇?查看和评论我们的项目路线图。
- 加入社区活动:随着活动日历的更新或遵循我们的Twitter帐户。
法律通知:通过使用letta和相关的letta服务(例如letta端点或托管服务),您同意我们的隐私政策和服务条款。
