Spaces:
Running
Running
bump vectara-agentic to 0.1.7
Browse files- agent.py +4 -2
- app.py +6 -5
- requirements.txt +1 -1
agent.py
CHANGED
@@ -84,16 +84,18 @@ def create_assistant_tools(cfg):
|
|
84 |
story_id: str = Field(..., description="The story ID.")
|
85 |
) -> Tuple[str, str]:
|
86 |
"""
|
87 |
-
Get the title of a story from hacker news.
|
88 |
Returns:
|
89 |
- The title of the story (str)
|
90 |
- The main URL of the story (str)
|
91 |
- The external link pointed to in the story (str)
|
|
|
|
|
92 |
"""
|
93 |
db_url = 'https://hacker-news.firebaseio.com/v0/'
|
94 |
story = requests.get(f"{db_url}item/{story_id}.json").json()
|
95 |
story_url = f'https://news.ycombinator.com/item?id={story_id}'
|
96 |
-
return story['title'], story_url, story['url'],
|
97 |
|
98 |
def get_story_text(
|
99 |
story_id: str = Field(..., description="The story ID.")
|
|
|
84 |
story_id: str = Field(..., description="The story ID.")
|
85 |
) -> Tuple[str, str]:
|
86 |
"""
|
87 |
+
Get the title, url and external link of a story from hacker news.
|
88 |
Returns:
|
89 |
- The title of the story (str)
|
90 |
- The main URL of the story (str)
|
91 |
- The external link pointed to in the story (str)
|
92 |
+
- The author of the story
|
93 |
+
- The number of descendants (comments + replies) of the story
|
94 |
"""
|
95 |
db_url = 'https://hacker-news.firebaseio.com/v0/'
|
96 |
story = requests.get(f"{db_url}item/{story_id}.json").json()
|
97 |
story_url = f'https://news.ycombinator.com/item?id={story_id}'
|
98 |
+
return story['title'], story_url, story['url'], story['by'], story['descendants']
|
99 |
|
100 |
def get_story_text(
|
101 |
story_id: str = Field(..., description="The story ID.")
|
app.py
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
from PIL import Image
|
2 |
import sys
|
3 |
-
import os
|
4 |
-
import requests
|
5 |
-
import json
|
6 |
import uuid
|
7 |
|
|
|
|
|
|
|
8 |
import streamlit as st
|
9 |
from streamlit_pills import pills
|
10 |
from streamlit_feedback import streamlit_feedback
|
@@ -46,7 +46,7 @@ def update_func(status_type: AgentStatusType, msg: str):
|
|
46 |
output = f"{status_type.value} - {msg}"
|
47 |
st.session_state.log_messages.append(output)
|
48 |
|
49 |
-
def launch_bot():
|
50 |
def reset():
|
51 |
st.session_state.messages = [{"role": "assistant", "content": initial_prompt, "avatar": "🦖"}]
|
52 |
st.session_state.thinking_message = "Agent at work..."
|
@@ -163,4 +163,5 @@ def launch_bot():
|
|
163 |
|
164 |
if __name__ == "__main__":
|
165 |
st.set_page_config(page_title="Hacker News Assistant", layout="wide")
|
166 |
-
|
|
|
|
1 |
from PIL import Image
|
2 |
import sys
|
|
|
|
|
|
|
3 |
import uuid
|
4 |
|
5 |
+
import nest_asyncio
|
6 |
+
import asyncio
|
7 |
+
|
8 |
import streamlit as st
|
9 |
from streamlit_pills import pills
|
10 |
from streamlit_feedback import streamlit_feedback
|
|
|
46 |
output = f"{status_type.value} - {msg}"
|
47 |
st.session_state.log_messages.append(output)
|
48 |
|
49 |
+
async def launch_bot():
|
50 |
def reset():
|
51 |
st.session_state.messages = [{"role": "assistant", "content": initial_prompt, "avatar": "🦖"}]
|
52 |
st.session_state.thinking_message = "Agent at work..."
|
|
|
163 |
|
164 |
if __name__ == "__main__":
|
165 |
st.set_page_config(page_title="Hacker News Assistant", layout="wide")
|
166 |
+
nest_asyncio.apply()
|
167 |
+
asyncio.run(launch_bot())
|
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.7
|