Skip to content

Commit 9d13151

Browse files
authored
Improve secret handling further (#25)
Get rid of the runtime_env
1 parent 5fa005c commit 9d13151

File tree

2 files changed

+3
-18
lines changed

2 files changed

+3
-18
lines changed

app/serve.py

+2-17
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,8 @@
1212
from slack_bolt import App
1313
from slack_bolt.adapter.socket_mode import SocketModeHandler
1414

15+
import app
1516
from app import query
16-
from app.config import (
17-
DB_CONNECTION_STRING,
18-
OPENAI_API_KEY,
19-
SLACK_APP_TOKEN,
20-
SLACK_BOT_TOKEN,
21-
)
2217

2318

2419
def get_secret(secret_name):
@@ -59,17 +54,6 @@ def run(self):
5954
SocketModeHandler(self.slack_app, get_secret("SLACK_APP_TOKEN")).start()
6055

6156

62-
ray.init(
63-
runtime_env={
64-
"env_vars": {
65-
"DB_CONNECTION_STRING": get_secret("DB_CONNECTION_STRING"),
66-
"OPENAI_API_KEY": OPENAI_API_KEY,
67-
}
68-
},
69-
ignore_reinit_error=True,
70-
)
71-
72-
7357
class Query(BaseModel):
7458
query: str
7559

@@ -84,6 +68,7 @@ class Answer(BaseModel):
8468
@serve.ingress(app)
8569
class RayAssistantDeployment:
8670
def __init__(self):
71+
app.config.DB_CONNECTION_STRING = get_secret("DB_CONNECTION_STRING")
8772
self.agent = query.QueryAgent(
8873
llm="meta-llama/Llama-2-70b-chat-hf",
8974
max_context_length=4096,

app/service.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ cluster_env: ray-assistant:2
33
ray_serve_config:
44
import_path: app.serve:deployment
55
runtime_env:
6-
working_dir: "https://github.com/ray-project/llm-applications/archive/refs/tags/v0.0.3.zip"
6+
working_dir: "https://github.com/ray-project/llm-applications/archive/refs/tags/v0.0.4.zip"
77
env_vars: {
88
RAY_ASSISTANT_AWS_SECRET_ID: "ray-assistant",
99
RAY_ASSISTANT_AWS_REGION: "us-west-2"

0 commit comments

Comments
 (0)