Skip to main content

A library for managing LLM models

Project description

Description

ModelhubClient: A Python client for the Modelhub API

Installation

Install from PyPI

pip install puyuan_modelhub

Install from source

git clone https://github.com/puyuantech/modelhub
python setup.py build bdist_wheel
pip install dist/*.whl

Usage

Client side

Initialize a ModelhubClient

from modelhub import ModelhubClient

client = ModelhubClient(
    host="http://*****:*****/", user_name="****", user_password="*****"
)

Get supported Models

client.supported_models

Get model supported params

client.get_supported_params("Minimax")

Chat with model

client.chat("Hello?", model="m3e")

Get model embeddings

client.get_embeddings(["你好", "Hello"], model="m3e")

Server side

Start server in 4 lines:

from modelhub.server import start_server
import yaml

# load config
config = yaml.xxxx
# start server
start_server(config)

config file example:

from modelhub.server import start_server
import yaml

# load config
config = yaml.xxxx
# start server
start_server(config)

Chat Params:

class ChatParams(BaseModel):
    prompt: str
    model: str
    auth: AuthParams
    stream: bool = True
    parameters: Dict[str, Any] = {}

Examples

Contact

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

puyuan-modelhub-1.0.3.tar.gz (4.5 kB view hashes)

Uploaded Source

Built Distribution

puyuan_modelhub-1.0.3-py3-none-any.whl (5.1 kB view hashes)

Uploaded Python 3

Supported by

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