Spaces:
Sleeping
Sleeping
Commit
·
952119b
1
Parent(s):
e5d2f78
exibir prompts no log
Browse files
app.py
CHANGED
@@ -253,12 +253,9 @@ def process():
|
|
253 |
).replace("<role>", f"<role>\n {contexto}") #injeta contexto
|
254 |
|
255 |
# --- renderiza e loga o prompt final Atomico ---
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
rag_context=rag_context
|
260 |
-
)
|
261 |
-
print(f"[DEBUG] PROMPT ATÔMICO RENDERED:\n{rendered_prompt}\n{'-'*80}")
|
262 |
|
263 |
prompt = PromptTemplate(template=updated_prompt_template, input_variables=["contexto", "solicitacao_usuario", "rag_context"])
|
264 |
json_data = safe_json_dumps({'progress': 15, 'message': 'Iniciando processamento paralelo...'})
|
@@ -325,12 +322,8 @@ def process():
|
|
325 |
).replace("<role>", f"<role>\n {contexto}") # injeta contexto
|
326 |
|
327 |
# --- renderiza e loga o prompt final Hierárquico Grok ---
|
328 |
-
|
329 |
-
|
330 |
-
solicitacao_usuario=solicitacao_usuario,
|
331 |
-
rag_context=rag_context
|
332 |
-
)
|
333 |
-
print(f"[DEBUG] PROMPT HIERÁRQUICO GROK RENDERED:\n{rendered_grok}\n{'-'*80}")
|
334 |
|
335 |
updated_sonnet_template = PROMPT_HIERARQUICO_SONNET.replace(
|
336 |
"MIN_CHARS_PLACEHOLDER", str(min_chars)
|
@@ -339,11 +332,8 @@ def process():
|
|
339 |
).replace("<role>", f"<role>\n {contexto}") # injeta contexto
|
340 |
|
341 |
# --- renderiza e loga o prompt final Hierárquico Sonnet ---
|
342 |
-
|
343 |
-
|
344 |
-
resposta_grok=resposta_grok
|
345 |
-
)
|
346 |
-
print(f"[DEBUG] PROMPT HIERÁRQUICO SONNET RENDERED:\n{rendered_sonnet}\n{'-'*80}")
|
347 |
|
348 |
updated_gemini_template = PROMPT_HIERARQUICO_GEMINI.replace(
|
349 |
"MIN_CHARS_PLACEHOLDER", str(min_chars)
|
@@ -351,12 +341,9 @@ def process():
|
|
351 |
"MAX_CHARS_PLACEHOLDER", str(max_chars)
|
352 |
).replace("<role>", f"<role>\n {contexto}") # injeta contexto
|
353 |
|
354 |
-
# --- renderiza e loga o prompt final Hierárquico
|
355 |
-
|
356 |
-
|
357 |
-
resposta_grok=resposta_grok
|
358 |
-
)
|
359 |
-
print(f"[DEBUG] PROMPT HIERÁRQUICO SONNET RENDERED:\n{rendered_gemini}\n{'-'*80}")
|
360 |
|
361 |
json_data = safe_json_dumps({'progress': 15, 'message': 'O GROK está processando sua solicitação...'})
|
362 |
yield f"data: {json_data}\n\n"
|
@@ -493,12 +480,8 @@ def merge():
|
|
493 |
).replace("<role>", f"<role>\n {contexto}") # injeta contexto
|
494 |
|
495 |
# --- renderiza e loga o prompt final Atomico Merge --
|
496 |
-
|
497 |
-
|
498 |
-
resposta_sonnet=resposta_sonnet,
|
499 |
-
resposta_gemini=resposta_gemini
|
500 |
-
)
|
501 |
-
print(f"[DEBUG] PROMPT ATÔMICO MERGE RENDERED:\n{rendered_merge}\n{'-'*80}")
|
502 |
|
503 |
prompt_merge = PromptTemplate(template=updated_merge_template, input_variables=["contexto", "solicitacao_usuario", "texto_para_analise_grok", "texto_para_analise_sonnet", "texto_para_analise_gemini"])
|
504 |
|
|
|
253 |
).replace("<role>", f"<role>\n {contexto}") #injeta contexto
|
254 |
|
255 |
# --- renderiza e loga o prompt final Atomico ---
|
256 |
+
# ——— log do prompt atômico já formatado ———
|
257 |
+
log_print(f"[DEBUG] PROMPT ATÔMICO RENDERED:\n"
|
258 |
+
f"{updated_prompt_template.format(contexto=contexto, solicitacao_usuario=solicitacao_usuario, rag_context=rag_context)}\n""-"*80)
|
|
|
|
|
|
|
259 |
|
260 |
prompt = PromptTemplate(template=updated_prompt_template, input_variables=["contexto", "solicitacao_usuario", "rag_context"])
|
261 |
json_data = safe_json_dumps({'progress': 15, 'message': 'Iniciando processamento paralelo...'})
|
|
|
322 |
).replace("<role>", f"<role>\n {contexto}") # injeta contexto
|
323 |
|
324 |
# --- renderiza e loga o prompt final Hierárquico Grok ---
|
325 |
+
log_print(f"[DEBUG] PROMPT HIERÁRQUICO GROK RENDERED:\n"
|
326 |
+
f"{updated_grok_template.format(contexto=contexto, solicitacao_usuario=solicitacao_usuario, rag_context=rag_context)}\n""-"*80)
|
|
|
|
|
|
|
|
|
327 |
|
328 |
updated_sonnet_template = PROMPT_HIERARQUICO_SONNET.replace(
|
329 |
"MIN_CHARS_PLACEHOLDER", str(min_chars)
|
|
|
332 |
).replace("<role>", f"<role>\n {contexto}") # injeta contexto
|
333 |
|
334 |
# --- renderiza e loga o prompt final Hierárquico Sonnet ---
|
335 |
+
log_print(f"[DEBUG] PROMPT HIERÁRQUICO SONNET RENDERED:\n"
|
336 |
+
f"{updated_sonnet_template.format(contexto=contexto, solicitacao_usuario=solicitacao_usuario, texto_para_analise=resposta_grok)}\n""-"*80)
|
|
|
|
|
|
|
337 |
|
338 |
updated_gemini_template = PROMPT_HIERARQUICO_GEMINI.replace(
|
339 |
"MIN_CHARS_PLACEHOLDER", str(min_chars)
|
|
|
341 |
"MAX_CHARS_PLACEHOLDER", str(max_chars)
|
342 |
).replace("<role>", f"<role>\n {contexto}") # injeta contexto
|
343 |
|
344 |
+
# --- renderiza e loga o prompt final Hierárquico Gemini ---
|
345 |
+
log_print(f"[DEBUG] PROMPT HIERÁRQUICO GEMINI RENDERED:\n"
|
346 |
+
f"{updated_gemini_template.format(contexto=contexto, solicitacao_usuario=solicitacao_usuario, texto_para_analise=resposta_sonnet)}\n""-"*80)
|
|
|
|
|
|
|
347 |
|
348 |
json_data = safe_json_dumps({'progress': 15, 'message': 'O GROK está processando sua solicitação...'})
|
349 |
yield f"data: {json_data}\n\n"
|
|
|
480 |
).replace("<role>", f"<role>\n {contexto}") # injeta contexto
|
481 |
|
482 |
# --- renderiza e loga o prompt final Atomico Merge --
|
483 |
+
log_print(f"[DEBUG] PROMPT MERGE RENDERED:\n"
|
484 |
+
f"{updated_merge_template.format(contexto=contexto, solicitacao_usuario=data.get('solicitacao_usuario'), texto_para_analise_grok=data.get('grok_text'), texto_para_analise_sonnet=data.get('sonnet_text'), texto_para_analise_gemini=data.get('gemini_text'))}\n""-"*80)
|
|
|
|
|
|
|
|
|
485 |
|
486 |
prompt_merge = PromptTemplate(template=updated_merge_template, input_variables=["contexto", "solicitacao_usuario", "texto_para_analise_grok", "texto_para_analise_sonnet", "texto_para_analise_gemini"])
|
487 |
|