llmapi server
1.0.0
Servidor LLMAPI de auto-anfitrión
中文文档
LLMAPI-Merver es un backend abstracto que encapsula una variedad de modelos de idiomas grandes (LLM, como ChatGPT, GPT-3, GPT-4, etc.), y proporciona servicios de acceso simples a través de OpenAPI
? Si es útil para usted, ¿por favor, estre a la estrella?
Gráfico LR
Subgraph LLMapi Server
Openapi -> Sesión
Openapi -> pre_post
backend subgrafio
Estilos de backend llenado:#F9F
pre_post-> chatgpt
pre_post-> dall-e
pre_post-> Llama
pre_post-> ...
fin
fin
Texto-> Openapi
Imagen-> Openapi
Incrustación-> Openapi
Otros-> Openapi
chatgpt : interfaz ChatGPT oficial de OpenAI gpt3 : Interfaz GPT-3 oficial de Openai gpt-embedding : interfaz oficial de incrustación de OpenAI dall-e : interfaz oficial de OpenAi Dall · e welm : interfaz LLM de WeChat newbing : nueva búsqueda de bing basada en chatgpt (no oficial) # python >= 3.8
python3 -m pip install -r requirements.txt
python3 run_api_server.py./build_docker.sh
./start_docker.shcurl para acceder: # 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 )newllm ), puede directamente cp -r mock newllmmock , cambie el nombre del backend a newllmnewllm , agregue las dependencias necesarias y todo el desarrollo relacionado está vinculado a este directorionewllm en backend.py