Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't use file storage by default; renamed env vars #37

Merged
merged 2 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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