Skip to content

fix(docs): restore missing code block in pt-BR first-flow guide#5780

Merged
vinibrsl merged 2 commits into
mainfrom
fix/pt-br-first-flow-missing-code
May 12, 2026
Merged

fix(docs): restore missing code block in pt-BR first-flow guide#5780
vinibrsl merged 2 commits into
mainfrom
fix/pt-br-first-flow-missing-code

Conversation

@iris-clawd
Copy link
Copy Markdown
Contributor

@iris-clawd iris-clawd commented May 12, 2026

Problem

The pt-BR translation of the Build Your First Flow guide had a placeholder comment instead of the actual Python code in Step 5 (Passo 5):

# [CÓDIGO NÃO TRADUZIDO, MANTER COMO ESTÁ]

This left users following the Portuguese docs with no code to reference for the main flow implementation.

Live page: https://docs.crewai.com/pt-BR/guides/flows/first-flow#passo-5-crie-o-flow

Fix

Restored the full main.py code block from the English source. Code blocks should not be translated, so the English original is the correct content here.

Summary by CodeRabbit

  • Documentation
    • Portuguese flow guide replaced the placeholder with a complete, runnable Python example demonstrating the full workflow: collecting user inputs, generating a structured outline, producing section content sequentially, and compiling/saving the final guide. The example includes utilities and an executable entrypoint for direct demonstration.

Review Change Stack

The pt-BR translation of the 'Build Your First Flow' guide had a
placeholder comment '# [CÓDIGO NÃO TRADUZIDO, MANTER COMO ESTÁ]'
instead of the actual Python code in Step 5. This restores the full
main.py code block from the English source, matching the original
since code should not be translated.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 12, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: acb432ed-bc9d-4781-ae23-3aa8f13507c8

📥 Commits

Reviewing files that changed from the base of the PR and between fd2fec9 and 16085f6.

📒 Files selected for processing (1)
  • docs/pt-BR/guides/flows/first-flow.mdx
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/pt-BR/guides/flows/first-flow.mdx

📝 Walkthrough

Walkthrough

This pull request translates and completes a Portuguese-language guide on building flows by replacing an untranslated code placeholder with a full working example. The example demonstrates a guide creator flow that accepts user input, generates a structured outline via LLM, writes sections sequentially with content reuse, and compiles the final guide document.

Changes

Guide Creator Flow Implementation Example

Layer / File(s) Summary
Data models and state definitions
docs/pt-BR/guides/flows/first-flow.mdx
Introduces Section and GuideOutline Pydantic models representing guide structure, and GuideCreatorState for tracking topic, audience, generated outline, and section content during flow execution.
Flow orchestration and content generation
docs/pt-BR/guides/flows/first-flow.mdx
Implements GuideCreatorFlow with user input collection, direct LLM calls for structured outline generation (persisted to JSON), and sequential section writing using ContentCrew with previous content as context, culminating in final markdown guide compilation.
Execution and visualization utilities
docs/pt-BR/guides/flows/first-flow.mdx
Adds kickoff() for flow execution with completion messaging, plot() for flow diagram HTML generation, and if __name__ == "__main__": entry point for direct script execution.

🎯 2 (Simple) | ⏱️ ~10 minutes

🐰 A guide flow now hops through the docs,
From outline to sections, no stopping or drops,
With Pydantic shapes clear and LLM calls bright,
Portuguese readers will see flows done right!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately describes the main change: restoring a missing code block in the Portuguese (pt-BR) version of the first-flow guide, which directly matches the raw_summary and PR objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/pt-br-first-flow-missing-code

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
docs/pt-BR/guides/flows/first-flow.mdx (1)

291-296: ⚡ Quick win

Use Optional typing and default_factory for Pydantic state model fields

Lines 294–295 use non-idiomatic patterns for Pydantic v2: guide_outline: GuideOutline = None lacks an Optional type annotation, and sections_content: Dict[str, str] = {} uses a mutable default literal instead of Field(default_factory=dict). In documentation examples, this should follow Pydantic v2 best practices to avoid misleading users.

Suggested patch
 class GuideCreatorState(BaseModel):
     topic: str = ""
     audience_level: str = ""
-    guide_outline: GuideOutline = None
-    sections_content: Dict[str, str] = {}
+    guide_outline: GuideOutline | None = None
+    sections_content: Dict[str, str] = Field(default_factory=dict)
🤖 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 `@docs/pt-BR/guides/flows/first-flow.mdx` around lines 291 - 296, Update the
Pydantic model GuideCreatorState to use idiomatic Pydantic v2 types: change the
guide_outline annotation to an Optional type (e.g., Optional[GuideOutline]) with
a None default, and replace the mutable default on sections_content by using
Field(default_factory=dict) (keeping the type as Dict[str, str]); also ensure
the module imports Optional from typing and Field from pydantic so the
annotations compile.
🤖 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 `@docs/pt-BR/guides/flows/first-flow.mdx`:
- Line 325: The guide currently hardcodes the model string in the LLM
instantiation (llm = LLM(model="openai/gpt-4o-mini",
response_format=GuideOutline)), which conflicts with the multi-provider setup;
change the call to use a provider-agnostic variable (e.g., model_name,
selectedModel, or provider_model) populated from the guide's earlier
configuration/options (the values described for OpenAI/Gemini/Anthropic), and
ensure a sensible fallback/default is documented if the variable is not set;
update the text to reference that variable instead of "openai/gpt-4o-mini" so
all provider paths work.

---

Nitpick comments:
In `@docs/pt-BR/guides/flows/first-flow.mdx`:
- Around line 291-296: Update the Pydantic model GuideCreatorState to use
idiomatic Pydantic v2 types: change the guide_outline annotation to an Optional
type (e.g., Optional[GuideOutline]) with a None default, and replace the mutable
default on sections_content by using Field(default_factory=dict) (keeping the
type as Dict[str, str]); also ensure the module imports Optional from typing and
Field from pydantic so the annotations compile.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 311b9c7f-0ef5-4735-bce3-50cb79bfada0

📥 Commits

Reviewing files that changed from the base of the PR and between ba523f4 and fd2fec9.

📒 Files selected for processing (1)
  • docs/pt-BR/guides/flows/first-flow.mdx

Comment thread docs/pt-BR/guides/flows/first-flow.mdx
Code comments in the tutorial should be in Portuguese for the pt-BR
audience, since they are part of the guide's educational content.
@vinibrsl vinibrsl merged commit b2cd133 into main May 12, 2026
83 of 124 checks passed
@vinibrsl vinibrsl deleted the fix/pt-br-first-flow-missing-code branch May 12, 2026 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants