Skip to content

Python: docs: add Python filters README with samples guide#13885

Open
lawcontinue wants to merge 1 commit intomicrosoft:mainfrom
lawcontinue:docs/python-filters
Open

Python: docs: add Python filters README with samples guide#13885
lawcontinue wants to merge 1 commit intomicrosoft:mainfrom
lawcontinue:docs/python-filters

Conversation

@lawcontinue
Copy link
Copy Markdown

Addresses #10566

Summary

Adds a README.md to python/samples/concepts/filtering/ that documents all Python filter samples, their purpose, and usage patterns.

The Learn docs filters page currently has empty Python pivots. While the Learn docs are maintained separately, this README provides immediate documentation for Python users directly in the repo.

What's Covered

  • Overview of 3 filter types (Prompt, Function Invocation, Auto Function Invoke)
  • Description of each sample file
  • Two registration methods (@kernel.filter decorator vs kernel.add_filter)
  • Filter signature pattern
  • How to terminate auto function calls with context.terminate = True

Notes

  • All code patterns are extracted from the existing sample files in this directory
  • No new code — purely documentation
  • The Learn docs Python pivot update would be a separate contribution to the docs repo

@lawcontinue lawcontinue requested a review from a team as a code owner April 18, 2026 05:42
@moonbox3 moonbox3 added python Pull requests for the Python Semantic Kernel documentation labels Apr 18, 2026
@github-actions github-actions Bot changed the title docs: add Python filters README with samples guide Python: docs: add Python filters README with samples guide Apr 18, 2026
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Automated Code Review

Reviewers: 4 | Confidence: 93% | Result: All clear

Reviewed: Correctness, Security Reliability, Test Coverage, Design Approach


Automated review by lawcontinue's agents

@lawcontinue
Copy link
Copy Markdown
Author

Hi @ImranSiddiqi and team,

I found a P0 issue in this PR per Crit review.

Issue

The description of context.terminate = True is misleading.

Current (Misleading)

Line 37: "Demonstrates context.terminate = True to skip specific function calls"
Line 78: context.terminate = True # Skip this function call

Problem

"Skip this function call" implies that only the current function call is skipped, but actually context.terminate = True terminates the entire auto function calling loop.

Proposed Fix

Change to:

  • Line 37: "Demonstrates context.terminate = True to terminate the auto function calling loop"
  • Line 78: context.terminate = True # Terminate the auto function calling loop

This makes it clear that setting context.terminate = True stops the entire auto function invocation process, not just one function call.

Would you like me to submit a fix, or feel free to make this change directly?

Thanks!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the contribution. I'm a little hesitant to introduce another README when we have an overarching README for all samples. Additionally, this type of information should be live in our docs page, which I see exists here: https://learn.microsoft.com/en-us/semantic-kernel/concepts/enterprise-readiness/filters?pivots=programming-language-python. Are there gaps in our docs page?

@lawcontinue
Copy link
Copy Markdown
Author

Fair point about the Learn docs. But from watching how developers actually use repos, samples READMEs serve a different purpose than formal docs.

Learn docs are the reference — comprehensive, authoritative, but sometimes a click away from the code. A README in the samples directory is where developers land when they're already exploring the codebase and want quick context without context-switching to a browser.

The pattern we've seen: clone → cd samples → README.md → run code. If the README is missing, developers either skip the sample or open the file and try to reverse-engineer what it does. Both are friction.

That said, if the goal is "one source of truth," I get the hesitation. Could this be a stopgap until the Learn docs Python pivot is filled out?

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

Labels

documentation python Pull requests for the Python Semantic Kernel

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants