File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -312,9 +312,17 @@ async def query_endpoint_handler_base( # pylint: disable=R0914
312312 session .query (UserConversation ).filter_by (id = conversation_id ).first ()
313313 )
314314 if not existing_conversation :
315- topic_summary = await get_topic_summary_func (
316- query_request .query , client , llama_stack_model_id
317- )
315+ # Check if topic summary should be generated (default: True)
316+ should_generate = query_request .generate_topic_summary
317+
318+ if should_generate :
319+ logger .debug ("Generating topic summary for new conversation" )
320+ topic_summary = await get_topic_summary_func (
321+ query_request .query , client , llama_stack_model_id
322+ )
323+ else :
324+ logger .debug ("Topic summary generation disabled by request parameter" )
325+ topic_summary = None
318326 # Convert RAG chunks to dictionary format once for reuse
319327 logger .info ("Processing RAG chunks..." )
320328 rag_chunks_dict = [chunk .model_dump () for chunk in summary .rag_chunks ]
Original file line number Diff line number Diff line change @@ -862,9 +862,17 @@ async def response_generator(
862862 .first ()
863863 )
864864 if not existing_conversation :
865- topic_summary = await get_topic_summary (
866- query_request .query , client , model_id
867- )
865+ # Check if topic summary should be generated (default: True)
866+ should_generate = query_request .generate_topic_summary
867+
868+ if should_generate :
869+ logger .debug ("Generating topic summary for new conversation" )
870+ topic_summary = await get_topic_summary (
871+ query_request .query , client , model_id
872+ )
873+ else :
874+ logger .debug ("Topic summary generation disabled by request parameter" )
875+ topic_summary = None
868876
869877 completed_at = datetime .now (UTC ).strftime ("%Y-%m-%dT%H:%M:%SZ" )
870878
Original file line number Diff line number Diff line change @@ -81,6 +81,7 @@ class QueryRequest(BaseModel):
8181 system_prompt: The optional system prompt.
8282 attachments: The optional attachments.
8383 no_tools: Whether to bypass all tools and MCP servers (default: False).
84+ generate_topic_summary: Whether to generate topic summary for new conversations (default: None = use server config).
8485 media_type: The optional media type for response format (application/json or text/plain).
8586
8687 Example:
@@ -146,6 +147,12 @@ class QueryRequest(BaseModel):
146147 examples = [True , False ],
147148 )
148149
150+ generate_topic_summary : Optional [bool ] = Field (
151+ True ,
152+ description = "Whether to generate topic summary for new conversations (None = use server config default)" ,
153+ examples = [True , False ],
154+ )
155+
149156 media_type : Optional [str ] = Field (
150157 None ,
151158 description = "Media type for the response format" ,
@@ -164,6 +171,7 @@ class QueryRequest(BaseModel):
164171 "model" : "model-name" ,
165172 "system_prompt" : "You are a helpful assistant" ,
166173 "no_tools" : False ,
174+ "generate_topic_summary" : True ,
167175 "attachments" : [
168176 {
169177 "attachment_type" : "log" ,
You can’t perform that action at this time.
0 commit comments