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.3.tar.gz (14.1 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.3-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: svllm-0.2.3.tar.gz
  • Upload date:
  • Size: 14.1 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.3.tar.gz
Algorithm Hash digest
SHA256 a3f44684744c35a0d53a971a4a287317192ab9110676ee7dc23b45f3dc4837b2
MD5 5d0b6a9b98219fc524e0631bbdac5cec
BLAKE2b-256 93bb5dfb9a169cda873281370775013b9178a1753734667169398ec0d3597cb0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: svllm-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 19.4 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 29f2edba0762856821817b63cb385258967215badd2ba6ba641c521f2056a4ce
MD5 16f94379ada8b3db93a29140620a431f
BLAKE2b-256 8b5228cf17af7c97b3c84b064b8e6bcde5136f05c03b2f1e78a8f4719ee5aca2

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