xinference-client


Namexinference-client JSON
Version 0.11.0 PyPI version JSON
download
home_pagehttps://github.com/xorbitsai/inference-client
SummaryClient for Xinference
upload_time2024-05-11 10:09:31
maintainerQin Xuye
docs_urlNone
authorQin Xuye
requires_pythonNone
licenseApache License 2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Xinference Restful Client
Xinference provides a restful client for managing and accessing models programmatically.

## Install
```shell
pip install xinference-client
```

## Usage
```python
from xinference_client import RESTfulClient as Client

client = Client("http://localhost:9997")
model_uid = client.launch_model(model_name="chatglm2")
model = client.get_model(model_uid)

chat_history = []
prompt = "What is the largest animal?"
model.chat(
    prompt,
    chat_history=chat_history,
    generate_config={"max_tokens": 1024}
)
```
Result:
```json
{
  "id": "chatcmpl-8d76b65a-bad0-42ef-912d-4a0533d90d61",
  "model": "56f69622-1e73-11ee-a3bd-9af9f16816c6",
  "object": "chat.completion",
  "created": 1688919187,
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "The largest animal that has been scientifically measured is the blue whale, which has a maximum length of around 23 meters (75 feet) for adult animals and can weigh up to 150,000 pounds (68,000 kg). However, it is important to note that this is just an estimate and that the largest animal known to science may be larger still. Some scientists believe that the largest animals may not have a clear \"size\" in the same way that humans do, as their size can vary depending on the environment and the stage of their life."
      },
      "finish_reason": "None"
    }
  ],
  "usage": {
    "prompt_tokens": -1,
    "completion_tokens": -1,
    "total_tokens": -1
  }
}
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/xorbitsai/inference-client",
    "name": "xinference-client",
    "maintainer": "Qin Xuye",
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": "qinxuye@xprobe.io",
    "keywords": null,
    "author": "Qin Xuye",
    "author_email": "qinxuye@xprobe.io",
    "download_url": "https://files.pythonhosted.org/packages/c7/e7/b73e089f0b09cd2f49bd412ddd633d09c4f4b45c42720d562c79e63dfdd9/xinference-client-0.11.0.tar.gz",
    "platform": null,
    "description": "# Xinference Restful Client\nXinference provides a restful client for managing and accessing models programmatically.\n\n## Install\n```shell\npip install xinference-client\n```\n\n## Usage\n```python\nfrom xinference_client import RESTfulClient as Client\n\nclient = Client(\"http://localhost:9997\")\nmodel_uid = client.launch_model(model_name=\"chatglm2\")\nmodel = client.get_model(model_uid)\n\nchat_history = []\nprompt = \"What is the largest animal?\"\nmodel.chat(\n    prompt,\n    chat_history=chat_history,\n    generate_config={\"max_tokens\": 1024}\n)\n```\nResult:\n```json\n{\n  \"id\": \"chatcmpl-8d76b65a-bad0-42ef-912d-4a0533d90d61\",\n  \"model\": \"56f69622-1e73-11ee-a3bd-9af9f16816c6\",\n  \"object\": \"chat.completion\",\n  \"created\": 1688919187,\n  \"choices\": [\n    {\n      \"index\": 0,\n      \"message\": {\n        \"role\": \"assistant\",\n        \"content\": \"The largest animal that has been scientifically measured is the blue whale, which has a maximum length of around 23 meters (75 feet) for adult animals and can weigh up to 150,000 pounds (68,000 kg). However, it is important to note that this is just an estimate and that the largest animal known to science may be larger still. Some scientists believe that the largest animals may not have a clear \\\"size\\\" in the same way that humans do, as their size can vary depending on the environment and the stage of their life.\"\n      },\n      \"finish_reason\": \"None\"\n    }\n  ],\n  \"usage\": {\n    \"prompt_tokens\": -1,\n    \"completion_tokens\": -1,\n    \"total_tokens\": -1\n  }\n}\n```\n",
    "bugtrack_url": null,
    "license": "Apache License 2.0",
    "summary": "Client for Xinference",
    "version": "0.11.0",
    "project_urls": {
        "Homepage": "https://github.com/xorbitsai/inference-client"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "13ee4052ec8d48c272c217918cadab3acb134f024122b4d63da6ec4129a89aeb",
                "md5": "fbe7504c1122b2ef408b55038bb67fec",
                "sha256": "f00715a113ede604219a48fc1eb229f2e8c248b2618b91f24cd1d71424882064"
            },
            "downloads": -1,
            "filename": "xinference_client-0.11.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "fbe7504c1122b2ef408b55038bb67fec",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 23229,
            "upload_time": "2024-05-11T10:09:29",
            "upload_time_iso_8601": "2024-05-11T10:09:29.916303Z",
            "url": "https://files.pythonhosted.org/packages/13/ee/4052ec8d48c272c217918cadab3acb134f024122b4d63da6ec4129a89aeb/xinference_client-0.11.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c7e7b73e089f0b09cd2f49bd412ddd633d09c4f4b45c42720d562c79e63dfdd9",
                "md5": "94dcc423c51e0133ad90a2d11b2d774f",
                "sha256": "22417469065a4ee36db2315416af158c3063cf76a2ff416206c97215c500408e"
            },
            "downloads": -1,
            "filename": "xinference-client-0.11.0.tar.gz",
            "has_sig": false,
            "md5_digest": "94dcc423c51e0133ad90a2d11b2d774f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 41450,
            "upload_time": "2024-05-11T10:09:31",
            "upload_time_iso_8601": "2024-05-11T10:09:31.719402Z",
            "url": "https://files.pythonhosted.org/packages/c7/e7/b73e089f0b09cd2f49bd412ddd633d09c4f4b45c42720d562c79e63dfdd9/xinference-client-0.11.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-11 10:09:31",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "xorbitsai",
    "github_project": "inference-client",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "xinference-client"
}
        
Elapsed time: 0.26570s