-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ENV variables validation before running the discord bot (#42)
* feat:added env validation with pydantic * fix:added changed poetry config files * fix:fixed ruff format errors * fix:ruff formatted * fix: remove unused vars, ignore mypy error * chore: improve message when failed * improve: remove Field default, add reason for mypy ignore errors * chore: ruff formating * fix: resolve mypy error cleaner, add a mypy plugin * chore: clean .env.example * fix: correct .env.example * refactor: move env vars validation to a separate file * chore: ruff formating * fix: litellm config to direct phi to tinydolphin in testing * refactor: only get Settings class * fix (work in devcontainer): change path, shorten import * chore: use Settings() even cleaner * docs: add explanation * test: model name is still phi --------- Co-authored-by: Nhat Quang Nguyen <nngu0112@student.monash.edu> Co-authored-by: Rodo <rodonguyendd@gmail.com>
- Loading branch information
1 parent
d53db42
commit 1a5f928
Showing
8 changed files
with
39 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from pydantic_settings import BaseSettings, SettingsConfigDict | ||
|
||
|
||
class Settings(BaseSettings): | ||
model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8") | ||
|
||
DISCORD_BOT_TOKEN: str | ||
AI_SERVER_URL: str = "http://localhost:8000" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters