Skip to content

Commit

Permalink
fix: don't use file storage by default; renamed env vars (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
adubovik authored Dec 5, 2023
1 parent 7f48e0b commit 7b27c25
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ COPY ./scripts/docker_entrypoint.sh /docker_entrypoint.sh
RUN chmod +x /docker_entrypoint.sh

ENV LOG_LEVEL=INFO
ENV USE_DIAL_FILE_STORAGE=True
EXPOSE 5000

USER appuser
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ Copy `.env.example` to `.env` and customize it for your environment:
|DEFAULT_REGION||AWS region e.g. "us-east-1"|
|LOG_LEVEL|INFO|Log level. Use DEBUG for dev purposes and INFO in prod|
|AIDIAL_LOG_LEVEL|WARNING|AI DIAL SDK log level|
|USE_DIAL_FILE_STORAGE|False|Save model artifacts to DIAL File storage (particularly, Stability images are uploaded to the files storage and their base64 encodings are replaced with links to the storage)|
|DIAL_URL||URL of the core DIAL server|
|DIAL_BEDROCK_API_KEY||API Key for DIAL File storage|
|DIAL_USE_FILE_STORAGE|False|Save model artifacts to DIAL File storage (particularly, Stability images are uploaded to the files storage and their base64 encodings are replaced with links to the storage)|
|DIAL_URL||URL of the core DIAL server (required when DIAL_USE_FILE_STORAGE=True)|
|DIAL_API_KEY||API Key for DIAL File storage (required when DIAL_USE_FILE_STORAGE=True)|
|WEB_CONCURRENCY|1|Number of workers for the server|
|TEST_SERVER_URL|http://0.0.0.0:5001|Server URL used in the integration tests|

Expand Down
12 changes: 6 additions & 6 deletions aidial_adapter_bedrock/llm/model/stability.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,13 @@ async def save_to_storage(
return attachment


USE_DIAL_FILE_STORAGE = (
os.getenv("USE_DIAL_FILE_STORAGE", "false").lower() == "true"
DIAL_USE_FILE_STORAGE = (
os.getenv("DIAL_USE_FILE_STORAGE", "false").lower() == "true"
)

if USE_DIAL_FILE_STORAGE:
if DIAL_USE_FILE_STORAGE:
DIAL_URL = get_env("DIAL_URL")
DIAL_BEDROCK_API_KEY = get_env("DIAL_BEDROCK_API_KEY")
DIAL_API_KEY = get_env("DIAL_API_KEY")


class StabilityAdapter(ChatModel):
Expand All @@ -111,10 +111,10 @@ def __init__(self, client: Bedrock, model: str):
self.client = client
self.storage = None

if USE_DIAL_FILE_STORAGE:
if DIAL_USE_FILE_STORAGE:
self.storage = FileStorage(
dial_url=DIAL_URL,
api_key=DIAL_BEDROCK_API_KEY,
api_key=DIAL_API_KEY,
base_dir="stability",
)

Expand Down

0 comments on commit 7b27c25

Please sign in to comment.