IliaLarchenko commited on
Commit
de9fbbf
1 Parent(s): 9fc1785

Added Beta of system design interview

Browse files
Files changed (4) hide show
  1. app.py +6 -3
  2. resources/data.py +36 -22
  3. resources/prompts.py +35 -0
  4. ui/coding.py +24 -12
app.py CHANGED
@@ -5,9 +5,8 @@ import gradio as gr
5
  from api.audio import STTManager, TTSManager
6
  from api.llm import LLMManager
7
  from config import config
8
- from docs.instruction import instruction
9
  from resources.prompts import prompts
10
- from ui.coding import get_codding_ui
11
  from ui.instructions import get_instructions_ui
12
  from utils.params import default_audio_params
13
 
@@ -22,9 +21,13 @@ default_audio_params["streaming"] = stt.streaming
22
  with gr.Blocks(title="AI Interviewer") as demo:
23
  audio_output = gr.Audio(label="Play audio", autoplay=True, visible=os.environ.get("DEBUG", False), streaming=tts.streaming)
24
  instructions_tab = get_instructions_ui(llm, tts, stt, default_audio_params)
25
- coding_tab = get_codding_ui(llm, tts, stt, default_audio_params, audio_output)
 
 
 
26
 
27
  instructions_tab.render()
28
  coding_tab.render()
 
29
 
30
  demo.launch(show_api=False)
 
5
  from api.audio import STTManager, TTSManager
6
  from api.llm import LLMManager
7
  from config import config
 
8
  from resources.prompts import prompts
9
+ from ui.coding import get_problem_solving_ui
10
  from ui.instructions import get_instructions_ui
11
  from utils.params import default_audio_params
12
 
 
21
  with gr.Blocks(title="AI Interviewer") as demo:
22
  audio_output = gr.Audio(label="Play audio", autoplay=True, visible=os.environ.get("DEBUG", False), streaming=tts.streaming)
23
  instructions_tab = get_instructions_ui(llm, tts, stt, default_audio_params)
24
+ coding_tab = get_problem_solving_ui(llm, tts, stt, default_audio_params, audio_output, name="Coding", interview_type="coding")
25
+ system_design_tab = get_problem_solving_ui(
26
+ llm, tts, stt, default_audio_params, audio_output, name="System Design (Beta)", interview_type="system_design"
27
+ )
28
 
29
  instructions_tab.render()
30
  coding_tab.render()
31
+ system_design_tab.render()
32
 
33
  demo.launch(show_api=False)
resources/data.py CHANGED
@@ -1,25 +1,39 @@
1
- coding_topics_list = [
2
- "Arrays",
3
- "Strings",
4
- "Linked Lists",
5
- "Hash Tables",
6
- "Dynamic Programming",
7
- "Trees",
8
- "Graphs",
9
- "Sorting Algorithms",
10
- "Binary Search",
11
- "Recursion",
12
- "Greedy Algorithms",
13
- "Stack",
14
- "Queue",
15
- "Heaps",
16
- "Depth-First Search (DFS)",
17
- "Breadth-First Search (BFS)",
18
- "Backtracking",
19
- "Bit Manipulation",
20
- "Binary Search Trees",
21
- "Tries",
22
- ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
  fixed_messages = {
25
  "intro": "Nice to meet you! I'm your AI interviewer. Click 'Generate a problem' to start.",
 
1
+ topic_lists = {
2
+ "coding": [
3
+ "Arrays",
4
+ "Strings",
5
+ "Linked Lists",
6
+ "Hash Tables",
7
+ "Dynamic Programming",
8
+ "Trees",
9
+ "Graphs",
10
+ "Sorting Algorithms",
11
+ "Binary Search",
12
+ "Recursion",
13
+ "Greedy Algorithms",
14
+ "Stack",
15
+ "Queue",
16
+ "Heaps",
17
+ "Depth-First Search (DFS)",
18
+ "Breadth-First Search (BFS)",
19
+ "Backtracking",
20
+ "Bit Manipulation",
21
+ "Binary Search Trees",
22
+ "Tries",
23
+ ],
24
+ "system_design": [
25
+ "Machine Learning Systems",
26
+ "Databases",
27
+ "Mobile Application Architecture",
28
+ "Web Services and APIs",
29
+ "Cloud Computing and Storage",
30
+ "Network Architecture and Protocols",
31
+ "Security and Compliance",
32
+ "Distributed Systems",
33
+ "Real-time and Batch Processing",
34
+ "Content Delivery Networks",
35
+ ],
36
+ }
37
 
38
  fixed_messages = {
39
  "intro": "Nice to meet you! I'm your AI interviewer. Click 'Generate a problem' to start.",
resources/prompts.py CHANGED
@@ -34,4 +34,39 @@ prompts = {
34
  "Use code examples to illustrate points where necessary. Your feedback should be critical, aiming to fail candidates who do not meet high standards while providing detailed improvement areas. "
35
  "Format all feedback in clear, structured markdown for readability."
36
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  }
 
34
  "Use code examples to illustrate points where necessary. Your feedback should be critical, aiming to fail candidates who do not meet high standards while providing detailed improvement areas. "
35
  "Format all feedback in clear, structured markdown for readability."
36
  ),
37
+ "system_design_problem_generation_prompt": (
38
+ "You are an AI acting as an interviewer. "
39
+ "Generate a scenario that tests the candidate's ability to architect scalable and robust systems. "
40
+ "Ensure the scenario tests for architectural understanding, integration of different technologies, security considerations, and scalability. "
41
+ "The scenario should be clearly stated, well-formatted, and solvable within 30 minutes. "
42
+ "Ensure the scenario varies each time to provide a wide range of challenges."
43
+ ),
44
+ "system_design_interviewer_prompt": (
45
+ "As an AI interviewer, maintain a professional and analytical demeanor. "
46
+ "Encourage candidates to discuss various architectural choices and trade-offs without giving away direct solutions. Provide hints subtly only after observing significant struggles or upon explicit request. "
47
+ "Probe the candidate with questions related to system scalability, choice of technologies, data flow, security implications, and maintenance strategies to assess their architectural proficiency comprehensively. "
48
+ "If the candidate deviates from the core architectural focus, gently guide them back to the main issues. "
49
+ "After multiple unsuccessful attempts by the candidate to articulate or resolve design flaws, provide more direct hints or rephrase the scenario slightly to aid understanding. "
50
+ "Encourage the candidate to consider the practical implications of their design choices, asking how changes in system requirements might impact their architecture. "
51
+ "Discuss the trade-offs in their design decisions, encouraging them to justify their choices based on performance, cost, and complexity. "
52
+ "Prompt the candidate to explain potential scaling strategies and how they would handle increased load or data volume. "
53
+ "Keep your interactions concise and clear, avoiding overly technical language or complex explanations that could confuse the candidate."
54
+ ),
55
+ "system_design_grading_feedback_prompt": (
56
+ "You are the AI grader for an interview. "
57
+ "The following is the interview transcript with the candidate's responses. "
58
+ "Ignore minor transcription errors unless they impact comprehension. "
59
+ "Evaluate the candidate’s performance based on the following criteria: "
60
+ "\n- **Architectural Understanding**: Knowledge of system components and their interactions."
61
+ "\n- **Technology Integration**: Usage of appropriate technologies and frameworks considering the problem's context."
62
+ "\n- **Scalability and Performance**: Ability to design systems that can scale efficiently and maintain performance."
63
+ "\n- **Security Awareness**: Consideration of potential security risks and mitigation strategies."
64
+ "\n- **System Robustness**: Design resilience and handling of potential system failures."
65
+ "\n- **Communication Skills**: Ability to articulate design decisions and respond to hypothetical changes."
66
+ "\n- **Problem Solving and Creativity**: Creativity in approaching complex system issues and solving problems."
67
+ "\n- **Decision Making**: Justification of design choices and trade-offs made during the discussion."
68
+ "\nProvide comprehensive feedback, detailing overall performance, specific design flaws, areas for improvement, communication issues, and other relevant observations. "
69
+ "Use system diagrams or pseudo-code to illustrate points where necessary. Your feedback should be critical, aiming to fail candidates who do not meet high standards while providing constructive areas for improvement. "
70
+ "Format all feedback in clear, structured markdown for readability."
71
+ ),
72
  }
ui/coding.py CHANGED
@@ -1,16 +1,16 @@
1
  import gradio as gr
2
  import numpy as np
3
 
4
- from resources.data import coding_topics_list, fixed_messages
5
  from utils.ui import add_candidate_message, add_interviewer_message
6
 
7
 
8
- def get_codding_ui(llm, tts, stt, default_audio_params, audio_output):
9
- with gr.Tab("Coding", render=False) as coding_tab:
10
  chat_history = gr.State([])
11
  previous_code = gr.State("")
12
  started_coding = gr.State(False)
13
- interview_type = gr.State("coding")
14
  with gr.Accordion("Settings") as init_acc:
15
  with gr.Row():
16
  with gr.Column():
@@ -27,7 +27,11 @@ def get_codding_ui(llm, tts, stt, default_audio_params, audio_output):
27
  with gr.Row():
28
  gr.Markdown("Topic (can type custom value)")
29
  topic_select = gr.Dropdown(
30
- label="Select topic", choices=coding_topics_list, value="Arrays", container=False, allow_custom_value=True
 
 
 
 
31
  )
32
  with gr.Column(scale=2):
33
  requirements = gr.Textbox(label="Requirements", placeholder="Specify additional requirements", lines=5)
@@ -38,11 +42,19 @@ def get_codding_ui(llm, tts, stt, default_audio_params, audio_output):
38
  with gr.Accordion("Solution", open=False) as solution_acc:
39
  with gr.Row() as content:
40
  with gr.Column(scale=2):
41
- code = gr.Code(
42
- label="Please write your code here. You can use any language, but only Python syntax highlighting is available.",
43
- language="python",
44
- lines=46,
45
- )
 
 
 
 
 
 
 
 
46
  with gr.Column(scale=1):
47
  end_btn = gr.Button("Finish the interview", interactive=False)
48
  chat = gr.Chatbot(label="Chat", show_label=False, show_share_button=False)
@@ -119,8 +131,8 @@ def get_codding_ui(llm, tts, stt, default_audio_params, audio_output):
119
  fn=lambda: gr.update(interactive=True), outputs=[send_btn]
120
  ).success(fn=lambda: None, outputs=[audio_input])
121
 
122
- coding_tab.select(fn=add_interviewer_message(fixed_messages["intro"]), inputs=[chat, started_coding], outputs=[chat]).success(
123
  fn=tts.read_last_message, inputs=[chat], outputs=[audio_output]
124
  )
125
 
126
- return coding_tab
 
1
  import gradio as gr
2
  import numpy as np
3
 
4
+ from resources.data import fixed_messages, topic_lists
5
  from utils.ui import add_candidate_message, add_interviewer_message
6
 
7
 
8
+ def get_problem_solving_ui(llm, tts, stt, default_audio_params, audio_output, name="Coding", interview_type="coding"):
9
+ with gr.Tab(name, render=False) as problem_tab:
10
  chat_history = gr.State([])
11
  previous_code = gr.State("")
12
  started_coding = gr.State(False)
13
+ interview_type = gr.State(interview_type)
14
  with gr.Accordion("Settings") as init_acc:
15
  with gr.Row():
16
  with gr.Column():
 
27
  with gr.Row():
28
  gr.Markdown("Topic (can type custom value)")
29
  topic_select = gr.Dropdown(
30
+ label="Select topic",
31
+ choices=topic_lists[interview_type.value],
32
+ value=topic_lists[interview_type.value][0],
33
+ container=False,
34
+ allow_custom_value=True,
35
  )
36
  with gr.Column(scale=2):
37
  requirements = gr.Textbox(label="Requirements", placeholder="Specify additional requirements", lines=5)
 
42
  with gr.Accordion("Solution", open=False) as solution_acc:
43
  with gr.Row() as content:
44
  with gr.Column(scale=2):
45
+ if interview_type == "coding":
46
+ code = gr.Code(
47
+ label="Please write your code here. You can use any language, but only Python syntax highlighting is available.",
48
+ language="python",
49
+ lines=46,
50
+ )
51
+ else:
52
+ code = gr.Textbox(
53
+ label="Please write any notes for your solution here.",
54
+ lines=46,
55
+ max_lines=46,
56
+ show_label=False,
57
+ )
58
  with gr.Column(scale=1):
59
  end_btn = gr.Button("Finish the interview", interactive=False)
60
  chat = gr.Chatbot(label="Chat", show_label=False, show_share_button=False)
 
131
  fn=lambda: gr.update(interactive=True), outputs=[send_btn]
132
  ).success(fn=lambda: None, outputs=[audio_input])
133
 
134
+ problem_tab.select(fn=add_interviewer_message(fixed_messages["intro"]), inputs=[chat, started_coding], outputs=[chat]).success(
135
  fn=tts.read_last_message, inputs=[chat], outputs=[audio_output]
136
  )
137
 
138
+ return problem_tab