Skip to main content

A package for interacting with the Model management Service-API

Project description

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_label": "agent_label",
        "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_label": "aaa",
        "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"
      }
  }
}

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

model_manage_client-0.0.1.7.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

model_manage_client-0.0.1.7-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file model_manage_client-0.0.1.7.tar.gz.

File metadata

  • Download URL: model_manage_client-0.0.1.7.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.6

File hashes

Hashes for model_manage_client-0.0.1.7.tar.gz
Algorithm Hash digest
SHA256 4fb44866811b09db163cf5a12b178661d496b2f2cca8750d570b4d9550498400
MD5 35e2227bbded8c22b82a677fc903a326
BLAKE2b-256 cf6ad3b28ee020ab774c13cbdacb2f742598d584fc28763bca0e65d805ef6a59

See more details on using hashes here.

File details

Details for the file model_manage_client-0.0.1.7-py3-none-any.whl.

File metadata

File hashes

Hashes for model_manage_client-0.0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 34c4a7a57d0d8ce311f43360cff5924e1299c4d4735e20d889e1c9e6ec6c6d8e
MD5 8e73630cb775a4571e49a3aa120a03c7
BLAKE2b-256 941be6c51252162bfc5adb19a044eb90fa7b4e044c8efb96eb63504008b18c14

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