Repository navigation
Python: Use a real chat client in Purview chat middleware examples - #10079
Draft
Naveen Chatlapalli (1aifanatic) wants to merge 1 commit into
Draft
Naveen Chatlapalli (1aifanatic) wants to merge 1 commit into
Naveen Chatlapalli (1aifanatic) wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Naveen Chatlapalli (1aifanatic)
temporarily deployed
to
github-app-auth
November 4, 2026 05:36 — with
GitHub Actions
Inactive
Naveen Chatlapalli (1aifanatic)
temporarily deployed
to
github-app-auth
November 4, 2026 05:37 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the documentation-only corrections to the Purview middleware examples.
No open issues 🎉
What changed in this PR
This documentation-only PR corrects Purview chat middleware examples to use the existing OpenAIChatClient class instead of the nonexistent ChatClient.
Changes:
- Updates both examples to configure Purview middleware through the client constructor.
- Corrects the docstring import and adds the blank line required for code-block rendering.
| File | Description |
|---|---|
python/packages/purview/README.md |
Updates the storage and retention example to use OpenAIChatClient(middleware=...). |
python/packages/purview/agent_framework_purview/_middleware.py |
Corrects the client import, construction, and code-block formatting in the middleware docstring. |
Review effort: Balanced
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation & Context
The
PurviewChatPolicyMiddlewaredocstring and the Purview README's "Store and retention" snippet both build a client withChatClient(...).agent_frameworkhas noChatClient, sofrom agent_framework import ChatClientraisesImportError. The README snippet then assignsclient.chat_middlewareinstead of passingmiddleware=to the constructor. That works, but it doesn't match the other snippets in the same README.Description & Review Guide
OpenAIChatClient(middleware=[PurviewChatPolicyMiddleware(...)]), and add the blank line that.. code-block::needs to render.OpenAIChatClient(Responses API, stores by default) is the client the surrounding text describes.I ran both snippets: the client carries
PurviewChatPolicyMiddlewareinchat_middleware, and the README agent hasstore=Falsein its default options.Related Issue
N/A - trivial change: two documentation snippets are corrected to an existing chat client class.
AI Assistance
AI assistance details: Claude Code helped find the missing import by executing the docstring examples, make the change, verify the snippets, and draft this description.
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.🤖 Generated with Claude Code