Superplatform旨在将AI时代的力量还给开发者——自行托管自己的AI平台!
运行 Superplatform 最简单的方法是使用 Docker。如果没有 Docker,请安装它。进入 repo root 并:
docker compose up
在前台运行平台。如果您按 Ctrl+C,它就会停止运行。如果你想在后台运行它:
docker compose up -d
现在超级平台正在运行,您有几个与之交互的选项。
您可以访问http://127.0.0.1:3901
并使用用户名singulatron
和密码changeme
登录,然后开始使用它,就像使用ChatGPT一样。
单击大“AI”按钮并首先下载模型。不用担心,此模型将在重新启动后保留(请参阅 docker-compose.yaml 中的卷)。
为简洁起见,下面的示例假设您已转到 UI 并下载了模型。 (也可以与客户一起完成,但时间会更长)。
让我们用 JS 来做一个同步提示。在你的项目中运行
npm i -s @superplatform/client
确保你的package.json
包含"type": "module"
,将以下代码片段放入index.js
import { UserSvcApi , PromptSvcApi , Configuration } from "@superplatform/client" ;
async function testDrive ( ) {
let userService = new UserSvcApi ( ) ;
let loginResponse = await userService . login ( {
request : {
slug : "singulatron" ,
password : "changeme" ,
} ,
} ) ;
const promptSvc = new PromptSvcApi (
new Configuration ( {
apiKey : loginResponse . token ?. token ,
} )
) ;
let promptRsp = await promptSvc . addPrompt ( {
request : {
sync : true ,
prompt : "Is a cat an animal? Just answer with yes or no please." ,
} ,
} ) ;
console . log ( promptRsp ) ;
}
testDrive ( ) ;
并运行
$ node index.js
{
answer: ' Yes, a cat is an animal.n ' +
' n ' +
' But if you meant to ask whether cats are domesticated animals or pets, then the answer is also yes. Cats belong to the Felidae family and are common household pets around the world. They are often kept for companionship and to control rodent populations. ' ,
prompt: undefined
}
根据您的系统,人工智能可能需要一段时间才能做出响应。如果需要很长时间检查后端日志是否正在处理,您应该看到如下内容:
superplatform-backend-1 | { " time " : " 2024-11-27T17:27:14.602762664Z " , " level " : " DEBUG " , " msg " : " LLM is streaming " , " promptId " : " prom_e3SA9bJV5u " , " responsesPerSecond " :1, " totalResponses " :1}
superplatform-backend-1 | { " time " : " 2024-11-27T17:27:15.602328634Z " , " level " : " DEBUG " , " msg " : " LLM is streaming " , " promptId " : " prom_e3SA9bJV5u " , " responsesPerSecond " :4, " totalResponses " :9}
superplatform-backend-1 | { " time " : " 2024-11-27T17:27:16.602428481Z " , " level " : " DEBUG " , " msg " : " LLM is streaming " , " promptId " : " prom_e3SA9bJV5u " , " responsesPerSecond " :5, " totalResponses " :17}
superplatform-backend-1 | { " time " : " 2024-11-27T17:27:17.602586968Z " , " level " : " DEBUG " , " msg " : " LLM is streaming " , " promptId " : " prom_e3SA9bJV5u " , " responsesPerSecond " :6, " totalResponses " :24}
superplatform-backend-1 | { " time " : " 2024-11-27T17:27:18.602583176Z " , " level " : " DEBUG " , " msg " : " LLM is streaming " , " promptId " : " prom_e3SA9bJV5u " , " responsesPerSecond " :6, " totalResponses " :31}
superplatform-backend-1 | { " time " : " 2024-11-27T17:27:19.602576641Z " , " level " : " DEBUG " , " msg " : " LLM is streaming " , " promptId " : " prom_e3SA9bJV5u " , " responsesPerSecond " :6, " totalResponses " :38}
superplatform-backend-1 | { " time " : " 2024-11-27T17:27:20.602284446Z " , " level " : " DEBUG " , " msg " : " LLM is streaming " , " promptId " : " prom_e3SA9bJV5u " , " responsesPerSecond " :6, " totalResponses " :46}
superplatform-backend-1 | { " time " : " 2024-11-27T17:27:21.602178149Z " , " level " : " DEBUG " , " msg " : " LLM is streaming " , " promptId " : " prom_e3SA9bJV5u " , " responsesPerSecond " :6, " totalResponses " :53}
superplatform-backend-1 | { " time " : " 2024-11-27T17:27:22.602470024Z " , " level " : " DEBUG " , " msg " : " LLM is streaming " , " promptId " : " prom_e3SA9bJV5u " , " responsesPerSecond " :6, " totalResponses " :61}
superplatform-backend-1 | { " time " : " 2024-11-27T17:27:23.174054316Z " , " level " : " INFO " , " msg " : " Saving chat message " , " messageId " : " msg_e3SARBJAZe " }
superplatform-backend-1 | { " time " : " 2024-11-27T17:27:23.175854857Z " , " level " : " DEBUG " , " msg " : " Event published " , " eventName " : " chatMessageAdded " }
superplatform-backend-1 | { " time " : " 2024-11-27T17:27:23.176260122Z " , " level " : " DEBUG " , " msg " : " Finished streaming LLM " , " error " : " <nil> " }
Superplatform 是一个微服务平台,我第一次想到是在 2013 年,当时我正在为 Uber 的竞争对手 Hailo 工作。我搁置了这个想法,认为其他人最终会实现它。现在,随着人工智能的繁荣和我们即将推出的所有人工智能应用程序,我意识到我必须自己构建它,因为没有其他人这样做。
它是一个服务器和生态系统,使您能够自行托管人工智能模型,构建以任何语言利用这些模型的应用程序,并利用旨在支持各种项目的基于微服务的公共后端。
请参阅此页面以帮助您入门。
请参阅 https://superplatform.ai/docs/category/superplatform-api/
我们已暂时停止分发桌面版本。请参阅此页面了解运行该软件的替代方法。
Superplatform 根据 AGPL-3.0 获得许可。