llmapi server
1.0.0
셀프 호스트 LLMAPI 서버
中文文档
llmapi-server는 다양한 대형 언어 모델 (Chatgpt, GPT-3, GPT-4 등과 같은 LLM)을 캡슐화하고 OpenAPI를 통해 간단한 액세스 서비스를 제공하는 추상적 인 백엔드입니다.
? 도움이된다면 별표를 해주세요.
그래프 lr
서브 그래프 llmapi 서버
OpenApi-> 세션
OpenApi-> pre_post
서브 그래프 백엔드
스타일 백엔드 채우기 :#f9f
pre_post-> chatgpt
pre_post-> dall-e
pre_post-> llama
pre_post-> ...
끝
끝
텍스트-> OpenApi
이미지-> OpenApi
임베딩-> OpenApi
기타-> OpenApi
chatgpt : OpenAi의 공식 chatgpt 인터페이스 gpt3 : OpenAi의 공식 GPT-3 인터페이스 gpt-embedding : OpenAi의 공식 임베딩 인터페이스 dall-e : OpenAi의 공식 Dall · E 인터페이스 welm : WeChat의 LLM 인터페이스 newbing : Chatgpt를 기반으로 한 새로운 빙 검색 (비공식) # python >= 3.8
python3 -m pip install -r requirements.txt
python3 run_api_server.py./build_docker.sh
./start_docker.shcurl 명령을 사용하여 액세스하십시오. # 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 이라고 가정) cp -r mock newllm 직접 할 수 있습니다.mock 의 구현을 참조하여 백엔드 이름을 newllm 으로 변경합니다.newllm 디렉토리에서 필요한 종속성을 추가하면 모든 관련 개발 이이 디렉토리에 바인딩됩니다.backend.py 에서 newllm 에 대한 지원을 추가하십시오