Name | apollo-settings JSON |
Version |
0.2.0
JSON |
| download |
home_page | |
Summary | Apollo Config & Pydantic Settings |
upload_time | 2024-03-19 09:19:22 |
maintainer | |
docs_url | None |
author | wangyuxin |
requires_python | >=3.8,<4.0 |
license | MIT |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# apollo_settings
Apollo Config & Pydantic Settings
# Install
```bash
pip install apollo-settings
```
# Usage
```python
import time
from apollo_settings import ApolloSettings, ApolloSettingsConfigDict
class MySettings(ApolloSettings):
model_config = ApolloSettingsConfigDict(
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, settings: MySettings):
self.rerank_model = settings.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)
```
ApolloClient code from @[crowod](https://github.com/crowod)
Raw data
{
"_id": null,
"home_page": "",
"name": "apollo-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/f4/8c/1caa6766ad3432ef27a0a680113f247aae459969a2a9ed84f6088c387a4d/apollo_settings-0.2.0.tar.gz",
"platform": null,
"description": "# apollo_settings\nApollo Config & Pydantic Settings\n\n# Install\n\n```bash\npip install apollo-settings\n```\n\n# Usage\n\n```python\nimport time\nfrom apollo_settings import ApolloSettings, ApolloSettingsConfigDict\n\n\nclass MySettings(ApolloSettings):\n model_config = ApolloSettingsConfigDict(\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, settings: MySettings):\n self.rerank_model = settings.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\nApolloClient code from @[crowod](https://github.com/crowod)\n\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": "bf3b53806f9fd6f33c3c291b96e408a9584857dfcaccb3bff6d6028967d310e0",
"md5": "40285ce8dbfb48524d0cb9582e1b5e62",
"sha256": "f603bd458b9577dd346c3eec89ee51236ddd4ef9f6430c22fb049cc6c3ea82e9"
},
"downloads": -1,
"filename": "apollo_settings-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "40285ce8dbfb48524d0cb9582e1b5e62",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8,<4.0",
"size": 5737,
"upload_time": "2024-03-19T09:19:21",
"upload_time_iso_8601": "2024-03-19T09:19:21.470204Z",
"url": "https://files.pythonhosted.org/packages/bf/3b/53806f9fd6f33c3c291b96e408a9584857dfcaccb3bff6d6028967d310e0/apollo_settings-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f48c1caa6766ad3432ef27a0a680113f247aae459969a2a9ed84f6088c387a4d",
"md5": "dd4bcf618dd5680dc018f203d07a3621",
"sha256": "fa972c64df0c427900466ee56c4d5902c180ee28e642e578b49f31b899194a3d"
},
"downloads": -1,
"filename": "apollo_settings-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "dd4bcf618dd5680dc018f203d07a3621",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8,<4.0",
"size": 4899,
"upload_time": "2024-03-19T09:19:22",
"upload_time_iso_8601": "2024-03-19T09:19:22.644800Z",
"url": "https://files.pythonhosted.org/packages/f4/8c/1caa6766ad3432ef27a0a680113f247aae459969a2a9ed84f6088c387a4d/apollo_settings-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-19 09:19:22",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "apollo-settings"
}