Skip to content

Commit

Permalink
Merge pull request #24 from nalbam/main
Browse files Browse the repository at this point in the history
Upgrade Python version to 3.11 across workflows
  • Loading branch information
nalbam authored Sep 4, 2024
2 parents 9027d0e + bb09b48 commit 1062ace
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 15 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/5-sync-notion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:
- cron: "0 20 * * 0-4"

env:
AWS_REGION: "us-east-1"

ENABLE_NOTION_SYNC: ${{ vars.ENABLE_NOTION_SYNC }}

KNOWLEDGE_BASE_ID: ${{ vars.KNOWLEDGE_BASE_ID }}
Expand All @@ -29,10 +31,10 @@ jobs:
with:
fetch-depth: 0

- name: Setup Python 3.9 🐍
- name: Setup Python 3.11 🐍
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: 3.11

- name: Setup Dependencies
run: pip install python-notion-exporter
Expand All @@ -50,9 +52,8 @@ jobs:
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: "us-east-1"
run: |
aws s3 sync --delete \
aws s3 sync --delete --region ${{ env.AWS_REGION }} \
build/${{ env.NOTION_PAGE_NAME }}/ \
${{ env.AWS_DEST_PATH }}/${{ env.NOTION_PAGE_NAME }}/
Expand All @@ -61,8 +62,8 @@ jobs:
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: "us-east-1"
run: |
aws bedrock-agent start-ingestion-job \
--knowledge-base-id ${{ env.KNOWLEDGE_BASE_ID }} \
--data-source-id ${{ env.DATA_SOURCE_ID }}
--data-source-id ${{ env.DATA_SOURCE_ID }} \
--region ${{ env.AWS_REGION }}
10 changes: 6 additions & 4 deletions .github/workflows/6-start-ingestion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:
- cron: "0 21 * * 0-4"

env:
AWS_REGION: "us-east-1"

ENABLE_NOTION_SYNC: ${{ vars.ENABLE_NOTION_SYNC }}

KNOWLEDGE_BASE_ID: ${{ vars.KNOWLEDGE_BASE_ID }}
Expand All @@ -24,18 +26,18 @@ jobs:
with:
fetch-depth: 0

- name: Setup Python 3.9 🐍
- name: Setup Python 3.11 🐍
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: 3.11

- name: Sync to AWS Bedrock Knowledge Base
if: env.ENABLE_NOTION_SYNC == 'Yes' && env.KNOWLEDGE_BASE_ID != 'None' && env.DATA_SOURCE_ID != 'None'
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: "us-east-1"
run: |
aws bedrock-agent start-ingestion-job \
--knowledge-base-id ${{ env.KNOWLEDGE_BASE_ID }} \
--data-source-id ${{ env.DATA_SOURCE_ID }}
--data-source-id ${{ env.DATA_SOURCE_ID }} \
--region ${{ env.AWS_REGION }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ A serverless Slack bot using AWS Lambda, API Gateway, and DynamoDB.
## Install

```bash
$ brew install python@3.9
$ brew install python@3.11

$ npm install -g [email protected]

Expand Down
2 changes: 1 addition & 1 deletion bedrock/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Install

```bash
$ brew install python@3.9
$ brew install python@3.11

$ python -m pip install --upgrade -r requirements.txt
```
Expand Down
2 changes: 1 addition & 1 deletion bin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Install

```bash
$ brew install python@3.9
$ brew install python@3.11

$ python -m pip install --upgrade -r requirements.txt
```
Expand Down
11 changes: 9 additions & 2 deletions handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

# Set up System messages
PERSONAL_MESSAGE = os.environ.get(
"PERSONAL_MESSAGE", "당신은 친절하고 전문적인 AI 비서 입니다."
"PERSONAL_MESSAGE", "You are a friendly and professional AI assistant."
)
SYSTEM_MESSAGE = os.environ.get("SYSTEM_MESSAGE", "None")

Expand Down Expand Up @@ -308,13 +308,20 @@ def conversation(say: Say, thread_ts, query, channel, client_msg_id):

prompts = []
prompts.append("User: {}".format(PERSONAL_MESSAGE))
prompts.append("If you don't know the answer, just say that you don't know, don't try to make up an answer.")
prompts.append(
"If you don't know the answer, just say that you don't know, don't try to make up an answer."
)

if SYSTEM_MESSAGE != "None":
prompts.append(SYSTEM_MESSAGE)

prompts.append("<question> 태그로 감싸진 질문에 답변을 제공하세요.")

tz = datetime.timezone(datetime.timedelta(hours=9))
now = datetime.datetime.now(tz)

prompts.append("<now>{}</now>".format(now.isoformat()))

try:
# Get the knowledge base contexts
if KNOWLEDGE_BASE_ID != "None":
Expand Down

0 comments on commit 1062ace

Please sign in to comment.