appolo-settings


Nameappolo-settings JSON
Version 0.2.0 PyPI version JSON
download
home_page
SummaryApollo Config & Pydantic Settings
upload_time2024-03-15 07:56:54
maintainer
docs_urlNone
authorwangyuxin
requires_python>=3.8,<4.0
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # appolo_settings
Apollo Config & Pydantic Settings

# Install

```bash
pip install appolo-settings
```

# Usage

```python
import time
from appolo_settings import AppoloSettings, AppoloSettingsConfigDict


class MySettings(AppoloSettings):
    model_config = AppoloSettingsConfigDict(
        meta_url='your_meta_url',
        app_id='your_app_id',
    )

    openai_api_base: str = 'test'
    rerank_model: str = 'test'
    rerank_threshold: float = 0.2


class ChatEninge:

    def __init__(self, rerank_model: str) -> None:
        self.rerank_model = rerank_model
    
    def update_model(self, rerank_model: str):
        self.rerank_model = rerank_model


settings = MySettings()
engine = ChatEninge(rerank_model=settings.rerank_model)
settings.on_change(engine.update_model, fields=['rerank_model'])
print(settings)
print(engine.rerank_model)
time.sleep(1)
print(settings)
print(engine.rerank_model)

```

AppoloClient code from @[crowod](https://github.com/crowod)

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "appolo-settings",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "wangyuxin",
    "author_email": "wangyuxin@mokahr.com",
    "download_url": "https://files.pythonhosted.org/packages/be/fd/9ebb86f16658ff17fdd3f188d3e583ecf6011589f70bb70678252a9c01f9/appolo_settings-0.2.0.tar.gz",
    "platform": null,
    "description": "# appolo_settings\nApollo Config & Pydantic Settings\n\n# Install\n\n```bash\npip install appolo-settings\n```\n\n# Usage\n\n```python\nimport time\nfrom appolo_settings import AppoloSettings, AppoloSettingsConfigDict\n\n\nclass MySettings(AppoloSettings):\n    model_config = AppoloSettingsConfigDict(\n        meta_url='your_meta_url',\n        app_id='your_app_id',\n    )\n\n    openai_api_base: str = 'test'\n    rerank_model: str = 'test'\n    rerank_threshold: float = 0.2\n\n\nclass ChatEninge:\n\n    def __init__(self, rerank_model: str) -> None:\n        self.rerank_model = rerank_model\n    \n    def update_model(self, rerank_model: str):\n        self.rerank_model = rerank_model\n\n\nsettings = MySettings()\nengine = ChatEninge(rerank_model=settings.rerank_model)\nsettings.on_change(engine.update_model, fields=['rerank_model'])\nprint(settings)\nprint(engine.rerank_model)\ntime.sleep(1)\nprint(settings)\nprint(engine.rerank_model)\n\n```\n\nAppoloClient code from @[crowod](https://github.com/crowod)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Apollo Config & Pydantic Settings",
    "version": "0.2.0",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0dd2348e9b8752cb9f06f1d99cc8cf7794a651e363c2ef8256b76feb2769dfca",
                "md5": "e3bb12febafd13a9e496cd3fd3d9689b",
                "sha256": "8a6726998d2e952865a456937319aa47d3f736fd5f887bff5fd27b30184c436d"
            },
            "downloads": -1,
            "filename": "appolo_settings-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e3bb12febafd13a9e496cd3fd3d9689b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4.0",
            "size": 5729,
            "upload_time": "2024-03-15T07:56:53",
            "upload_time_iso_8601": "2024-03-15T07:56:53.046986Z",
            "url": "https://files.pythonhosted.org/packages/0d/d2/348e9b8752cb9f06f1d99cc8cf7794a651e363c2ef8256b76feb2769dfca/appolo_settings-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "befd9ebb86f16658ff17fdd3f188d3e583ecf6011589f70bb70678252a9c01f9",
                "md5": "5fac3c936bb292eb79b8c68bca1467cd",
                "sha256": "b562df8769ff57e375751979127282efcaecb755202d5a417600e58f424353d0"
            },
            "downloads": -1,
            "filename": "appolo_settings-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "5fac3c936bb292eb79b8c68bca1467cd",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4.0",
            "size": 4901,
            "upload_time": "2024-03-15T07:56:54",
            "upload_time_iso_8601": "2024-03-15T07:56:54.570566Z",
            "url": "https://files.pythonhosted.org/packages/be/fd/9ebb86f16658ff17fdd3f188d3e583ecf6011589f70bb70678252a9c01f9/appolo_settings-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-15 07:56:54",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "appolo-settings"
}
        
Elapsed time: 0.36149s