Spaces:
Sleeping
Sleeping
add example questions
Browse files
src/know_lang_bot/chat_bot/chat_interface.py
CHANGED
@@ -151,12 +151,27 @@ class CodeQAChatInterface:
|
|
151 |
height=600
|
152 |
)
|
153 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
msg = gr.Textbox(
|
155 |
label="Ask about the codebase",
|
156 |
-
placeholder="
|
157 |
container=False,
|
158 |
scale=7
|
159 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
|
161 |
with gr.Row():
|
162 |
submit = gr.Button("Submit", scale=1)
|
@@ -165,7 +180,7 @@ class CodeQAChatInterface:
|
|
165 |
async def respond(message: str, history: List[ChatMessage], request: gr.Request) -> AsyncGenerator[List[ChatMessage], None]:
|
166 |
async for updated_history in self.stream_response(message, history, request):
|
167 |
yield updated_history
|
168 |
-
|
169 |
# Set up event handlers
|
170 |
msg.submit(respond, [msg, chatbot], [chatbot])
|
171 |
submit.click(respond, [msg, chatbot], [chatbot])
|
|
|
151 |
height=600
|
152 |
)
|
153 |
|
154 |
+
# Add example questions
|
155 |
+
example_questions = [
|
156 |
+
"How does Trainer handle distributed training and gradient accumulation? Explain the implementation details.",
|
157 |
+
"How does the text generation pipeline handle chat-based generation and template processing?",
|
158 |
+
"How does the transformers library automatically select and configure the appropriate quantization method?",
|
159 |
+
"How to implement top-k filtering for text generation?"
|
160 |
+
]
|
161 |
+
|
162 |
msg = gr.Textbox(
|
163 |
label="Ask about the codebase",
|
164 |
+
placeholder="what are the key components required to implement a new quantization method?",
|
165 |
container=False,
|
166 |
scale=7
|
167 |
)
|
168 |
+
|
169 |
+
gr.Examples(
|
170 |
+
examples=example_questions,
|
171 |
+
inputs=msg,
|
172 |
+
label="Example Questions",
|
173 |
+
examples_per_page=6
|
174 |
+
)
|
175 |
|
176 |
with gr.Row():
|
177 |
submit = gr.Button("Submit", scale=1)
|
|
|
180 |
async def respond(message: str, history: List[ChatMessage], request: gr.Request) -> AsyncGenerator[List[ChatMessage], None]:
|
181 |
async for updated_history in self.stream_response(message, history, request):
|
182 |
yield updated_history
|
183 |
+
|
184 |
# Set up event handlers
|
185 |
msg.submit(respond, [msg, chatbot], [chatbot])
|
186 |
submit.click(respond, [msg, chatbot], [chatbot])
|