ARTICLE DETAIL

资讯详情

深耕郑州网站建设与运营推广的一线实战洞察。

Supermemory local 如何在本地安装并写入、搜索第一条记忆

Supermemory local 如何在本地安装并写入、搜索第一条记忆 Supermemory local 如何在本地安装并写入、搜索第一条记忆【免费下载链接】supermemoryMemory and context engine app that is extremely fast, scalable, and can be run fully locally. The Memory API for the AI era.项目地址: https://gitcode.com/GitHub_Trending/su/supermemorySupermemory 提供了名为Supermemory local的自托管单二进制版本在你自己的机器上跑起一套完整的记忆引擎内置图引擎、本地向量模型和完整 Memory API不需要 Docker、不需要单独部署数据库、也没有配置文件要写。本文的目标是一条最短路径安装二进制 → 启动本地服务 → 写入第一条记忆 → 用搜索把它取回来。适用平台以文档为准macOSApple Silicon Intel、Linuxx64 arm64。安装器会检测你的 OS 与架构并下载对应二进制。准备安装二进制三条安装方式任选其一来自 Self-Hosting Quickstartcurl -fsSL https://supermemory.ai/install | bashnpx supermemory localbunx supermemory local安装器会检测系统、下载正确的二进制并做校验交互式运行时还会提示你输入一个 LLM API key。如果以后需要安装或回滚到指定版本可以给安装脚本传版本号curl -fsSL https://supermemory.ai/install | bash -s -- 0.0.3注意回滚之前先备份数据目录——安装器只替换二进制较新的发布写入的数据或 schema 可能不被旧版服务理解。启动服务器拿到 API keysupermemory-server首次启动会自动完成全部初始化创建内置的 Supermemory 图引擎、加载本地 embedding 模型、生成你的凭据。终端会打印类似下面的信息以下为文档示例输出┌──────────────────────────────────────────────────┐ │ url http://localhost:6767 │ │ database ./.supermemory │ │ api key sm_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx │ │ org id xxxxxxxxxxxxxxxxxxxxxx │ └──────────────────────────────────────────────────┘保存这个 API key——它是之后所有请求的 bearer token。关于首次启动时的两个交互/配置点LLM key自托管版本里摘要、上下文切块和记忆提取这些智能步骤依赖你自带的模型。如果未设置任何 provider key首次启动会进入交互向导选择 providerOpenAI、Anthropic、Gemini、Groq或 Ollama 等任何 OpenAI 兼容端点、粘贴 key加密保存后每次启动自动加载写入~/.supermemory/env。Embedding 模型向导最后可选一步按 Enter 即保留本地默认的Xenova/bge-base-en-v1.5768 维无需任何 key。非交互场景Docker/CI没有 TTY 也就没有向导需要通过环境变量提供 key如果不想用本地 embedding则设置SUPERMEMORY_EMBEDDING_PROVIDER/MODEL/DIMENSIONS。各环境变量的完整说明见 Self-Hosting Configuration。写入第一条记忆服务监听在http://localhost:6767。下面的 curl 是最短主路径无需安装任何 SDK其中sm_...要替换为你首次启动时打印的那个 API key。containerTag是记忆分组标签写入和搜索要用同一个值curl http://localhost:6767/v3/documents \ -H Authorization: Bearer sm_... \ -H Content-Type: application/json \ -d { content: I am Dhravya. I love building dev tools and I am allergic to peanuts., containerTag: user_dhravya }如果你已经在用 TypeScript 或 Python SDK也可以把baseURL指向本地服务用同一套 APIimport Supermemory from supermemory const client new Supermemory({ apiKey: sm_..., // 替换为首次启动打印的 key baseURL: http://localhost:6767, }) await client.memories.add({ content: Im Dhravya. I love building dev tools and Im allergic to peanuts., containerTag: user_dhravya, })from supermemory import Supermemory client Supermemory( api_keysm_..., # 替换为首次启动打印的 key base_urlhttp://localhost:6767, ) client.memories.add( contentIm Dhravya. I love building dev tools and Im allergic to peanuts., container_taguser_dhravya, )确认写入完成再搜索文档说明POST /v3/documents的写入请求毫秒级返回状态为queued提取、向量化和索引在后台按队列进行搜索前需等到done。用文档 ID 轮询状态即可DOC_ID换成上一步响应中的文档 idcurl http://localhost:6767/v3/documents/DOC_ID \ -H Authorization: Bearer sm_...重复请求直到返回status: done为止。短文本通常几秒内完成大文件如 PDF会更久。搜索这条记忆状态为done后用同一个containerTag发起搜索curl http://localhost:6767/v3/search \ -H Authorization: Bearer sm_... \ -H Content-Type: application/json \ -d { q: what food should I avoid?, containerTag: user_dhravya }SDK 写法等价const results await client.search({ q: what food should I avoid?, containerTag: user_dhravya, })results client.search( qwhat food should I avoid?, container_taguser_dhravya, )响应是包含results数组的 JSONQuickstart 给出的一个简化示例形状如下文档示例字段值仅作演示不要当作固定预期{ results: [ { memory: I am allergic to peanuts, similarity: 0.81 } ], timing: 287 }能搜回你写入的那条内容说明本地实例的安装、写入、检索整条链路都已打通。数据在哪里默认所有状态集中在一个可备份、可搬走的目录来自 Quickstart路径内容./.supermemory/或$SUPERMEMORY_DATA_DIR图引擎数据、auth secret、embedding 模型缓存~/.supermemory/env安装器/向导保存的 API key每次启动自动加载限制与边界文本写入、记忆提取和搜索支持任意 LLM provider但图片、视频和高保真 PDF 理解需要 Gemini 或 Vertex AI 的 key见 Configuration。需要完全离线时可以用OPENAI_BASE_URL/OPENAI_API_KEY/OPENAI_MODEL指向 Ollama 等本地 OpenAI 兼容端点配本地 embedding 实现全链路本地运行示例见 Self-Hosting Overview。Connectors、Supermemory MCP 等功能仅在托管平台可用自托管二进制不包含见 Configuration。下一步Configuration全部环境变量——LLM providers、本地模型、性能调优Embeddings本地默认、OpenAI / Gemini / Ollama、多语言Quickstart完整 Memory API——documents、memories、user profiles、spaces全部对你的本地服务同样生效【免费下载链接】supermemoryMemory and context engine app that is extremely fast, scalable, and can be run fully locally. The Memory API for the AI era.项目地址: https://gitcode.com/GitHub_Trending/su/supermemory创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考
返回列表