Skip to content

Commit

Permalink
Ref #36 -- Add additional instructions (#40)
Browse files Browse the repository at this point in the history

Co-authored-by: Johannes Maron <johannes@maron.family>
  • Loading branch information
mostafa-anm and codingjoe authored Apr 17, 2024
1 parent 27c8c1d commit f3723ea
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions sam/slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,16 @@ async def process_run(event: {str, Any}, say: AsyncSay, voice_prompt: bool = Fal
logger.debug(f"process_run={json.dumps(event)}")
channel_id = event["channel"]
user_id = event["user"]
profile = await say.client.users_profile_get(user=user_id)
name = profile["profile"]["display_name"]
email = profile["profile"]["email"]
pronouns = profile["profile"]["pronouns"]
additional_instructions = (
f"You MUST ALWAYS address the user as <@{user_id}>.\n"
f"You may refer to the user as {name}.\n"
f"The user's email is {email}.\n"
f"The user's pronouns are {pronouns}.\n"
)
try:
ts = event["ts"]
except KeyError:
Expand All @@ -129,6 +139,7 @@ async def process_run(event: {str, Any}, say: AsyncSay, voice_prompt: bool = Fal
message_content = await bot.run(
thread_id=thread_id,
assistant_id=config.OPENAI_ASSISTANT_ID,
additional_instructions=additional_instructions,
)

msg = await say(
Expand Down
1 change: 1 addition & 0 deletions slack-manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ oauth_config:
- chat:write
- commands
- users:read
- users.profile:read
- files:read
- files:write
- reactions:write
Expand Down

0 comments on commit f3723ea

Please sign in to comment.