-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
41 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
## Configuration | ||
|
||
Banks can smoothly run with defaults, but you can configure the library by changing the `config` object or by | ||
setting the correspondent environment variables. | ||
|
||
Example usage: | ||
|
||
```python | ||
from banks import config | ||
|
||
|
||
config.ASYNC_ENABLED = True | ||
``` | ||
|
||
|
||
### ASYNC_ENABLED | ||
|
||
| | | | ||
| -------------- | ----------------------- | | ||
| Type: | `bool` or truthy string | | ||
| Default value: | `False` | | ||
| Env var: | `BANKS_ASYNC_ENABLED` | | ||
|
||
Whether or not to use `asyncio` for template rendering and LLM generation. This setting won't speed up your | ||
application, only set it to `True` if you need to integrate Banks into an async codebase. | ||
|
||
|
||
### USER_DATA_PATH | ||
|
||
| | | | ||
| -------------- | ---------------------- | | ||
| Type: | `Path` or path string | | ||
| Default value: | depending on OS | | ||
| Env var: | `BANKS_USER_DATA_PATH` | | ||
|
||
A user-writable folder where Banks will store its data. Banks uses a meaningful default for your operating system, so | ||
change it only if you have to. |
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 |
---|---|---|
@@ -1,13 +1,14 @@ | ||
import os | ||
from pathlib import Path | ||
|
||
from platformdirs import user_data_path | ||
|
||
from .utils import strtobool | ||
|
||
|
||
class BanksConfig: | ||
ASYNC_ENABLED = strtobool(os.environ.get("BANKS_ASYNC_ENABLED", "false")) | ||
USER_DATA_PATH = user_data_path(os.environ.get("BANKS_USER_DATA_PATH", "banks")) | ||
ASYNC_ENABLED: bool = strtobool(os.environ.get("BANKS_ASYNC_ENABLED", "false")) | ||
USER_DATA_PATH: Path = Path(os.environ.get("BANKS_USER_DATA_PATH", "")) or user_data_path("banks") | ||
|
||
|
||
config = BanksConfig() |