Hey everyone, I just joined here. I want to start ...
# software-contributors
c
Hey everyone, I just joined here. I want to start working on this issue. How can I start testing the slack AI conversation to get a feel for it? Looks like I might need openai and langchain keys? Do I use
python main.py respond-all-slack --mode unread
? What does that do, start a server? Sorry for the basic questions
also, should I be creating my own slack workspace to test this?
m
Thank you for contributing! Let me run through this with you.
You will need an openai key, I think we should start using AWS secrets manager for that and get out of infisical. I'll get you an openai key let's do about that point.
thankyou 1
I think you found the right command. That one would connect to slack.
It doesn't start up any server, it just starts generating responses based on what slack API returns
Our goal with this I think is to easily create conversations so that engineers can test out that command locally for building. I haven't started exploring LLM evals but I imagine this work will unlock us having unit test integration test style code that ensures our prompts don't break over time from properly answering old conversations
We I imagine you'll be mocking the slack API and spinning up a mock server that uses LLM to generate conversations
Happy to talk out requirements further.
c
Ok. I'd like to test out how to real one works with actual slack, before I try to make a mock api Should I set up some sort of workspace? do we have a test workspace?
m
You should be able to test it with this workspace with your own user token
c
How does it work? Will it create spam? What is this? This is what powers albus?
OK I'll wait for the AI creds and I will read the code in the meantime
OK so I think I have the basic idea seems like an interactive menu that lets me choose a conversation and analyzes it (each message) using AI, and determines if it needs a response and how the response should be structured. I don't know what it is because I haven't seen AI bots in this workspace besides albus but I guess I'll play around with it.
You should be able to test it with this workspace with your own user token
I was able to get my user token from my browser dev tools, but it looks like I might need a Bot token? Should I create a slack app?
m
Hm. No don't make a slack app. Are you sure you need a bot token?
Right now I copy paste the messages from the cli into slack. It helps me respond to clients faster.
(actually a more helpful issue you could take would be making it so I can invoke this code from slack instead of needing to interact with a CLI so I can respond to clients event faster) I started to work on this but haven't been able to finish.
It's not a bot sending the messages. It's me.
c
Ahh got it
invoke this code from slack instead of needing to interact with a CLI
Ok. I haven't made slack integrations before so this will be a great opportunity to learn.
Hm. No don't make a slack app. Are you sure you need a bot token?
OK so Im not sure. From what you described, user token makes sense. I hijacked mine from a requests on the slack web ui, but I have error
Copy code
20:05:55.039 Slack API call failed (attempt 1/3): [Scrubbed due to 'auth']. Retrying in 10 seconds...
where should I be getting my token from?
m
you might need to get it from a slack app but if you need to you'll hijak mine
actually, make your own slack app, i'll approve it just give it few permissions
c
ok. what do I need? just Read messages?
Ok I submitted a request
m
Approved
c
Thank you. Using it's token, I still get error:
Copy code
23:12:32.384 Slack API call failed (attempt 1/3): The request to the Slack API failed. (url: <https://slack.com/a...d>': 'channels:history,im:history,groups:history,mpim:history'}. Retrying in 10 seconds...
m
It looks like you might be missing permissions
I'm not sure. Not a slack pro
c
What token do you use yourself?
m
i use the "bot user token" for my slack app that I installed
c
OK same here so I will check permissions
m
i think it’s missing im:history and mpim:history
nvm its not
i don’t think the issue is permissions. it looks like the error is cut off
what does o3 or sonnet say
c
Looks like my mistake may have been adding them as bot scopes as opposed to user scopes. I resubmitted
Thanks for approving
m
No worries
c
OK I got the error.
Error details: {'ok': False, 'error': 'missing_scope', 'needed': 'channelsread,groupsread,mpimread,imread', 'provided': 'channelshistory,imhistory,groupshistory,mpimhistory'}
m
That seems easy to fix
c
ok sent a new request
on a similar note, why does logfire truncate the logs?
(ive never used logfire b4)
m
i think to make it easier to read? idk
c
When you have a chance, please submit my newest slack app request
m
done
thankyou 1
i wonder if there is a way for you to use my app instead of having your own
if i add you to my app, you can’t read my DMs right? just your own using the app
it should be just please double check https://api.slack.com/apps/A0805QHEJN9/general
c
I will let you know
and I finally got mine working now btw
image.png
m
oh nice that answers that
can you rename yours like this then?
shlomo.rabinowitz.frum.finance
c
yes
m
so each of us needs our own app
i’ve been wondering this for like a year lol
c
there might be a way to create an oauth within the app
m
(now you get why i want people to have the ability to simulate conversations)
👍 1
c
speaking of which, I don't get DMs like you do
m
and?
c
image.png
m
mark our DM has unread
you might need to then clear your cache
c
great idea thanks
you might need to then clear your cache
with python? how?
m
there is a clear cache command in our cli i built
c
oh this?
m
yup! it would seem when i rewrote that to be a separate dedicated command i never PR’d that
c
Ok. Maybe there is a new implementation? because I get an attributeerror
Copy code
AttributeError: 'function' object has no attribute 'clear_'
m
i think you accidentally edited the file. it's # func.clear_cache()
👍 1
c
sent another request to add
users:read
please approve when you have a chance thank you
thanks!!
💪 1
for some reason, you conversation doesn't show up for me.
Copy code
? Select a conversation to process (Use arrow keys)
 » Shlomo Rabinowitz
   Slackbot
   Next Batch
   Quit
I only have myself and slackbot. And both say
Copy code
16:25:10.200   Fetching messages for channel D091AEV605Q
16:25:10.376 No messages found for conversation D091AEV605Q
and even that is only when I do
--mode all
, and I dont see any chats with
--mode unread
m
i don't think i have ever seen myself...
well mazel tov for being the first other person to even get this far!
maybe play around with the api a bit more? maybe you are missing a parameter that for some reason I don't need? i'll try sending a message. you can also clear your cache again sometimes that is finiky
especially if you changed things
c
well mazel tov for being the first other person to even get this far!
😀
you can also clear your cache again sometimes that is finiky
I completely removed cachier and created my own stub that does absolutely nothing, but still same results
m
hmm, are you sure you are using the user bot token and not the bot token
c
using this one
m
hmmm
c
as env var SLACK_BOT_TOKEN
m
right that's what i do
well you get the idea, you can technically get this done without running this, but you might need to debug or dive deeper into how slack works to figure this one out
c
thank you for your help I changed to the top token here and it worked!
m
oh that's my bad then sorry
c
now I am ready for aws SM for the AI keys
m
if you can take a moment to document your pain in a readme that would be great thanks
👍 1
whats your personal email
i'll get you setup
c
you can send to shlomozalman04@gmail.com
m
just emailed you your google workspace account
for sso with AWS
once you are setup, this link should work https://frumfinanceinc.awsapps.com/start/
c
thanks
m
nice
granted
c
how do I setup the secrets
m
aws cli command has sso guides
c
ok will look into it
I think I need more permissions of something:
Copy code
An error occurred (AccessDeniedException) when calling the GetSecretValue operation: User: arn:aws:sts::354918380135:assumed-role/AWSReservedSSO_AlphaDeveloperAccess_3ea1a9abed4ed648/shlomo.rabinowitz@frum.finance is not authorized to perform: secretsmanager:GetSecretValue on resource: openai/api-key because no identity-based policy allows the secretsmanager:GetSecretValue action
AWS is honestly tiring me out. anyways, you sent me the openai key already. I think I still need the claude one.
m
you don't need to use both AIs
idk what command you are running to get that error
c
can I configure it not to use claude
m
yeah you have a file that you can comment out models
it uses a fixed list
c
ok thanks
m
what are you running to get that aws error? it looks like you are doing something you should not be...
that doesn't look like a deploy command
c
Copy code
(assistant-frum-finance-py3.12) C:\Users\Admin\Downloads\FrumFinanceCore>aws secretsmanager get-secret-value --secret-id openai/api-key --region us-east-1 --query SecretString --output text --profile AlphaDeveloperAccess-354918380135
m
why are you running that command
c
I pasted towards the end of out chat with chatgpt and asked to help set up secrets manager. At one point it had me run that. But seems like I dont really need to be using secrets manager?
m
you definitely should not be trying to run aws cli commands to make changes to the environment, especially out of chat gpt 😉
you do not need secrets manager
👍 1
c
I think from now on, I will work on this using the old fashioned way, and start up a plain old web server here for the slack bot. Once I get it working, I will work with you to set it up with lamda or whatever? Sounds good?
m
i think running localstack would be easier
it runs lambda locally
but whatever you want
c
oh ok let me work on that
m
you can have your own aws account running locally
c
oh looks very interesting. I will try to set that up. I've always found AWS stuff very annoying and when I try to figure it out, I waste time
m
i mean, that is bc you haven't learned it yet. I believe it's a bullet worth biting
👍 1
c
my cli is stuck btw
m
yup that definitely looks stuck
c
is it because I need a langchain key or something
m
idk... i wouldn't think so
i would just rerun it
c
I tried a few times
m
gotcha, i'm sorry i would need to debug with you
it could be the PR i made that started the work with the lambda broke something
c
extremely weird. It works in debugger with no issues but I cannot run it regularly
m
very weird
c
Ok I wont worry about that now
Ill get back to this after shabbos
m
👍
c
Im new to AWS so excuse my question. How are you deploying to lamda, zipfile deployment, container deployment, something else?
also a bit confused because there are dockerfile's running pip install -r requirements.txt but there is no requirements.txt
m
New thread maybe?
This one's getting too long
c
ok