Skip to content

Commit

Permalink
feat: show up google api skill (#52)
Browse files Browse the repository at this point in the history
* feat: show up google api skill

* fix: do not use envvars to send in google api skill

* fix: timeout for google api skill

* fix: do not wait for google api
  • Loading branch information
dilyararimovna authored Nov 2, 2023
1 parent 12d097c commit 8c5d7f9
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 12 deletions.
1 change: 0 additions & 1 deletion assistant_dists/dream/docker-compose.override.yml
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,6 @@ services:
args:
SERVICE_PORT: 8162
SERVICE_NAME: dff_google_api_skill
ENVVARS_TO_SEND: OPENAI_API_KEY,GOOGLE_CSE_ID,GOOGLE_API_KEY
context: .
dockerfile: ./skills/dff_google_api_skill/Dockerfile
deploy:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ services:
args:
SERVICE_PORT: 8162
SERVICE_NAME: dff_google_api_skill
ENVVARS_TO_SEND: OPENAI_API_KEY,GOOGLE_CSE_ID,GOOGLE_API_KEY
context: .
dockerfile: ./skills/dff_google_api_skill/Dockerfile
deploy:
Expand Down
1 change: 0 additions & 1 deletion assistant_dists/dream_robot/docker-compose.override.yml
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,6 @@ services:
args:
SERVICE_PORT: 8162
SERVICE_NAME: dff_google_api_skill
ENVVARS_TO_SEND: OPENAI_API_KEY,GOOGLE_CSE_ID,GOOGLE_API_KEY
context: .
dockerfile: ./skills/dff_google_api_skill/Dockerfile
deploy:
Expand Down
1 change: 0 additions & 1 deletion assistant_dists/google_api/docker-compose.override.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ services:
args:
SERVICE_PORT: 8162
SERVICE_NAME: dff_google_api_skill
ENVVARS_TO_SEND: OPENAI_API_KEY,GOOGLE_CSE_ID,GOOGLE_API_KEY
context: .
dockerfile: ./skills/dff_google_api_skill/Dockerfile
deploy:
Expand Down
6 changes: 6 additions & 0 deletions assistant_dists/multiskill_ai_assistant/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,11 @@ services:
- "./common:/src/common"
ports:
- 8157:8157
dff-google-api-skill:
volumes:
- "./skills/dff_google_api_skill:/src"
- "./common:/src/common"
ports:
- 8162:8162

version: "3.7"
Original file line number Diff line number Diff line change
Expand Up @@ -240,4 +240,19 @@ services:
reservations:
memory: 128M

dff-google-api-skill:
env_file: [ .env,.env_secret ]
build:
args:
SERVICE_PORT: 8162
SERVICE_NAME: dff_google_api_skill
context: .
dockerfile: ./skills/dff_google_api_skill/Dockerfile
deploy:
resources:
limits:
memory: 128M
reservations:
memory: 128M

version: '3.7'
21 changes: 21 additions & 0 deletions assistant_dists/multiskill_ai_assistant/pipeline_conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,27 @@
}
},
"skills": {
"dff_google_api_skill": {
"connector": {
"protocol": "http",
"timeout": 120.0,
"url": "http://dff-google-api-skill:8162/respond"
},
"dialog_formatter": {
"name": "state_formatters.dp_formatters:dff_prompted_skill_formatter",
"skill_name": "dff_google_api_skill"
},
"response_formatter": "state_formatters.dp_formatters:skill_with_attributes_formatter_service",
"previous_services": [
"skill_selectors"
],
"state_manager_method": "add_hypothesis",
"is_enabled": true,
"source": {
"component": "components/VJ7c3sLqEi.yml",
"service": "skills/dff_google_api_skill/service_configs/dff-google-api-skill"
}
},
"dff_dream_persona_prompted_skill": {
"connector": {
"protocol": "http",
Expand Down
4 changes: 1 addition & 3 deletions skills/dff_google_api_skill/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@ ARG SERVICE_NAME
ENV SERVICE_NAME ${SERVICE_NAME}
ARG SERVICE_PORT
ENV SERVICE_PORT ${SERVICE_PORT}
ARG ENVVARS_TO_SEND
ENV ENVVARS_TO_SEND ${ENVVARS_TO_SEND}

COPY skills/dff_google_api_skill/requirements.txt .
RUN pip install -r requirements.txt

COPY skills/dff_google_api_skill/ ./
COPY ./common/ ./common/

CMD gunicorn --workers=1 server:app -b 0.0.0.0:${SERVICE_PORT}
CMD gunicorn --workers=1 server:app -b 0.0.0.0:${SERVICE_PORT} --timeout 240
4 changes: 1 addition & 3 deletions skills/dff_google_api_skill/scenario/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
logging.basicConfig(format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=logging.INFO)
logger = logging.getLogger(__name__)

ENVVARS_TO_SEND = getenv("ENVVARS_TO_SEND", None)
ENVVARS_TO_SEND = [] if ENVVARS_TO_SEND is None else ENVVARS_TO_SEND.split(",")
sending_variables = {f"{var}": getenv(var, None) for var in ENVVARS_TO_SEND}
sending_variables = {f"{var}": getenv(var, None) for var in ["OPENAI_API_KEY", "GOOGLE_CSE_ID", "GOOGLE_API_KEY"]}
# check if at least one of the env variables is not None
if len(sending_variables.keys()) > 0 and all([var_value is None for var_value in sending_variables.values()]):
raise NotImplementedError(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
SERVICE_PORT: 8162
SERVICE_NAME: dff_google_api_skill
ENVVARS_TO_SEND: OPENAI_API_KEY,GOOGLE_CSE_ID,GOOGLE_API_KEY
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ compose:
args:
SERVICE_PORT: 8162
SERVICE_NAME: dff_google_api_skill
ENVVARS_TO_SEND: OPENAI_API_KEY,GOOGLE_CSE_ID,GOOGLE_API_KEY
context: .
dockerfile: ./skills/dff_google_api_skill/Dockerfile
command: gunicorn --workers=1 server:app -b 0.0.0.0:8162 --reload
Expand Down

0 comments on commit 8c5d7f9

Please sign in to comment.