feat(flows): add new brazilian portuguese translation for epic-jade-656 - #850
JoelitonEPJ wants to merge 6 commits into
Conversation
📝 WalkthroughWalkthroughAdds a new Portuguese-language extractive summary knowledge tuning dataset generation flow under ChangesPT-BR Extractive Summary QA Pipeline
Sequence Diagram(s)sequenceDiagram
participant Dataset as Input Dataset
participant SummaryLLM as Summary LLM
participant QuestionLLM as Question LLM
participant AnswerLLM as Answer LLM
participant EvalLLM as Faithfulness Eval LLM
participant Filter as YES Filter
Dataset->>SummaryLLM: document + document_outline
SummaryLLM-->>Dataset: extractive summary → raw_document / document
Dataset->>QuestionLLM: document + domain + ICL examples
QuestionLLM-->>Dataset: question list (QUESTION/END delimited)
Dataset->>AnswerLLM: question + document + document_outline
AnswerLLM-->>Dataset: response + reasoning
Dataset->>EvalLLM: document + response
EvalLLM-->>Dataset: explanation + faithfulness_judgment (SIM/NÃO)
Dataset->>Filter: faithfulness_judgment
Filter-->>Dataset: rows where judgment == YES
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@src/sdg_hub/flows/knowledge_infusion/enhanced_multi_summary_qa_pt_br/extractive_summary/flow.yaml`:
- Around line 149-155: The `save_reasoning_content` configuration is currently
placed on the TagParserBlock but should be moved to the
LLMResponseExtractorBlock (the extract_answers block). Remove the
`save_reasoning_content` setting from the TagParserBlock configuration around
line 164 and add it to the LLMResponseExtractorBlock's block_config section
(within the extract_answers block around line 149-155). This corrects the
cross-block contract mismatch and ensures reasoning metadata is properly
preserved during extraction.
In
`@src/sdg_hub/flows/knowledge_infusion/enhanced_multi_summary_qa_pt_br/extractive_summary/prompts/evaluate_faithfulness_pt_br.yaml`:
- Around line 9-14: The prompt file has an inconsistency where lines 9-14 ask
the model to respond with Portuguese tokens (SIM/NÃO) but the evaluation
pipeline on lines 58-60 filters only for English tokens (YES/NO). This causes
valid responses from the model to be silently discarded when it returns SIM.
Unify all judgment responses in the file to use YES/NO tokens only by updating
the instructions in lines 9-14 to ask for YES/NO instead of SIM/NÃO, and ensure
the filter logic on lines 58-60 remains consistent with this English-only
format.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: c4e9bf2c-008f-4fae-aad9-e54ee5f7e6a1
📒 Files selected for processing (5)
src/sdg_hub/flows/knowledge_infusion/enhanced_multi_summary_qa_pt_br/extractive_summary/flow.yamlsrc/sdg_hub/flows/knowledge_infusion/enhanced_multi_summary_qa_pt_br/extractive_summary/prompts/evaluate_faithfulness_pt_br.yamlsrc/sdg_hub/flows/knowledge_infusion/enhanced_multi_summary_qa_pt_br/extractive_summary/prompts/extractive_summary_pt_br.yamlsrc/sdg_hub/flows/knowledge_infusion/enhanced_multi_summary_qa_pt_br/extractive_summary/prompts/generate_answers_pt_br.yamlsrc/sdg_hub/flows/knowledge_infusion/enhanced_multi_summary_qa_pt_br/extractive_summary/prompts/generate_question_list_pt_br.yaml
| Determine se a informação fornecida corroborou com o contexto apresentado. Responda com SIM se o contexto fundamenta a informação, mesmo parcialmente. Responda NÃO se o contexto não sustentar a informação. | ||
|
|
||
| Diretrizes: | ||
| - Responda SIM quando o contexto fornece, seja direto ou indiretamente, evidência sustentando a informação. Evidência indireta pode incluir implicações contextuais ou conexões inferidas que sustentam razoavelmente a informação. | ||
| - Responda NÃO se o contexto não apresenta nenhuma evidência que o sustente, contradizer claramente a informação, ou se o suporte fornecido pelo contexto for muito vago ou especulatvo para estabelecer uma conexão sólida com a informação. | ||
| - Evite usar "parcialmente" em sua resposta. Se o contexto fornece qualquer suporte razoável (direto ou indireto) para a informação, considere-a como SIM. |
There was a problem hiding this comment.
Unify judgment tokens to YES/NO only.
Line 9–Line 14 asks for SIM/NÃO, but Line 58 asks for YES/NO, and the pipeline filters only "YES". This inconsistency can silently discard valid rows when the model returns SIM.
Suggested prompt fix
- Determine se a informação fornecida corroborou com o contexto apresentado. Responda com SIM se o contexto fundamenta a informação, mesmo parcialmente. Responda NÃO se o contexto não sustentar a informação.
+ Determine se a informação fornecida é sustentada pelo contexto apresentado. Responda com YES se o contexto fundamenta a informação, mesmo parcialmente. Responda NO se o contexto não sustenta a informação.
@@
- - Responda SIM quando o contexto fornece, seja direto ou indiretamente, evidência sustentando a informação. Evidência indireta pode incluir implicações contextuais ou conexões inferidas que sustentam razoavelmente a informação.
- - Responda NÃO se o contexto não apresenta nenhuma evidência que o sustente, contradizer claramente a informação, ou se o suporte fornecido pelo contexto for muito vago ou especulatvo para estabelecer uma conexão sólida com a informação.
+ - Responda YES quando o contexto fornece, seja direto ou indiretamente, evidência sustentando a informação. Evidência indireta pode incluir implicações contextuais ou conexões inferidas que sustentam razoavelmente a informação.
+ - Responda NO se o contexto não apresenta nenhuma evidência que o sustente, contradiz claramente a informação, ou se o suporte fornecido pelo contexto for muito vago ou especulativo para estabelecer uma conexão sólida com a informação.
@@
- - Evite usar "parcialmente" em sua resposta. Se o contexto fornece qualquer suporte razoável (direto ou indireto) para a informação, considere-a como SIM.
+ - Evite usar "parcialmente" em sua resposta. Se o contexto fornece qualquer suporte razoável (direto ou indireto) para a informação, considere-a como YES.Also applies to: 58-60
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@src/sdg_hub/flows/knowledge_infusion/enhanced_multi_summary_qa_pt_br/extractive_summary/prompts/evaluate_faithfulness_pt_br.yaml`
around lines 9 - 14, The prompt file has an inconsistency where lines 9-14 ask
the model to respond with Portuguese tokens (SIM/NÃO) but the evaluation
pipeline on lines 58-60 filters only for English tokens (YES/NO). This causes
valid responses from the model to be silently discarded when it returns SIM.
Unify all judgment responses in the file to use YES/NO tokens only by updating
the instructions in lines 9-14 to ask for YES/NO instead of SIM/NÃO, and ensure
the filter logic on lines 58-60 remains consistent with this English-only
format.
|
Hey @JoelitonEPJ, we have a feature to automatically translate any flow into a target language. Could you try that with this? Something like this: from sdg_hub.core.utils.translation import translate_flow
flow = translate_flow(
flow="extractive-summary-knowledge-tuning",
lang="Spanish",
lang_code="es",
translator_model="openai/gpt-5.2",
verifier_model="openai/gpt-5.2",
) |
|
Hi @shivchander, thanks for the tip! I tested the translate_flow as suggested. Smaller models fail to translate the tags correctly Does this behavior sound expected with smaller models, or would it be worth opening a separate issue with the error details/logs so we can investigate further? Happy to share the traces if that helps. |
Summary
This PR introduces the Portuguese translation for the epic-jade-656 flow. The goal is to provide the same synthetic data generation pipeline already available in other languages, an option that was previously unavailable for Portuguese.
Changes
Test Plan
Checklist
uv run pytest)uv run pytest tests/structural/)uv run ruff check src/ tests/)uv run mypy src/sdg_hub)Summary by CodeRabbit