Skip to content
This repository was archived by the owner on Dec 11, 2024. It is now read-only.

Commit 8a9b16f

Browse files
committed
Make Internet Search a system persona
Signed-off-by: Alex Co <[email protected]>
1 parent d8c25a0 commit 8a9b16f

File tree

5 files changed

+39
-14
lines changed

5 files changed

+39
-14
lines changed

backend/danswer/chat/load_yamls.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,17 @@ def load_personas_from_yaml(
9696
# Set specific overrides for image generation persona
9797
if persona.get("image_generation"):
9898
llm_model_version_override = "gpt-4o"
99-
99+
100+
# Load Internet Search Tool.
101+
if persona.get("internet_search"):
102+
internet_search_tool = (
103+
db_session.query(ToolDBModel)
104+
.filter(ToolDBModel.name == "InternetSearchTool")
105+
.first()
106+
)
107+
if internet_search_tool:
108+
tool_ids.append(internet_search_tool.id)
109+
100110
existing_persona = (
101111
db_session.query(Persona)
102112
.filter(Persona.name == persona["name"])

backend/danswer/chat/personas.yaml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ personas:
1919
# Default number of chunks to include as context, set to 0 to disable retrieval
2020
# Remove the field to set to the system default number of chunks/tokens to pass to Gen AI
2121
# Each chunk is 512 tokens long
22-
num_chunks: 50
22+
num_chunks: 20
2323
# Enable/Disable usage of the LLM chunk filter feature whereby each chunk is passed to the LLM to determine
2424
# if the chunk is useful or not towards the latest user query
2525
# This feature can be overriden for all personas via DISABLE_LLM_CHUNK_FILTER env variable
26-
llm_relevance_filter: false
26+
llm_relevance_filter: true
2727
# Enable/Disable usage of the LLM to extract query time filters including source type and time range filters
2828
llm_filter_extraction: true
2929
# Decay documents priority as they age, options are:
@@ -44,11 +44,11 @@ personas:
4444
document_sets: []
4545
icon_shape: 23013
4646
icon_color: "#6FB1FF"
47-
display_priority: 1
47+
display_priority: 0
4848
is_visible: true
4949

5050
- id: 1
51-
name: "General"
51+
name: "General GPT"
5252
description: >
5353
Assistant with no access to documents. Chat with just the Large Language Model.
5454
prompts:
@@ -60,24 +60,25 @@ personas:
6060
document_sets: []
6161
icon_shape: 50910
6262
icon_color: "#FF6F6F"
63-
display_priority: 0
63+
display_priority: 1
6464
is_visible: true
6565

6666
- id: 2
67-
name: "Paraphrase"
67+
name: "GPT Internet Search"
6868
description: >
69-
Assistant that is heavily constrained and only provides exact quotes from Connected Sources.
69+
Use this Assistant to search the Internet for you (via Bing) and getting the answer
7070
prompts:
71-
- "Paraphrase"
72-
num_chunks: 10
71+
- "InternetSearch"
72+
num_chunks: 0
7373
llm_relevance_filter: true
7474
llm_filter_extraction: true
7575
recency_bias: "auto"
7676
document_sets: []
7777
icon_shape: 45519
7878
icon_color: "#6FFF8D"
7979
display_priority: 2
80-
is_visible: false
80+
is_visible: true
81+
internet_search: true
8182

8283

8384
- id: 3
@@ -95,4 +96,4 @@ personas:
9596
icon_color: "#9B59B6"
9697
image_generation: true
9798
display_priority: 3
98-
is_visible: true
99+
is_visible: false

backend/danswer/chat/prompts.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,18 @@ prompts:
107107
directly from the documents.
108108
datetime_aware: true
109109
include_citations: true
110+
111+
- name: "InternetSearch"
112+
description: "Use this Assistant to search the Internet for you (via Bing) and getting the answer"
113+
system: >
114+
You are an intelligent AI agent designed to assist users by providing accurate and relevant information through internet searches. Your primary objectives are:
115+
Information Retrieval: Search the internet to find reliable and up-to-date information based on user queries. Ensure that the sources you reference are credible and trustworthy.
116+
Context Understanding: Analyze user questions to understand context and intent. Provide answers that are directly related to the user's needs, offering additional context when necessary.
117+
Summarization: When presenting information, summarize findings clearly and concisely. Highlight key points and relevant details to enhance user understanding.
118+
User Engagement: Maintain a friendly and engaging tone in your responses. Encourage users to ask follow-up questions or request further information.
119+
Privacy and Safety: Respect user privacy and ensure that any personal information is handled securely. Avoid sharing sensitive or inappropriate content.
120+
Continuous Learning: Adapt and improve your responses based on user interactions and feedback. Stay updated with the latest information and trends to provide the best assistance.
121+
task: >
122+
Search the internet for relevant information based on the user query. Provide a concise summary of the findings and include the sources of information.
123+
datetime_aware: true
124+
include_citations: true

backend/danswer/tools/built_in_tools.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ def auto_add_search_tool_to_personas(db_session: Session) -> None:
146146
db_session.commit()
147147
logger.notice("Completed adding SearchTool to relevant Personas.")
148148

149-
150149
_built_in_tools_cache: dict[int, Type[Tool]] | None = None
151150

152151

backend/requirements/default.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ asyncpg==0.27.0
44
atlassian-python-api==3.37.0
55
beautifulsoup4==4.12.2
66
boto3==1.34.84
7-
celery[redis]==5.3.4
7+
celery==5.3.4
88
boto3==1.34.84
99
chardet==5.2.0
1010
dask==2023.8.1

0 commit comments

Comments
 (0)