# paradigm-client
Python client for LightOn Paradigm Large language Model.
## Installation
You can install this package from PyPi with:
```
pip install paradigm-client
```
Or from source:
```
pip install -U git+https://github.com/lightonai/paradigm-client.git
```
Once the package is installed, make sure to define environment variables PARADIGM_API_KEY to your API key, e.g. by adding the following line to your .bashrc
```
export PARADIGM_API_KEY="<your api key>"
```
## Quick Start
Using paradigm-client is pretty simple, here are a code example to show you how you can use it.
```
from paradigm_client.remote_model import RemoteModel
model = RemoteModel(model_name="llm-mini")
print(model.create("Hello, I am").completions[0].output_text)
```
## Logging a feedback into Paradigm
After using the Create endpoint of Paradigm, you can log a feedback about it.
Feedback data is expected to be in a dictionary format with a key being one of "flag", "value", "tag" and "comment".
- `flag`: used for **boolean** feedbacks
- `value`: used for **float** feedbacks
- `tag`: used for **short text** feedbacks
- `comment`: used for **free text** feedbacks
Here are the different steps to log a feedback:
1. If the feedback type you want to use does not exist on Paradigm yet, go to the admin interface of Paradigm and create it.
2. Get the `rating_id` of the feedback type you want to use.
3. Instantiate a `RemoteModel` object.
4. Get the `completion_id` from the response of a `RemoteModel.create()` call.
5. Call the `log_feedback()` method of your `RemoteModel` object with the `rating_id`, the `completion_id` related to your feedback and your feedback data.
> **Important note**: The API Key used to generate the `completion_id` and to send the feedback must authorize the logging of its requests from the admin interface of Paradigm.
## Access to LightOn Paradigm
Learn more about Paradigm: https://www.lighton.ai/fr/paradigm.
For a list of use cases: https://www.lighton.ai/fr/blog/ai-use-case-5.
## Known Issues
If you find that a `RemoteModel` instantiation and subsequent completions are unusually slow, it may be that your network does not support IPv6. Try disabling IPv6 and see if that helps.
Raw data
{
"_id": null,
"home_page": "https://github.com/lightonai/paradigm-client",
"name": "paradigm-client",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "NLP,API,AI,LLM",
"author": "LightOn AI",
"author_email": "support@lighton.ai",
"download_url": "https://files.pythonhosted.org/packages/41/38/9e13e52b35611183913b0478b30a31ada21fd86381555fdceba7673c11f0/paradigm_client-0.5.2.tar.gz",
"platform": null,
"description": "# paradigm-client\n\nPython client for LightOn Paradigm Large language Model.\n\n## Installation\n\nYou can install this package from PyPi with:\n```\npip install paradigm-client\n```\n\nOr from source:\n```\npip install -U git+https://github.com/lightonai/paradigm-client.git\n```\n\nOnce the package is installed, make sure to define environment variables PARADIGM_API_KEY to your API key, e.g. by adding the following line to your .bashrc\n\n```\nexport PARADIGM_API_KEY=\"<your api key>\"\n```\n\n## Quick Start\n\nUsing paradigm-client is pretty simple, here are a code example to show you how you can use it.\n\n```\nfrom paradigm_client.remote_model import RemoteModel\n\nmodel = RemoteModel(model_name=\"llm-mini\")\n\nprint(model.create(\"Hello, I am\").completions[0].output_text)\n```\n\n## Logging a feedback into Paradigm\n\nAfter using the Create endpoint of Paradigm, you can log a feedback about it.\n\nFeedback data is expected to be in a dictionary format with a key being one of \"flag\", \"value\", \"tag\" and \"comment\".\n - `flag`: used for **boolean** feedbacks\n - `value`: used for **float** feedbacks\n - `tag`: used for **short text** feedbacks\n - `comment`: used for **free text** feedbacks\n\nHere are the different steps to log a feedback:\n1. If the feedback type you want to use does not exist on Paradigm yet, go to the admin interface of Paradigm and create it. \n2. Get the `rating_id` of the feedback type you want to use.\n3. Instantiate a `RemoteModel` object.\n4. Get the `completion_id` from the response of a `RemoteModel.create()` call.\n5. Call the `log_feedback()` method of your `RemoteModel` object with the `rating_id`, the `completion_id` related to your feedback and your feedback data.\n\n> **Important note**: The API Key used to generate the `completion_id` and to send the feedback must authorize the logging of its requests from the admin interface of Paradigm.\n\n## Access to LightOn Paradigm\n\nLearn more about Paradigm: https://www.lighton.ai/fr/paradigm.\nFor a list of use cases: https://www.lighton.ai/fr/blog/ai-use-case-5.\n\n## Known Issues\n\nIf you find that a `RemoteModel` instantiation and subsequent completions are unusually slow, it may be that your network does not support IPv6. Try disabling IPv6 and see if that helps.\n",
"bugtrack_url": null,
"license": "",
"summary": "Python client for LightOn Paradigm",
"version": "0.5.2",
"project_urls": {
"Homepage": "https://github.com/lightonai/paradigm-client"
},
"split_keywords": [
"nlp",
"api",
"ai",
"llm"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c82a9bc05fa8d6b6415ec6ed208c26fc3d1443d13ecade3bf6bab9d81f629edf",
"md5": "5585e2f4cfa22798e575f11bf83d6273",
"sha256": "0d711cf633dc16343d98f37c7a54b8eba69650c8f3c5c0a4f691ddbe10055b6e"
},
"downloads": -1,
"filename": "paradigm_client-0.5.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5585e2f4cfa22798e575f11bf83d6273",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 14968,
"upload_time": "2023-11-15T18:08:20",
"upload_time_iso_8601": "2023-11-15T18:08:20.978651Z",
"url": "https://files.pythonhosted.org/packages/c8/2a/9bc05fa8d6b6415ec6ed208c26fc3d1443d13ecade3bf6bab9d81f629edf/paradigm_client-0.5.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "41389e13e52b35611183913b0478b30a31ada21fd86381555fdceba7673c11f0",
"md5": "47a817662c870559d96445a9076c495a",
"sha256": "e5b4b3cb019d3e27892e3ad7009fec914f49a569970a833e326f40b7ca8e39c3"
},
"downloads": -1,
"filename": "paradigm_client-0.5.2.tar.gz",
"has_sig": false,
"md5_digest": "47a817662c870559d96445a9076c495a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 28251,
"upload_time": "2023-11-15T18:08:22",
"upload_time_iso_8601": "2023-11-15T18:08:22.504843Z",
"url": "https://files.pythonhosted.org/packages/41/38/9e13e52b35611183913b0478b30a31ada21fd86381555fdceba7673c11f0/paradigm_client-0.5.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-15 18:08:22",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "lightonai",
"github_project": "paradigm-client",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "aiohttp",
"specs": [
[
">=",
"3.8.4"
]
]
},
{
"name": "pydantic",
"specs": [
[
"==",
"1.10.2"
]
]
},
{
"name": "requests",
"specs": [
[
">=",
"2.31.0"
]
]
},
{
"name": "tqdm",
"specs": [
[
">=",
"4.64.1"
]
]
},
{
"name": "pytest",
"specs": [
[
">=",
"7.4.0"
]
]
}
],
"lcname": "paradigm-client"
}