Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
#
|
2 |
import streamlit as st
|
3 |
import os
|
4 |
from smolagents import (
|
@@ -18,7 +18,7 @@ from typing import List, Dict, Any
|
|
18 |
|
19 |
# Configuration
|
20 |
PAGE_CONFIG = {
|
21 |
-
"page_title": "
|
22 |
"page_icon": "π",
|
23 |
"layout": "wide"
|
24 |
}
|
@@ -31,7 +31,7 @@ AUTHORIZED_IMPORTS: List[str] = [
|
|
31 |
|
32 |
# Agent Initialization
|
33 |
def initialize_unsloth_agent(model=None):
|
34 |
-
"""Initialize the
|
35 |
tools = [
|
36 |
DuckDuckGoSearchTool(),
|
37 |
VisitWebpageTool()
|
@@ -44,8 +44,8 @@ def initialize_unsloth_agent(model=None):
|
|
44 |
)
|
45 |
|
46 |
return CodeAgent(
|
47 |
-
name="
|
48 |
-
description="
|
49 |
tools=tools,
|
50 |
model=model,
|
51 |
max_steps=12,
|
@@ -57,10 +57,10 @@ def setup_ui():
|
|
57 |
"""Setup Streamlit UI components"""
|
58 |
st.set_page_config(**PAGE_CONFIG)
|
59 |
|
60 |
-
st.title("
|
61 |
st.markdown("""
|
62 |
-
This tool uses an AI agent to help you explore
|
63 |
-
Ask questions about
|
64 |
""")
|
65 |
|
66 |
def display_results(results: str):
|
@@ -73,14 +73,14 @@ def setup_sidebar():
|
|
73 |
with st.sidebar:
|
74 |
st.markdown("### About This Tool")
|
75 |
st.markdown("""
|
76 |
-
This agent specializes in
|
77 |
- π Quick answers from web searches
|
78 |
- π Webpage content retrieval
|
79 |
- π€ AI-powered insights
|
80 |
""")
|
81 |
st.markdown("### Tips")
|
82 |
st.markdown("""
|
83 |
-
- Use specific queries like "How to install
|
84 |
- Results may include raw data from searches or webpages.
|
85 |
""")
|
86 |
|
@@ -95,20 +95,20 @@ def main():
|
|
95 |
setup_sidebar()
|
96 |
|
97 |
if 'agent' not in st.session_state:
|
98 |
-
with st.spinner("Initializing
|
99 |
st.session_state.agent = initialize_app()
|
100 |
|
101 |
search_query = st.text_input(
|
102 |
"π Search Unsloth Documentation",
|
103 |
-
placeholder="E.g., How to
|
104 |
)
|
105 |
|
106 |
# Single button to handle both cases
|
107 |
if st.button("Search", type="primary", key="search_button"):
|
108 |
if search_query:
|
109 |
-
with st.spinner("Searching
|
110 |
try:
|
111 |
-
results = st.session_state.agent.run(search_query, additional_args={"
|
112 |
display_results(results)
|
113 |
|
114 |
st.markdown("---")
|
@@ -123,7 +123,7 @@ def main():
|
|
123 |
st.warning("Please enter a search query.")
|
124 |
|
125 |
st.markdown("---")
|
126 |
-
st.caption("Powered by SmolAgents and
|
127 |
|
128 |
if __name__ == "__main__":
|
129 |
main()
|
|
|
1 |
+
# Koyeb Agent.py
|
2 |
import streamlit as st
|
3 |
import os
|
4 |
from smolagents import (
|
|
|
18 |
|
19 |
# Configuration
|
20 |
PAGE_CONFIG = {
|
21 |
+
"page_title": "Koyeb Documentation Search",
|
22 |
"page_icon": "π",
|
23 |
"layout": "wide"
|
24 |
}
|
|
|
31 |
|
32 |
# Agent Initialization
|
33 |
def initialize_unsloth_agent(model=None):
|
34 |
+
"""Initialize the Koyeb Documentation Agent"""
|
35 |
tools = [
|
36 |
DuckDuckGoSearchTool(),
|
37 |
VisitWebpageTool()
|
|
|
44 |
)
|
45 |
|
46 |
return CodeAgent(
|
47 |
+
name="koyeb_agent",
|
48 |
+
description="Koyeb Documentation AI Agent",
|
49 |
tools=tools,
|
50 |
model=model,
|
51 |
max_steps=12,
|
|
|
57 |
"""Setup Streamlit UI components"""
|
58 |
st.set_page_config(**PAGE_CONFIG)
|
59 |
|
60 |
+
st.title("π» Koyeb Documentation Search")
|
61 |
st.markdown("""
|
62 |
+
This tool uses an AI agent to help you explore Koyeb documentation.
|
63 |
+
Ask questions about Koyeb features, usage, or troubleshooting.
|
64 |
""")
|
65 |
|
66 |
def display_results(results: str):
|
|
|
73 |
with st.sidebar:
|
74 |
st.markdown("### About This Tool")
|
75 |
st.markdown("""
|
76 |
+
This agent specializes in Koyeb documentation, providing:
|
77 |
- π Quick answers from web searches
|
78 |
- π Webpage content retrieval
|
79 |
- π€ AI-powered insights
|
80 |
""")
|
81 |
st.markdown("### Tips")
|
82 |
st.markdown("""
|
83 |
+
- Use specific queries like "How to install Koyeb cli" or "Koyeb deepseek model deployment".
|
84 |
- Results may include raw data from searches or webpages.
|
85 |
""")
|
86 |
|
|
|
95 |
setup_sidebar()
|
96 |
|
97 |
if 'agent' not in st.session_state:
|
98 |
+
with st.spinner("Initializing Koyeb Documentation Agent..."):
|
99 |
st.session_state.agent = initialize_app()
|
100 |
|
101 |
search_query = st.text_input(
|
102 |
"π Search Unsloth Documentation",
|
103 |
+
placeholder="E.g., How to use Terraform with the koyeb provider ?"
|
104 |
)
|
105 |
|
106 |
# Single button to handle both cases
|
107 |
if st.button("Search", type="primary", key="search_button"):
|
108 |
if search_query:
|
109 |
+
with st.spinner("Searching Koyeb documentation..."):
|
110 |
try:
|
111 |
+
results = st.session_state.agent.run(search_query, additional_args={"reference_websites": ['https://www.koyeb.com/docs', 'https://www.koyeb.com/tutorials', 'https://www.koyeb.com/deploy'],"instructions": "Response to the user answer as a structured documentation format."})
|
112 |
display_results(results)
|
113 |
|
114 |
st.markdown("---")
|
|
|
123 |
st.warning("Please enter a search query.")
|
124 |
|
125 |
st.markdown("---")
|
126 |
+
st.caption("Powered by SmolAgents and Koyeb")
|
127 |
|
128 |
if __name__ == "__main__":
|
129 |
main()
|