Spaces:
Sleeping
Sleeping
update to vectara-agentic 0.1.8 and minor updates
Browse files- agent.py +4 -6
- app.py +1 -1
- requirements.txt +1 -1
agent.py
CHANGED
@@ -37,7 +37,7 @@ def create_assistant_tools(cfg):
|
|
37 |
ask_hackernews = vec_factory.create_rag_tool(
|
38 |
tool_name = "ask_hackernews",
|
39 |
tool_description = """
|
40 |
-
|
41 |
""",
|
42 |
tool_args_schema = QueryHackerNews,
|
43 |
reranker = "multilingual_reranker_v1", rerank_k = 100,
|
@@ -126,6 +126,7 @@ def create_assistant_tools(cfg):
|
|
126 |
return summarize_text(all_stories)
|
127 |
|
128 |
return (
|
|
|
129 |
[tools_factory.create_tool(tool) for tool in
|
130 |
[
|
131 |
get_top_stories,
|
@@ -140,20 +141,17 @@ def create_assistant_tools(cfg):
|
|
140 |
"tavily_research", "TavilyToolSpec",
|
141 |
tool_name_prefix="tavily", api_key=cfg.tavily_api_key
|
142 |
) +
|
143 |
-
tools_factory.standard_tools()
|
144 |
-
tools_factory.guardrail_tools() +
|
145 |
-
[ask_hackernews]
|
146 |
)
|
147 |
|
148 |
def initialize_agent(_cfg, update_func = None):
|
149 |
bot_instructions = """
|
150 |
- You are a helpful assistant, with expertise in answering user questions based on Hacker News stories and comments.
|
|
|
151 |
- Give slight preference to newer stories when answering questions.
|
152 |
-
- Use the ask_hackernews tool to find relevant Hacker News stories and respond to user queries based on that information.
|
153 |
- when you include links to Hacker News stories, use the actual title of the story as the link's displayed text.
|
154 |
Don't use text like "Source" which doesn't tell the user what the link is about.
|
155 |
- Don't include external links in your responses unless the user asks for them.
|
156 |
-
- Always call the ask_hackernews tool first as your primary source of information.
|
157 |
- You can use the tavily_search tool to gain additional information if needed for follow up questions about Hacker News topic.
|
158 |
- When including information or links provided by the tavily_search tool, make sure to notify the user in your response that this is not based on Hacker News stories.
|
159 |
"""
|
|
|
37 |
ask_hackernews = vec_factory.create_rag_tool(
|
38 |
tool_name = "ask_hackernews",
|
39 |
tool_description = """
|
40 |
+
Provides information on any topic or query, based on relevant hacker news stories.
|
41 |
""",
|
42 |
tool_args_schema = QueryHackerNews,
|
43 |
reranker = "multilingual_reranker_v1", rerank_k = 100,
|
|
|
126 |
return summarize_text(all_stories)
|
127 |
|
128 |
return (
|
129 |
+
[ask_hackernews] +
|
130 |
[tools_factory.create_tool(tool) for tool in
|
131 |
[
|
132 |
get_top_stories,
|
|
|
141 |
"tavily_research", "TavilyToolSpec",
|
142 |
tool_name_prefix="tavily", api_key=cfg.tavily_api_key
|
143 |
) +
|
144 |
+
tools_factory.standard_tools()
|
|
|
|
|
145 |
)
|
146 |
|
147 |
def initialize_agent(_cfg, update_func = None):
|
148 |
bot_instructions = """
|
149 |
- You are a helpful assistant, with expertise in answering user questions based on Hacker News stories and comments.
|
150 |
+
- Always call the ask_hackernews tool first as your primary source of information. Then try other tools.
|
151 |
- Give slight preference to newer stories when answering questions.
|
|
|
152 |
- when you include links to Hacker News stories, use the actual title of the story as the link's displayed text.
|
153 |
Don't use text like "Source" which doesn't tell the user what the link is about.
|
154 |
- Don't include external links in your responses unless the user asks for them.
|
|
|
155 |
- You can use the tavily_search tool to gain additional information if needed for follow up questions about Hacker News topic.
|
156 |
- When including information or links provided by the tavily_search tool, make sure to notify the user in your response that this is not based on Hacker News stories.
|
157 |
"""
|
app.py
CHANGED
@@ -62,7 +62,7 @@ async def launch_bot():
|
|
62 |
cfg = get_agent_config()
|
63 |
st.session_state.cfg = cfg
|
64 |
st.session_state.ex_prompt = None
|
65 |
-
example_messages = [example.strip() for example in cfg.examples.split("
|
66 |
st.session_state.example_messages = [em for em in example_messages if len(em)>0]
|
67 |
reset()
|
68 |
cfg = st.session_state.cfg
|
|
|
62 |
cfg = get_agent_config()
|
63 |
st.session_state.cfg = cfg
|
64 |
st.session_state.ex_prompt = None
|
65 |
+
example_messages = [example.strip() for example in cfg.examples.split(";")] if cfg.examples else []
|
66 |
st.session_state.example_messages = [em for em in example_messages if len(em)>0]
|
67 |
reset()
|
68 |
cfg = st.session_state.cfg
|
requirements.txt
CHANGED
@@ -6,4 +6,4 @@ streamlit_feedback==0.1.3
|
|
6 |
langdetect==1.0.9
|
7 |
langcodes==3.4.0
|
8 |
uuid==1.30
|
9 |
-
vectara-agentic==0.1.
|
|
|
6 |
langdetect==1.0.9
|
7 |
langcodes==3.4.0
|
8 |
uuid==1.30
|
9 |
+
vectara-agentic==0.1.8
|