Skip to content

Commit

Permalink
Improve secret handling further (#25)
Browse files Browse the repository at this point in the history
Get rid of the runtime_env
  • Loading branch information
pcmoritz committed Aug 24, 2023
1 parent 5fa005c commit 9d13151
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 18 deletions.
19 changes: 2 additions & 17 deletions app/serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,8 @@
from slack_bolt import App
from slack_bolt.adapter.socket_mode import SocketModeHandler

import app
from app import query
from app.config import (
DB_CONNECTION_STRING,
OPENAI_API_KEY,
SLACK_APP_TOKEN,
SLACK_BOT_TOKEN,
)


def get_secret(secret_name):
Expand Down Expand Up @@ -59,17 +54,6 @@ def run(self):
SocketModeHandler(self.slack_app, get_secret("SLACK_APP_TOKEN")).start()


ray.init(
runtime_env={
"env_vars": {
"DB_CONNECTION_STRING": get_secret("DB_CONNECTION_STRING"),
"OPENAI_API_KEY": OPENAI_API_KEY,
}
},
ignore_reinit_error=True,
)


class Query(BaseModel):
query: str

Expand All @@ -84,6 +68,7 @@ class Answer(BaseModel):
@serve.ingress(app)
class RayAssistantDeployment:
def __init__(self):
app.config.DB_CONNECTION_STRING = get_secret("DB_CONNECTION_STRING")
self.agent = query.QueryAgent(
llm="meta-llama/Llama-2-70b-chat-hf",
max_context_length=4096,
Expand Down
2 changes: 1 addition & 1 deletion app/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cluster_env: ray-assistant:2
ray_serve_config:
import_path: app.serve:deployment
runtime_env:
working_dir: "https://github.com/ray-project/llm-applications/archive/refs/tags/v0.0.3.zip"
working_dir: "https://github.com/ray-project/llm-applications/archive/refs/tags/v0.0.4.zip"
env_vars: {
RAY_ASSISTANT_AWS_SECRET_ID: "ray-assistant",
RAY_ASSISTANT_AWS_REGION: "us-west-2"
Expand Down

0 comments on commit 9d13151

Please sign in to comment.