Skip to content

Added docstrings to library flows for better documentation generation#44

Open
kpunwatk wants to merge 2 commits into
developfrom
add-missing-flow-docstrings
Open

Added docstrings to library flows for better documentation generation#44
kpunwatk wants to merge 2 commits into
developfrom
add-missing-flow-docstrings

Conversation

@kpunwatk
Copy link
Copy Markdown

Description

We should ensure all flows have docstrings in their defining .co files so that better documentation can be generated. Right now, do not have docstrings so, added missing docstrings to library flows for better documentation generation

Related Issue(s)

Checklist

  • I've read the CONTRIBUTING guidelines.
  • I've updated the documentation if applicable.
  • I've added tests if applicable.
  • @mentions of the person or team responsible for reviewing proposed changes.

@kpunwatk kpunwatk self-assigned this Apr 24, 2026
@kpunwatk kpunwatk force-pushed the add-missing-flow-docstrings branch from d0db0d2 to 641fcc4 Compare April 24, 2026 20:45
@kpunwatk kpunwatk force-pushed the add-missing-flow-docstrings branch from 641fcc4 to 0dbb1c5 Compare April 27, 2026 15:20
	modified:   nemoguardrails/library/autoalign/flows.v1.co
	modified:   nemoguardrails/library/content_safety/flows.v1.co
	modified:   nemoguardrails/library/crowdstrike_aidr/flows.v1.co
	modified:   nemoguardrails/library/llama_guard/flows.v1.co
	modified:   nemoguardrails/library/pangea/flows.v1.co
	modified:   nemoguardrails/library/patronusai/flows.v1.co
	modified:   nemoguardrails/library/self_check/input_check/flows.co
	modified:   nemoguardrails/library/self_check/input_check/flows.v1.co
	modified:   nemoguardrails/library/self_check/output_check/flows.co
	modified:   nemoguardrails/library/self_check/output_check/flows.v1.co
	modified:   nemoguardrails/library/topic_safety/flows.v1.co
	modified:   nemoguardrails/library/trend_micro/flows.v1.co
@kpunwatk kpunwatk force-pushed the add-missing-flow-docstrings branch from 81e56ab to 91d9bf7 Compare May 1, 2026 13:22
@kpunwatk
Copy link
Copy Markdown
Author

kpunwatk commented May 1, 2026

Hi @RobGeada pushed the changes, could you please review again, Thanks

Copy link
Copy Markdown

@RobGeada RobGeada left a comment

Choose a reason for hiding this comment

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

What were the findings re. docstrings having semantic meaning in Colang V2 flows?

@kpunwatk
Copy link
Copy Markdown
Author

kpunwatk commented May 9, 2026

What were the findings re. docstrings having semantic meaning in Colang V2 flows?

Yeah, Claude seems to suggest the following:

In Colang V2, flow docstrings carry semantic meaning when the generation operator (...) is used. In such cases, the docstring is included in the LLM prompt as an instruction, rather than serving purely as documentation.

From the documentation (docs/configure-rails/colang/usage-examples/bot-message-instructions.md):

“In Colang 2.0, you use flow docstrings (Natural Language Descriptions) to provide instructions to the LLM. These docstrings are included in the prompt when the generation operator (...) is invoked.”

The key distinction is:

Flows with a generation operator (bot say ...)

  • Docstrings should act as instructions to the LLM.
  • Good: """Respond politely and explain that you cannot help with this request."""
  • Bad: """Rail for handling inappropriate requests.""" (descriptive rather than instructional)

Flows without a generation operator (most library flows)

  • Docstrings function only as documentation and have no runtime impact.
  • In these cases, descriptive docstrings are fine.

I’ll analyze the library flows as well to check whether any of them need rewording.

@kpunwatk
Copy link
Copy Markdown
Author

kpunwatk commented May 9, 2026

@RobGeada , the conclusion is that all docstrings added in this PR are purely documentary in nature.

  • They have no semantic meaning.
  • They are not included in LLM prompts.
  • The descriptive style used is correct and appropriate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants