llmapi server
1.0.0
Self-Host LLMAPI-Server
中文文档
LLMAPI-Server ist ein abstraktes Backend, das eine Vielzahl von großsprachigen Modellen (LLM wie ChatGPT, GPT-3, GPT-4 usw.) zusammenfasst und einfache Zugangsdienste über OpenAPI bietet
? Wenn es Ihnen hilfreich ist, spiele es bitte mit?
Graph LR
Subgraph LLMAPI -Server
OpenAPI -> Sitzung
OpenAPI -> PRE_POST
Subgraph Backend
Style Backend Fill:#F9F
PRE_POST-> CHATGPT
pre_post-> dall-e
PRE_POST-> LAMA
pre_post-> ...
Ende
Ende
Text-> OpenAPI
Bild-> OpenAPI
Einbettung-> OpenAPI
Andere-> OpenAPI
chatgpt : OpenAs offizielle Chatgpt -Oberfläche gpt3 : OpenAs offizielle GPT-3-Schnittstelle gpt-embedding : OpenAs offizielle Einbettungsschnittstelle dall-e : OpenAs offizieller Dall · E-Schnittstelle welm : Wechats LLM -Schnittstelle newbing : Neue Bing -Suche basierend auf Chatgpt (Inoffiziell) # python >= 3.8
python3 -m pip install -r requirements.txt
python3 run_api_server.py./build_docker.sh
./start_docker.shcurl , um zugreifen zu können: # 1. Start a new session
curl -X POST -H " Content-Type: application/json " -d ' {"bot_type":"mock"} ' http://127.0.0.1:5050/v1/chat/start
# response sample: {"code":0,"msg":"Success","session":"123456"}
# 2. chat with LLMs
curl -X POST -H " Content-Type: application/json " -d ' {"session":"123456","content":"hello"} ' http://127.0.0.1:5050/v1/chat/ask
# response sample: {"code":0,"msg":"Success","reply":"Text mock reply for your prompt:hello","timestamp":1678865301.0842562}
# 3. Close the session and end chat
curl -X POST -H " Content-Type: application/json " -d ' {"session":"123456"} ' http://127.0.0.1:5050/v1/chat/end
# response: {"code":0,"msg":"Success"}llmapi_cli --host= " http://127.0.0.1:5050 " --bot=mock from llmapi_cli import LLMClient
client = LLMClient ( host = "http://127.0.0.1:5050" , bot = "mock" )
rep = client . ask ( "hello" )
print ( rep )cp -r mock newllm erstellen (angenommen von newllmmock den Backend -Namen in newllmnewllm -Verzeichnis die erforderlichen Abhängigkeiten hinzu, und alle damit verbundenen Entwicklung sind an dieses Verzeichnis gebundennewllm in backend.py hinzu