Skip to main content

serve your llm

Project description

svllm

Create a OpenAI-Compatible API Server for your LLM.

Usage

Install

$ pip install svllm

Prepare

svllm provided following HTTP APIs:

  • chat: /v1/chat/completions
  • complete: /v1/completions
  • embed: /v1/embeddings
  • models: /v1/models

You only need to implement the chat, complete, embed function (or part of them).

Set __model__, __owner__ for these functions can affect /v1/models API.

See src/protocol.py for more information.

Then you can use svllm in the following two ways:

CLI

If you have a demo.py file that implements a chat function, you can start it like this:

$ svllm --chat demo:chat
$ svllm-cli # client

Run svllm --help and svllm-cli --help for more information.

Library

You can also use svllm as a library. (also see demo.py)

import uvicorn
import svllm

if __name__ == '__main__':
    svllm.set_chat(svllm.examples.chat)
    svllm.set_complete(svllm.examples.complete)
    svllm.set_embed(svllm.examples.embed)

    app = svllm.create_app()
    uvicorn.run(app, host='0.0.0.0', port=5261)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

svllm-0.2.0.tar.gz (12.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

svllm-0.2.0-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file svllm-0.2.0.tar.gz.

File metadata

  • Download URL: svllm-0.2.0.tar.gz
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for svllm-0.2.0.tar.gz
Algorithm Hash digest
SHA256 96d76bd0f5c5a9682dc616abb859791f6e746ff991c7614e77e07e43eb491b1f
MD5 31275640e723a053b738ffb8851a0cca
BLAKE2b-256 74d78cb87474d5d2af5e377412a20a2ac79ad14abad6288a33a964d713d7b7b5

See more details on using hashes here.

File details

Details for the file svllm-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: svllm-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for svllm-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 461cf4bb58e7123ded43525e83e10506ea02208dc1f3acb7bd3dd14d5a8b6270
MD5 b032c5b57c9b0e178e63e2eab38f722e
BLAKE2b-256 4643c444201bc710929d873a61b04b0979d976d7ef8b5228b386aa0ea47721d0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page