Apollo Config & Pydantic Settings
Project description
apollo_settings
Apollo Config & Pydantic Settings
Install
pip install apollo-settings
Usage
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
apollo_settings-0.2.0.tar.gz
(4.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file apollo_settings-0.2.0.tar.gz.
File metadata
- Download URL: apollo_settings-0.2.0.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.11.0 Linux/6.5.0-1016-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa972c64df0c427900466ee56c4d5902c180ee28e642e578b49f31b899194a3d
|
|
| MD5 |
dd4bcf618dd5680dc018f203d07a3621
|
|
| BLAKE2b-256 |
f48c1caa6766ad3432ef27a0a680113f247aae459969a2a9ed84f6088c387a4d
|
File details
Details for the file apollo_settings-0.2.0-py3-none-any.whl.
File metadata
- Download URL: apollo_settings-0.2.0-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.11.0 Linux/6.5.0-1016-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f603bd458b9577dd346c3eec89ee51236ddd4ef9f6430c22fb049cc6c3ea82e9
|
|
| MD5 |
40285ce8dbfb48524d0cb9582e1b5e62
|
|
| BLAKE2b-256 |
bf3b53806f9fd6f33c3c291b96e408a9584857dfcaccb3bff6d6028967d310e0
|