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.

Code

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.1.6.tar.gz (12.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.1.6-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: svllm-0.1.6.tar.gz
  • Upload date:
  • Size: 12.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.1.6.tar.gz
Algorithm Hash digest
SHA256 f880151874efc38c9653c494dda85540e396895110fff3ed55784e13f49d91cd
MD5 a53ee9ee0f19c6a95cc36bb601426bda
BLAKE2b-256 e7d39e4a55ca2df894c267cee2107b8419e800a3e0cd7061b3c006cd9f840c1f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: svllm-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 16.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.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 355999198514ee4965d2d35d7231a2cbed2be45562ad10f5676353a04f00135c
MD5 dd419a11f59bbfdba58b4f02f5c4f234
BLAKE2b-256 9e93cea25df5516a762b307056baee77601d346bd89c42d33b5902fb3289d0f0

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