Skip to content

Commit c78fea6

Browse files
committed
Completely Patch vanilla Danswer -> HubGPT
1 parent e2916ee commit c78fea6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+11171
-62
lines changed

.github/workflows/redeploy.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Deploy on Production Update
2+
3+
on:
4+
push:
5+
branches:
6+
- prod
7+
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
environment:
12+
name: production
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v2
16+
17+
- name: Configure SSH
18+
run: |
19+
mkdir -p ~/.ssh/
20+
echo "$PROD_SSH_KEY" > ~/.ssh/hubgpt_prod.key
21+
chmod 600 ~/.ssh/hubgpt_prod.key
22+
cat >>~/.ssh/config <<END
23+
Host prod
24+
HostName $PROD_EC2_HOST_IP
25+
User $PROD_EC2_USER
26+
IdentityFile ~/.ssh/hubgpt_prod.key
27+
StrictHostKeyChecking no
28+
END
29+
env:
30+
PROD_EC2_USER: ${{ secrets.PROD_EC2_USER }}
31+
PROD_SSH_KEY: ${{ secrets.PROD_SSH_KEY }}
32+
PROD_EC2_HOST_IP: ${{ secrets.PROD_EC2_HOST_IP }}
33+
34+
- name: Deploy to Production
35+
run: |
36+
ssh prod << 'EOF'
37+
cd danswer
38+
make re-deploy
39+
echo "Deployment complete"
40+
echo "Last commit merged in:"
41+
git --no-pager log -1
42+
EOF
43+
44+
- name: Wait before pinging
45+
run: sleep 60
46+
47+
- name: Ping the website
48+
run: |
49+
response=$(curl -o /dev/null -s -w "%{http_code}\n" https://hubgpt.idinsight.io)
50+
if [ "$response" -eq 307 ]; then
51+
echo "Site is up and returned HTTP status 307"
52+
else
53+
echo "Site might be down or is not returning expected codes. Code returned: $response"
54+
exit 1
55+
fi
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Run Performance Test
2+
# NB This only works on the default (prod) branch
3+
on:
4+
workflow_dispatch:
5+
# schedule:
6+
# - cron: '0 9 1-7 * 5'
7+
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
environment:
12+
name: production
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v2
16+
17+
- name: Configure SSH
18+
run: |
19+
mkdir -p ~/.ssh/
20+
echo "$PROD_SSH_KEY" > ~/.ssh/hubgpt_prod.key
21+
chmod 600 ~/.ssh/hubgpt_prod.key
22+
cat >>~/.ssh/config <<END
23+
Host prod
24+
HostName $PROD_EC2_HOST_IP
25+
User $PROD_EC2_USER
26+
IdentityFile ~/.ssh/hubgpt_prod.key
27+
StrictHostKeyChecking no
28+
END
29+
env:
30+
PROD_EC2_USER: ${{ secrets.PROD_EC2_USER }}
31+
PROD_SSH_KEY: ${{ secrets.PROD_SSH_KEY }}
32+
PROD_EC2_HOST_IP: ${{ secrets.PROD_EC2_HOST_IP }}
33+
34+
- name: Trigger sample query run
35+
run: |
36+
ssh prod << 'EOF'
37+
cd danswer
38+
make send-hubgpt-eval
39+
EOF
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Send Slack Metrics
2+
# NB This only works on the default (prod) branch
3+
on:
4+
schedule:
5+
- cron: '0 9 * * 5'
6+
7+
jobs:
8+
deploy:
9+
runs-on: ubuntu-latest
10+
environment:
11+
name: production
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v2
15+
16+
- name: Configure SSH
17+
run: |
18+
mkdir -p ~/.ssh/
19+
echo "$PROD_SSH_KEY" > ~/.ssh/hubgpt_prod.key
20+
chmod 600 ~/.ssh/hubgpt_prod.key
21+
cat >>~/.ssh/config <<END
22+
Host prod
23+
HostName $PROD_EC2_HOST_IP
24+
User $PROD_EC2_USER
25+
IdentityFile ~/.ssh/hubgpt_prod.key
26+
StrictHostKeyChecking no
27+
END
28+
env:
29+
PROD_EC2_USER: ${{ secrets.PROD_EC2_USER }}
30+
PROD_SSH_KEY: ${{ secrets.PROD_SSH_KEY }}
31+
PROD_EC2_HOST_IP: ${{ secrets.PROD_EC2_HOST_IP }}
32+
33+
- name: Trigger metric dispatch
34+
run: |
35+
ssh prod << 'EOF'
36+
cd danswer
37+
make send-slack-metrics
38+
EOF

Makefile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
re-deploy:
2+
cd /home/ec2-user/danswer/ && \
3+
git restore .
4+
cd /home/ec2-user/danswer/deployment/docker_compose && \
5+
echo "Current directory is: $$(pwd)" && \
6+
docker compose -p hubgpt down && \
7+
git pull origin prod && \
8+
docker compose -p hubgpt -f docker-compose.prod.yml up -d --build
9+
10+
send-slack-metrics:
11+
docker exec hubgpt-background-1 python /app/scripts/send_slack_report/send_slack_report.py
12+
13+
send-hubgpt-eval:
14+
cd /home/ec2-user/danswer/deployment/docker_compose && \
15+
docker compose -p hubgpt down && \
16+
docker compose -p hubgpt -f docker-compose.analytics.yml up -d --build
17+
sleep 150
18+
docker exec hubgpt-background-1 python /app/scripts/hubgpt_eval_automation.py
19+
cd /home/ec2-user/danswer/deployment/docker_compose && \
20+
docker compose -p hubgpt down && \
21+
docker compose -p hubgpt -f docker-compose.prod.yml up -d --build
22+

backend/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ nltk.download('punkt', quiet=True);"
5454
# Set up application files
5555
WORKDIR /app
5656
COPY ./danswer /app/danswer
57+
COPY ./scripts /app/scripts
5758
COPY ./shared_configs /app/shared_configs
5859
COPY ./alembic /app/alembic
5960
COPY ./alembic.ini /app/alembic.ini

backend/danswer/chat/personas.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ personas:
55
# this is for DanswerBot to use when tagged in a non-configured channel
66
# Careful setting specific IDs, this won't autoincrement the next ID value for postgres
77
- id: 0
8-
name: "Danswer"
8+
name: "HubGPT"
99
description: >
1010
Assistant with access to documents from your Connected Sources.
1111
# Default Prompt objects attached to the persona, see prompts.yaml

backend/danswer/danswerbot/slack/handlers/handle_message.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,6 @@ def _get_answer(new_message_request: DirectQARequest) -> OneShotQAResponse | Non
484484
"Answer was evaluated to be invalid, throwing it away without responding."
485485
)
486486
update_emote_react(
487-
emoji=DANSWER_FOLLOWUP_EMOJI,
488487
channel=message_info.channel_to_respond,
489488
message_ts=message_info.msg_to_respond,
490489
remove=False,

backend/danswer/danswerbot/slack/utils.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242

4343

4444
def update_emote_react(
45-
emoji: str,
4645
channel: str,
4746
message_ts: str | None,
4847
remove: bool,
@@ -54,11 +53,11 @@ def update_emote_react(
5453

5554
func = client.reactions_remove if remove else client.reactions_add
5655
slack_call = make_slack_api_rate_limited(func) # type: ignore
57-
slack_call(
58-
name=emoji,
59-
channel=channel,
60-
timestamp=message_ts,
61-
)
56+
# slack_call(
57+
# name=emoji,
58+
# channel=channel,
59+
# timestamp=message_ts,
60+
# )
6261

6362

6463
def get_danswer_bot_app_id(web_client: WebClient) -> Any:

backend/requirements/default.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ httpx[http2]==0.23.3
2424
httpx-oauth==0.11.2
2525
huggingface-hub==0.20.1
2626
jira==3.5.1
27+
kaleido==0.2.1
2728
langchain==0.1.17
2829
langchain-community==0.0.36
2930
langchain-core==0.1.50
@@ -38,6 +39,7 @@ oauthlib==3.2.2
3839
openai==1.14.3
3940
openpyxl==3.1.2
4041
playwright==1.41.2
42+
plotly==5.22.0
4143
psutil==5.9.5
4244
psycopg2-binary==2.9.9
4345
pycryptodome==3.19.1

backend/scripts/api_inference_sample.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# This file is used to demonstrate how to use the backend APIs directly
2-
# In this case, the equivalent of asking a question in HubGPT Chat in a new chat session
2+
# In this case, the equivalent of asking a question in Danswer Chat in a new chat session
33
import argparse
44
import json
55
import os
@@ -67,7 +67,7 @@ def process_question(danswer_url: str, question: str, api_key: str | None) -> No
6767
"--danswer-url",
6868
type=str,
6969
default="http://localhost:80",
70-
help="HubGPT URL, should point to HubGPT nginx.",
70+
help="Danswer URL, should point to Danswer nginx.",
7171
)
7272
parser.add_argument(
7373
"--test-question",
@@ -77,7 +77,7 @@ def process_question(danswer_url: str, question: str, api_key: str | None) -> No
7777
)
7878

7979
# Not needed if Auth is disabled
80-
# Or for HubGPT MIT API key must be replaced with session cookie
80+
# Or for Danswer MIT API key must be replaced with session cookie
8181
api_key = os.environ.get("DANSWER_API_KEY")
8282

8383
args = parser.parse_args()

backend/scripts/dev_run_background_jobs.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ def run_jobs(exclude_indexing: bool) -> None:
4949
if not exclude_indexing:
5050
update_env = os.environ.copy()
5151
update_env["PYTHONPATH"] = "."
52+
update_env["DYNAMIC_CONFIG_DIR_PATH"] = "./dynamic_config_storage"
53+
update_env["FILE_CONNECTOR_TMP_STORAGE_PATH"] = "./dynamic_config_storage"
5254
cmd_indexing = ["python", "danswer/background/update.py"]
5355

5456
indexing_process = subprocess.Popen(

backend/scripts/hubgpt_eval.csv

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
Category,Query
2+
Projects,What is project sampoorna?
3+
Projects,What is ask a metric?
4+
Policies,What is the referral bonus given for recommending new hires? How does the bonus amount change with seniority of the open role?
5+
Policies,Explain the global travel benefit given to IDinsight employees?
6+
Policies,What is the eligibility for the wellness stipend?
7+
Policies,What are the wellness days for 2024?
8+
Resources,Where can I find resources for project management at IDinsight?
9+
Policies,What are the most updated steps needed for an Ethics Review?
10+
Resources,What are the guidelines to writing a blog for IDinsight?
11+
Teams,Who do I reach out to about Legal questions for a new project?
12+
Projects,Give me the summary of our most recently completed MELA project
13+
Teams,Who are the chief of staffs for each region of IDinsight?
14+
Resources,Where can I find resources on government partnerships?
15+
Policies,what does “open item” on U4 mean?
16+
Projects,What work have we done in evaluating mhealth or digital interventions
17+
Projects,Share a process evaluation education concept note example
18+
Resources,"Can you please help me with the guidelines related to budgeting for surveyor costs (new vendor charges, GST, mandatory benefits like EPF, insurance etc). How much extra should we budget for this?"
19+
Policies,How many leave days can I roll over into next year?
20+
Policies,How do I avail of health insurance coverage?
21+
Teams,Who is Alison Conner and what is her role within IDinsight?
22+
Policies,"What is the policy for hiring someone who is a partner, friend or family member"
23+
Projects,Have we done any work with DIV USAID?
24+
Projects,Have we done m&e training and theory of change with other orgs?
25+
Policies,how much is work from home stipend in Lusaka Zambia
26+
Projects,Can you show me the latest impact evaluation project deliverable written for the healthcare sector?
27+
Projects,What was the most recent MLE project IDinsight completed?
28+
Projects,"What was the most recent MLE project IDinsight completed?
29+
> Can you share the link to its project folder?"
30+
Projects,"What was the most recent MLE project IDinsight completed?
31+
> Can you share the link to its project folder?
32+
> Can you summarize the project highlights for me?"
33+
Resources,Can you send me any guidelines or templates we have on design requirements for an official IDinsight summary report?
34+
Projects,"Share with me a monitoring and evaluation project we did in Africa, please."
35+
Teams,Can you share the most recent version of our organizational structure and key contact persons?
36+
Teams,What is the full form of DSEM?
37+
Teams,What is the full form of DSEM
38+
Resources,Can you send me the link to the Ethics Review Form?
39+
Policies,What is our compassionate leave policy
40+
Resources,Where can I find a checklist of key tasks to complete during a project?
41+
Miscellaneous,Can you explain the IDinsight's data science capabilities for a client?
42+
Projects,Can you explain all the different phases of our ADP project?
43+
Resources,Can you summarize all the blogs we have done on RCTs?
44+
Projects,Can you explain engineering monitoring systems as a service?
45+
Projects,Can you give me a summary of the Educate Girls project?
46+
Miscellaneous,Can you summarize key requirements for a theory of change document?
47+
Resources,Can you explain IDinsight's knowledge management process for a project?
48+
Resources,What are guidelines on how to run an effective zoom-out or feedback conversation?
49+
Policies,How do I apply for comp leave for my teammates
50+
Projects,Can you share with me in simple words the key findings of the Room to Read LSEP Cambodia project?
51+
Projects,Can you share the list of clients the dignity initiative has partnered with
52+
Resources,Can you share guidelines on collaborating with the technical team?
53+
Policies,what are the stages of an expenses status in Unit4?
54+
Projects,For which projects have we used our VOI resources/service?
55+
Policies,Can you list all the public holidays for the India office this year?
56+
Projects,Can you list all the projects in education that IDinsight has ever done?
57+
Resources,What resources exist for assisting with coding and data analysis in stata?
58+
Policies,Can you list the steps needed to submit reimbursements on Unit 4?
59+
Projects,"Please list all projects that we have done in education where we measure Socio-Emotional Learning (SEL) gains, or where we have used/tested SEL tools (ex. ISELA, IDELA, others)"
60+
Projects,Are there case studies of how we've built capacity in data analysis and reporting?
61+
Policies,Can you provide a list of all the global benefits our staff is eligible for?

0 commit comments

Comments
 (0)