Svngoku commited on
Commit
c3fde59
Β·
verified Β·
1 Parent(s): b221514

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -15
app.py CHANGED
@@ -1,4 +1,4 @@
1
- # unsloth_doc_app.py
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": "Unsloth Documentation Search",
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 Unsloth Documentation Agent"""
35
  tools = [
36
  DuckDuckGoSearchTool(),
37
  VisitWebpageTool()
@@ -44,8 +44,8 @@ def initialize_unsloth_agent(model=None):
44
  )
45
 
46
  return CodeAgent(
47
- name="unsloth_agent",
48
- description="Unsloth Documentation AI Agent",
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("πŸ“˜ Unsloth Documentation Search")
61
  st.markdown("""
62
- This tool uses an AI agent to help you explore Unsloth documentation.
63
- Ask questions about Unsloth features, usage, or troubleshooting.
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 Unsloth 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 Unsloth" or "Unsloth fine-tuning guide".
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 Unsloth 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 fine-tune with Unsloth"
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 Unsloth documentation..."):
110
  try:
111
- results = st.session_state.agent.run(search_query, additional_args={"sources" : ["https://docs.unsloth.ai/"],"instructions": "Response to the user answer as a structured documentation format."})
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 Unsloth")
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()