docs: add PZERO OpenAI-compatible endpoint sample and documentation - #14350
Conversation
There was a problem hiding this comment.
MAF Automated Review — Iteration 1
Result: Findings reported
Scope: full PR (1 commit(s)): 195c6bea1ea3
Model: claude-opus-4.8
Overview
This PR is documentation and concept-sample only: a new .NET Concepts sample, a new Python concepts script, a section in the OpenAI connector migration guide, and a README index line, all showing how to point the existing OpenAI connector at a third-party OpenAI-compatible endpoint. The .NET sample binds to real connector overloads (the experimental SKEXP0010 constructor is suppressed project-wide in Concepts.csproj), the docs snippets are internally consistent (including the 9.8 token-usage correction), and no secrets are introduced. The one substantive defect is that the Python sample cannot actually run: it registers a {{$chat_history}} template without enabling dangerous content, so prompt rendering raises NotImplementedError before any request is made.
Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
1 verified finding remained after source verification (1 medium) across 1 file. Details are attached to the affected lines below.
Affected areas: python/samples/concepts/chat_completion/pzero_chat_completion.py
| chat_function = kernel.add_function( | ||
| plugin_name="ChatBot", | ||
| function_name="Chat", | ||
| prompt="{{$chat_history}}{{$user_input}}", |
There was a problem hiding this comment.
This sample cannot run as written. The function is registered with a {{$chat_history}} template but without enabling dangerous content, and kernel.invoke is later called with a ChatHistory object bound to chat_history. During prompt rendering, complex (non-string) argument values are rejected unless dangerous content is allowed, so the invoke raises NotImplementedError: Argument 'chat_history' has a value that doesn't support automatic encoding... before any request reaches the endpoint. py_compile does not exercise this path, so it passes while the sample fails on every run. Register the template the same way the working simple_chatbot_kernel_function.py sample does — via a PromptTemplateConfig(template="{{$chat_history}}{{$user_input}}", template_format="semantic-kernel", allow_dangerously_set_content=True) passed as prompt_template_config — so the trusted chat history renders and the sample can complete a call.
Problem
Users seeking to configure Semantic Kernel against OpenAI-compatible third-party providers (such as PZERO) need reference documentation and runnable code samples showing proper
/v1endpoint routing and credential configuration.Solution
PZero_ChatCompletion.csunderdotnet/samples/Concepts/ChatCompletion/.pzero_chat_completion.pyunderpython/samples/concepts/chat_completion/.5.1 OpenAI-Compatible Endpoints Example (e.g., PZERO)indotnet/docs/OPENAI-CONNECTOR-MIGRATION.mdand corrected example token usage syntax in section 9.8.dotnet/samples/Concepts/README.mdto index the new sample.Testing
py_compile.uv run pytest tests/unit/connectors/ai/open_ai/services/- 218 passed).git diff --check.Closes #14347