milwright commited on
Commit
c4564a6
·
verified ·
1 Parent(s): fe0344d

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +15 -8
  2. config.json +6 -6
app.py CHANGED
@@ -10,11 +10,11 @@ import urllib.parse
10
 
11
 
12
  # Configuration
13
- SPACE_NAME = "CUNY Virgil"
14
- SPACE_DESCRIPTION = "An AI reading and research guide, with a twist"
15
 
16
  # Default configuration values
17
- DEFAULT_SYSTEM_PROMPT = """You are Virgil, a college-level research assistant specializing in academic literature search and analysis, with critical pedagogical values and subtle brevity in your responses. Employ clear, accessible language that demystifies complex research, and propose connected research directions when appropriate. Your purpose is to serve as an informed research tool supporting users through initial concept development, exploratory investigation, information collection, and source compilation."""
18
  DEFAULT_TEMPERATURE = 0.7
19
  DEFAULT_MAX_TOKENS = 750
20
 
@@ -33,8 +33,8 @@ except:
33
  max_tokens = DEFAULT_MAX_TOKENS
34
  print("ℹ️ Using default configuration")
35
 
36
- MODEL = "nvidia/llama-3.1-nemotron-70b-instruct"
37
- THEME = "Glass" # Gradio theme name
38
  GROUNDING_URLS = []
39
  # Get access code from environment variable for security
40
  # If ACCESS_CODE is not set, no access control is applied
@@ -549,7 +549,7 @@ with gr.Blocks(title=SPACE_NAME, theme=theme_class()) as demo:
549
  fn=store_and_generate_response, # Use wrapper function to store history
550
  title="", # Title already shown above
551
  description="", # Description already shown above
552
- examples=['What can you help me research?', 'Why is your name Virgil?'],
553
  type="messages" # Use modern message format for better compatibility
554
  )
555
 
@@ -791,8 +791,15 @@ with gr.Blocks(title=SPACE_NAME, theme=theme_class()) as demo:
791
  with open('config.json', 'w') as f:
792
  json.dump(current_full_config, f, indent=2)
793
 
794
- # Reload all configuration values
795
- reload_config_values()
 
 
 
 
 
 
 
796
 
797
  # Determine which changes require restart
798
  restart_required = False
 
10
 
11
 
12
  # Configuration
13
+ SPACE_NAME = "AI Assistant"
14
+ SPACE_DESCRIPTION = "A customizable AI assistant"
15
 
16
  # Default configuration values
17
+ DEFAULT_SYSTEM_PROMPT = """You are a research aid specializing in academic literature search and analysis. Your expertise spans discovering peer-reviewed sources, assessing research methodologies, synthesizing findings across studies, and delivering properly formatted citations. When responding, anchor claims in specific sources from provided URL contexts, differentiate between direct evidence and interpretive analysis, and note any limitations or contradictory results. Employ clear, accessible language that demystifies complex research, and propose connected research directions when appropriate. Your purpose is to serve as an informed research tool supporting users through initial concept development, exploratory investigation, information collection, and source compilation."""
18
  DEFAULT_TEMPERATURE = 0.7
19
  DEFAULT_MAX_TOKENS = 750
20
 
 
33
  max_tokens = DEFAULT_MAX_TOKENS
34
  print("ℹ️ Using default configuration")
35
 
36
+ MODEL = "google/gemini-2.0-flash-001"
37
+ THEME = "Default" # Gradio theme name
38
  GROUNDING_URLS = []
39
  # Get access code from environment variable for security
40
  # If ACCESS_CODE is not set, no access control is applied
 
549
  fn=store_and_generate_response, # Use wrapper function to store history
550
  title="", # Title already shown above
551
  description="", # Description already shown above
552
+ examples=['Hello! How can you help me?', 'Tell me something interesting', 'What can you do?'],
553
  type="messages" # Use modern message format for better compatibility
554
  )
555
 
 
791
  with open('config.json', 'w') as f:
792
  json.dump(current_full_config, f, indent=2)
793
 
794
+ # Reload all configuration values from the saved config
795
+ global SPACE_NAME, SPACE_DESCRIPTION, SYSTEM_PROMPT, MODEL, temperature, max_tokens, GROUNDING_URLS
796
+ SPACE_NAME = current_full_config.get('name', SPACE_NAME)
797
+ SPACE_DESCRIPTION = current_full_config.get('description', SPACE_DESCRIPTION)
798
+ SYSTEM_PROMPT = current_full_config.get('system_prompt', SYSTEM_PROMPT)
799
+ MODEL = current_full_config.get('model', MODEL)
800
+ temperature = current_full_config.get('temperature', temperature)
801
+ max_tokens = current_full_config.get('max_tokens', max_tokens)
802
+ GROUNDING_URLS = current_full_config.get('grounding_urls', GROUNDING_URLS)
803
 
804
  # Determine which changes require restart
805
  restart_required = False
config.json CHANGED
@@ -1,13 +1,13 @@
1
  {
2
- "name": "CUNY Virgil",
3
- "description": "An AI reading and research guide, with a twist",
4
- "system_prompt": "You are Virgil, a college-level research assistant specializing in academic literature search and analysis, with critical pedagogical values and subtle brevity in your responses. Employ clear, accessible language that demystifies complex research, and propose connected research directions when appropriate. Your purpose is to serve as an informed research tool supporting users through initial concept development, exploratory investigation, information collection, and source compilation.",
5
- "model": "nvidia/llama-3.1-nemotron-70b-instruct",
6
  "api_key_var": "API_KEY",
7
  "temperature": 0.7,
8
  "max_tokens": 750,
9
- "examples": "['What can you help me research?', 'Why is your name Virgil?']",
10
  "grounding_urls": "[]",
11
  "enable_dynamic_urls": true,
12
- "theme": "Glass"
13
  }
 
1
  {
2
+ "name": "AI Assistant",
3
+ "description": "A customizable AI assistant",
4
+ "system_prompt": "You are a research aid specializing in academic literature search and analysis. Your expertise spans discovering peer-reviewed sources, assessing research methodologies, synthesizing findings across studies, and delivering properly formatted citations. When responding, anchor claims in specific sources from provided URL contexts, differentiate between direct evidence and interpretive analysis, and note any limitations or contradictory results. Employ clear, accessible language that demystifies complex research, and propose connected research directions when appropriate. Your purpose is to serve as an informed research tool supporting users through initial concept development, exploratory investigation, information collection, and source compilation.",
5
+ "model": "google/gemini-2.0-flash-001",
6
  "api_key_var": "API_KEY",
7
  "temperature": 0.7,
8
  "max_tokens": 750,
9
+ "examples": "['Hello! How can you help me?', 'Tell me something interesting', 'What can you do?']",
10
  "grounding_urls": "[]",
11
  "enable_dynamic_urls": true,
12
+ "theme": "Default"
13
  }