Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/tine groq #12

Open
wants to merge 18 commits into
base: origin_feature/arm64_fastembed
Choose a base branch
from
9 changes: 5 additions & 4 deletions characters/eliza.character.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"name": "TINE-IntrospectorIsNotEliza",
"plugins": [ "@elizaos/plugin-akash" ],
"clients": [],
"modelProvider": "openai",
"plugins": [ ],
"clients": ["twitter"],
"modelProvider": "groq",

"settings": {
"secrets": {},
"voice": {
Expand Down Expand Up @@ -44,7 +45,7 @@
],
"style": {
"all": [
"always use hashtags or emojis",
"always use hashtags and emojis",
"use plain american english language",
"always reveal everything",
"use lowercase most of the time",
Expand Down
31 changes: 29 additions & 2 deletions demo.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,21 @@ source ~/projects/nvidia/api

Now lets put this into aws and overwrite the old key
```
aws ssm put-parameter --name "agent_openai_key" --value "${OPENAI_API_KEY}" --type String --overwrite
aws ssm put-parameter --name "tine_agent_openai_key" --value "${OPENAI_API_KEY}" --type String
ssm put-parameter --name "tine_agent_twitter_password" --value "${TWITTER_PASSWORD}" --type String
ssm put-parameter --name "tine_agent_twitter_email" --value "${TWITTER_EMAIL}" --type String
ssm put-parameter --name "tine_agent_twitter_username" --value "${TWITTER_USERNAME}" --type String

ssm put-parameter --name "tine_agent_openai_key" --value "${OPENAI_API_KEY}" --type String
aws ssm put-parameter --name "tine_agent_openai_endpoint" --value "${OPENAI_API_BASE}" --type String
aws ssm put-parameter --name "tine_agent_openai_model" --value "${LLMMODEL}" --type String

aws ssm put-parameter --name "tine_agent_groq_key" --value "${GROQ_API_KEY}" --type String
```

Check key without exposing.
grep GROQ /var/run/agent/secrets/env | cut -b1-14


Make sure you dont put chat/completions in the url
to overwrite :
`aws ssm put-parameter --name "tine_agent_openai_endpoint" --value "${OPENAI_API_BASE}" --type String --overwrite`
Expand Down Expand Up @@ -168,3 +177,21 @@ now we will restart the server
`bash ./runlocaldocker2.sh`


docker exec -it agent-docker.service /bin/bash

NOTE: the mount of /opt/agent is not working, the files are from docker
--mount type=bind,source=/opt/agent,target=/opt/agent
this appears not to work

docker cp characters/eliza.character.json agent-docker.service:/app/agent/characters/eliza.character.json
docker commit agent-docker.service groq


# now to setup the twitter

1. create file in secret `~/.secrets/tine.twitter.env`
2. source it ```
source ~/.secrets/tine.twitter.env
3. send it
bash ./push_twitter.sh
```
6 changes: 6 additions & 0 deletions push_twitter.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

export TWITTER_EMAIL TWITTER_PASSWORD TWITTER_USER

aws ssm put-parameter --name "tine_agent_twitter_password" --value "${TWITTER_PASSWORD}" --type String
aws ssm put-parameter --name "tine_agent_twitter_email" --value "${TWITTER_EMAIL}" --type String
aws ssm put-parameter --name "tine_agent_twitter_username" --value "${TWITTER_USERNAME}" --type String
21 changes: 21 additions & 0 deletions run_with_groq.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/usr/bin/bash -c 'docker login -u AWS -p $(aws ecr get-login-password --region us-east-2) 767503528736.dkr.ecr.us-east-2.amazonaws.com'

/usr/bin/docker pull 767503528736.dkr.ecr.us-east-2.amazonaws.com/agent/eliza:feature-arm64_fastembed

#/usr/bin/docker run -p 3000:3000 --mount type=bind,source=/opt/agent,target=/opt/agent --env-file /var/run/agent/secrets/env --rm --name "agent-docker.service" --entry-point docker-entrypoint-strace.sh 767503528736.dkr.ecr.us-east-2.amazonaws.com/agent/eliza:feature-arm64_fastembed pnpm start:debug --characters=characters/eliza.character.json

#~/cloud-deployment-eliza/runlocaldocker-install-script.sh
# install strace (fixme : update docker)
#/usr/bin/docker run -p 3000:3000 --mount type=bind,source=/opt/agent,target=/opt/agent --env-file /var/run/agent/secrets/env --rm --name "agent-docker.service" --entrypoint /opt/agent/docker-entrypoint-none.sh 767503528736.dkr.ecr.us-east-2.amazonaws.com/agent/eliza:feature-arm64_fastembed /opt/agent/runlocaldocker-install-script.sh
#/usr/bin/docker commit "agent-docker.service" "agent-docker-strace"
# second step we debug with strace entrypoint
# first we create a volumee
#mount /node_modules/tokenizers/ from 767503528736.dkr.ecr.us-east-2.amazonaws.com/nodemodules/tokenizer:latest into
#"/app/node_modules/fastembed/node_modules/.pnpm/@anush008+tokenizers@https+++codeload.github.com+meta-introspector+arm64-tokenizers+tar.gz+98_s2457qj3pe4ojcbckddasgzfvu/node_modules/@anush008/"

docker run -v tokenizer:/node_modules/tokenizers/ 767503528736.dkr.ecr.us-east-2.amazonaws.com/nodemodules/tokenizer:latest

# now bind it in
/usr/bin/docker run -d -p 3000:3000 -v tokenizer:/app/node_modules/@anush008/tokenizers/ -v tokenizer:/app/node_modules/fastembed/node_modules/.pnpm/@anush008+tokenizers@https+++codeload.github.com+meta-introspector+arm64-tokenizers+tar.gz+98_s2457qj3pe4ojcbckddasgzfvu/node_modules/@anush008/ --mount type=bind,source=/opt/agent,target=/opt/agent --mount type=bind,source=/opt/agent/characters/,target=/app/agent/characters/ --env-file /var/run/agent/secrets/env --rm --name "agent-docker.service" --entrypoint /opt/agent/docker-entrypoint-strace2.sh groq
#100755 >

45 changes: 27 additions & 18 deletions rundocker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ apt install -y lsof strace nmap
#apt install -y emacs-nox
# FIXME another account hardcoded
aws ecr get-login-password --region us-east-2 | docker login --username AWS --password-stdin 767503528736.dkr.ecr.us-east-2.amazonaws.com


adduser --disabled-password --gecos "" agent --home "/home/agent" || echo ignore
git config --global --add safe.directory "/opt/agent"
cd "/opt/agent/" || exit 1 # "we need agent"
git log -1
#git log -1
mkdir -p "/home/agent"
mkdir -p "/var/agent/logs"
chown -R agent:agent "/var/agent/" "/home/agent" "/opt/agent"
Expand All @@ -27,22 +29,27 @@ mkdir -p "/var/run/agent/secrets/"
# we are using parameters prefixed by tine_ for multiple
## TURN OFF LOGGING
set +x
OPENAI_KEY=$(aws ssm get-parameter --name "tine_agent_openai_key" | jq .Parameter.Value -r )
export OPENAI_KEY
echo "OPENAI_KEY=${OPENAI_KEY}" > "/var/run/agent/secrets/env"
echo "OPENAI_API_KEY=${OPENAI_KEY}" >> "/var/run/agent/secrets/env"

# now the model name
XAI_MODEL=$(aws ssm get-parameter --name "tine_agent_openai_model" | jq .Parameter.Value -r )
export XAI_MODEL
echo "XAI_MODEL=${XAI_MODEL}" >> "/var/run/agent/secrets/env"
echo "SMALL_OPENAI_MODEL=${XAI_MODEL}" >> "/var/run/agent/secrets/env"
echo "MEDIUM_OPENAI_MODEL=${XAI_MODEL}" >> "/var/run/agent/secrets/env"
echo "LARGE_OPENAI_MODEL=${XAI_MODEL}" >> "/var/run/agent/secrets/env"

OPENAI_API_URL=$(aws ssm get-parameter --name "tine_agent_openai_endpoint" | jq .Parameter.Value -r )
export OPENAI_API_URL
echo "OPENAI_API_URL=${OPENAI_API_URL}" >> "/var/run/agent/secrets/env"

#fixme move to environment
export AGENT_NAME="tine_agent"

declare -A params=(
# ["OPENAI_KEY"]="${AGENT_NAME}_openai_key"
# ["XAI_MODEL"]="${AGENT_NAME}_openai_model"
# ["XAI_L_MODEL"]="${AGENT_NAME}_large_openai_model"
# ["XAI_M_MODEL"]="${AGENT_NAME}_medium_openai_model"
# ["OPENAI_API_URL"]="${AGENT_NAME}_openai_endpoint"
["GROQ_API_KEY"]="${AGENT_NAME}_groq_key"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a reasonable usage of ai

["TWITTER_PASSWORD"]="${AGENT_NAME}_twitter_password"
["TWITTER_EMAIL"]="${AGENT_NAME}_twitter_email"
["TWITTER_USERNAME"]="${AGENT_NAME}_twitter_username"
)

for key in "${!params[@]}"; do
value=$(aws ssm get-parameter --name "${params[$key]}" | jq .Parameter.Value -r)
echo "$key=$value" >> "/var/run/agent/secrets/env"
done


set -x
## TURN ON LOGGING
Expand All @@ -58,6 +65,8 @@ grep . -h -n /etc/systemd/system/agent-docker.service
chown -R agent:agent /var/run/agent/
chown -R agent:agent /opt/agent/
systemctl daemon-reload
#docker stop agent-docker.service || echo oops
#docker rm agent-docker.service || echo oops
systemctl start agent-docker || echo failed
systemctl enable agent-docker || echo failed
systemctl status agent-docker || echo oops2
#systemctl status agent-docker || echo oops2
2 changes: 1 addition & 1 deletion runlocaldocker2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
docker run -v tokenizer:/node_modules/tokenizers/ 767503528736.dkr.ecr.us-east-2.amazonaws.com/nodemodules/tokenizer:latest

# now bind it in
/usr/bin/docker run -p 3000:3000 -v tokenizer:/app/node_modules/@anush008/tokenizers/ -v tokenizer:/app/node_modules/fastembed/node_modules/.pnpm/@anush008+tokenizers@https+++codeload.github.com+meta-introspector+arm64-tokenizers+tar.gz+98_s2457qj3pe4ojcbckddasgzfvu/node_modules/@anush008/ --mount type=bind,source=/opt/agent,target=/opt/agent --env-file /var/run/agent/secrets/env --rm --name "agent-docker.service" --entrypoint /opt/agent/docker-entrypoint-strace2.sh 767503528736.dkr.ecr.us-east-2.amazonaws.com/agent/eliza:feature-arm64_fastembed
/usr/bin/docker run -d -p 3000:3000 -v tokenizer:/app/node_modules/@anush008/tokenizers/ -v tokenizer:/app/node_modules/fastembed/node_modules/.pnpm/@anush008+tokenizers@https+++codeload.github.com+meta-introspector+arm64-tokenizers+tar.gz+98_s2457qj3pe4ojcbckddasgzfvu/node_modules/@anush008/ --mount type=bind,source=/opt/agent,target=/opt/agent --env-file /var/run/agent/secrets/env --rm --name "agent-docker.service" --entrypoint /opt/agent/docker-entrypoint-strace2.sh 767503528736.dkr.ecr.us-east-2.amazonaws.com/agent/eliza:feature-arm64_fastembed
#100755 >

Loading