Skip to content

thundax-lyp/openspg-solver-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenSPG Solver API in OpenAI Style

An OpenAI style API for OpenSPG Solver.

screenshot

Environment

Install

  • Clone the repository
git clone https://github.com/thundax-lyp/openspg-solver-api.git
cd openspg-solver-api
  • Create Conda Environment
create conda -n openspg-solver-api python=3.10
conda activate openspg-solver-api
  • Install requirements
pip install -r requirements.txt
  • Copy kag_config.yaml files into ./config folder

  • Run API Server

python api.py --host=0.0.0.0 --port=8888 --openspg-service=http://127.0.0.1:8887

API Document

http://127.0.0.1:8888/

Streaming Generator

See kag_additions

Test

Models

Request

curl -X 'GET' \
  'http://127.0.0.1:8888/api/openspg/v1/models' \
  -H 'accept: application/json'

Response

{
  "object": "list",
  "data": [
    {
      "id": "openspg/TwoWiki",
      "object": "model",
      "created": 1742525286,
      "owned_by": "owner"
    },
    {
      "id": "openspg/BaiKe",
      "object": "model",
      "created": 1742525286,
      "owned_by": "owner"
    }
  ]
}

Completions

Request

curl -X 'POST' \
  'http://127.0.0.1:8888/api/openspg/v1/chat/completions' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer none' \
  -d '{
  "model": "openspg/BaiKe",
  "messages": [
    {
      "role": "user",
      "content": "周杰伦曾经为哪些自己出演的电影创作主题曲?"
    }
  ]
}'

About

Solver API for OpenSPG

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages