Skip to main content

model-manage-client

A model-manage App Service-API Client, using for build a webapp by request Service-API

Usage

First, install model-manage-client python sdk package:

pip install model-manage-client

Write your code with sdk:

  • completion generate with blocking response_mode
from model-manage-client import ModelManageClient

base_url = "model-manage service api url"
client_token = "your_client_token"

# Initialize CompletionClient
m_client = ModelManageClient(base_url, client_token)

# if bast_url and client_token not set, will get from env variable, like:
# base_url = os.getenv("MODEL_MANAGE_URL")
# client_token = os.getenv("CLIENT_TOKEN")

# Create Completion Message using CompletionClient
extra_params = {
    "agent_description": "agent_description",
        "agent_icon_url": "agent_icon_url",
        "agent_api_version": "/v1.0",
        "agent_features": {"show_anonymous": False},
        "agent_labels": ["label1", "label2"]
        "support_models": {
            "translate": ["llm", "text-embedding", "rerank"],
            "qa": ["llm", "text-embedding", "rerank"],
        },
        "multilangs": {"translate": {"zh_CN": "翻译", "en_US": "Translate"}},
}
 m_client.register_agent("agent_name", "agent_id", "agent_url", **extra_params)

 # Update agent
 params = {
        "agent_description": "agent_description",
        "agent_icon_url": "agent_icon_url",
        "agent_api_version": "/v1.0",
        "agent_features": {"show_anonymous": True},
        "agent_labels": ["label1", "label2"]
        "support_models": {
            "translate": ["llm", "rerank"],
            "qa": ["llm", "text-embedding"],
        },
        "multilangs": {
            "translate": {"zh_CN": "翻译", "en_US": "Translate"},
            "qa": {"zh_CN": "问答", "en_US": "QA"},
        },
    }
# if don't update agent_url, just set agent_url=None
m_client.update_agent("agent_name", agent_url="http://localhost:8008", **params)

# get agent models
models = m_client.get_agent_models("agent_name", "tenant_id")
if models:
    print(models)

# response
{
  "reason_model": {
    "llm": {
      "provider": "tongyi",
      "model": "qwen-plus",
      "credentials": {
        "dashscope_api_key": "xxxx"
      }
    }
  },
  "embedding_model": {
    "provider": "azure_openai",
      "model": "text-embedding-3-small",
      "credentials": {
        "dashscope_api_key": "xxxx"
      }
  },
  "rerank_model": {
    "provider": "tongyi",
      "model": "gte-rerank",
      "credentials": {
        "dashscope_api_key": "xxxx"
      }
  }
}

Metadata

Release files for model-manage-client 0.0.1.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for model-manage-client 0.0.1.8
File Size Uploaded
model_manage_client-0.0.1.8.tar.gz 5.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for model-manage-client 0.0.1.8
File Interpreter ABI Platform
model_manage_client-0.0.1.8-py3-none-any.whl Python 3 none any Details

Total release size: 12.2 kB

Release files / model_manage_client-0.0.1.8.tar.gz

Download URL model_manage_client-0.0.1.8.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
b2db7a43d4c9fe34aed161206fd326967c4c0a8767c3f276f99c7811ef2bfab7
BLAKE2b-256 checksum
How to use checksums
75c193c6e8d3428aea15596460f3bd137dc2ce9fdf2bd1f722f382b4e6a4fb0c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.6

Release files / model_manage_client-0.0.1.8-py3-none-any.whl

Download URL model_manage_client-0.0.1.8-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7be04304f265c3e76389129f945a5a4e4b44b4478f87f1bec22fa013fa002180
BLAKE2b-256 checksum
How to use checksums
6a68ec7da5f4673b5b9db5cc503224b1477d714b0bd71bdb6f70d2fc3b24841a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.6

Release history Release notifications | RSS feed

This release

0.0.1.8 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page