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.1.tar.gz (13.0 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.1-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: svllm-0.2.1.tar.gz
  • Upload date:
  • Size: 13.0 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.1.tar.gz
Algorithm Hash digest
SHA256 66e86333222c40edf7cffe72e6554d560825b25556b21333f16712778b8e27d6
MD5 3af401536dd8b8980ef108237d56508c
BLAKE2b-256 e080cd3cf443cc93454b64f3426e03bac7059dc242720559033f752556be781c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: svllm-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 17.6 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a16496bb394c67bce4665cc71821e79c3e4f927cfd378c22f2aa63e8e8dcc9db
MD5 f9c8ecdc1a5598ec0037593af2613b1d
BLAKE2b-256 c46d7cc2ff100d5b746cb9a1e02790d64fdb588297cb867610edd68b16d3f4dc

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