Skip to content

Commit

Permalink
Merge pull request #7 from nalbam/main
Browse files Browse the repository at this point in the history
rename var model id
  • Loading branch information
nalbam authored Jun 10, 2024
2 parents 357c482 + 20d7dfa commit cfc814e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ SLACK_SIGNING_SECRET="xxxx"

DYNAMODB_TABLE_NAME="gurumi-ai-bot-context"

TEXT_MODEL_ID="anthropic.claude-3-sonnet-20240229-v1:0"
IMAGE_MODEL_ID="stability.stable-diffusion-xl-v1"
MODEL_ID_TEXT="anthropic.claude-3-sonnet-20240229-v1:0"
MODEL_ID_IMAGE="stability.stable-diffusion-xl-v1"

ALLOWED_CHANNEL_IDS="C000000,C000001"

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ env:
BOT_CURSOR: ${{ vars.BOT_CURSOR }}
DYNAMODB_TABLE_NAME: ${{ vars.DYNAMODB_TABLE_NAME }}
ENABLE_IMAGE: ${{ vars.ENABLE_IMAGE }}
IMAGE_MODEL_ID: ${{ vars.IMAGE_MODEL_ID }}
MODEL_ID_IMAGE: ${{ vars.MODEL_ID_IMAGE }}
SYSTEM_MESSAGE: ${{ vars.SYSTEM_MESSAGE }}
TEXT_MODEL_ID: ${{ vars.TEXT_MODEL_ID }}
MODEL_ID_TEXT: ${{ vars.MODEL_ID_TEXT }}

AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
Expand Down Expand Up @@ -52,11 +52,11 @@ jobs:
echo "BOT_CURSOR=${BOT_CURSOR}" >> .env
echo "DYNAMODB_TABLE_NAME=${DYNAMODB_TABLE_NAME}" >> .env
echo "ENABLE_IMAGE=${ENABLE_IMAGE}" >> .env
echo "IMAGE_MODEL_ID=${IMAGE_MODEL_ID}" >> .env
echo "MODEL_ID_IMAGE=${MODEL_ID_IMAGE}" >> .env
echo "SLACK_BOT_TOKEN=${SLACK_BOT_TOKEN}" >> .env
echo "SLACK_SIGNING_SECRET=${SLACK_SIGNING_SECRET}" >> .env
echo "SYSTEM_MESSAGE=${SYSTEM_MESSAGE}" >> .env
echo "TEXT_MODEL_ID=${TEXT_MODEL_ID}" >> .env
echo "MODEL_ID_TEXT=${MODEL_ID_TEXT}" >> .env
- name: Deploy to AWS Lambda 🚀
run: npx serverless deploy --region us-east-1
8 changes: 4 additions & 4 deletions handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
DYNAMODB_TABLE_NAME = os.environ.get("DYNAMODB_TABLE_NAME", "gurumi-ai-bot-context")

# Amazon Bedrock Model ID
TEXT_MODEL_ID = os.environ.get("TEXT_MODEL_ID", "anthropic.claude-3")
IMAGE_MODEL_ID = os.environ.get("IMAGE_MODEL_ID", "stability.stable-diffusion-xl")
MODEL_ID_TEXT = os.environ.get("MODEL_ID_TEXT", "anthropic.claude-3")
MODEL_ID_IMAGE = os.environ.get("MODEL_ID_IMAGE", "stability.stable-diffusion-xl")

ANTHROPIC_VERSION = os.environ.get("ANTHROPIC_VERSION", "bedrock-2023-05-31")
ANTHROPIC_TOKENS = int(os.environ.get("ANTHROPIC_TOKENS", 1024))
Expand Down Expand Up @@ -128,7 +128,7 @@ def invoke_claude_3(content):
body["system"] = SYSTEM_MESSAGE

response = bedrock.invoke_model(
modelId=TEXT_MODEL_ID,
modelId=MODEL_ID_TEXT,
body=json.dumps(body),
)

Expand Down Expand Up @@ -179,7 +179,7 @@ def invoke_stable_diffusion(prompt, seed=0, style_preset="photographic"):
body["style_preset"] = style_preset

response = bedrock.invoke_model(
modelId=IMAGE_MODEL_ID,
modelId=MODEL_ID_IMAGE,
body=json.dumps(body),
)

Expand Down

0 comments on commit cfc814e

Please sign in to comment.