Skip to content

docs: add PZERO OpenAI-compatible endpoint sample and documentation - #14350

Open
MOHAMMED WASIM KHAN (wasim-builds) wants to merge 1 commit into
microsoft:mainfrom
wasim-builds:docs/pzero-openai-compatible-sample-14347
Open

docs: add PZERO OpenAI-compatible endpoint sample and documentation#14350
MOHAMMED WASIM KHAN (wasim-builds) wants to merge 1 commit into
microsoft:mainfrom
wasim-builds:docs/pzero-openai-compatible-sample-14347

Conversation

@wasim-builds

Copy link
Copy Markdown

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 /v1 endpoint routing and credential configuration.

Solution

  • Added .NET concept sample PZero_ChatCompletion.cs under dotnet/samples/Concepts/ChatCompletion/.
  • Added Python concept sample pzero_chat_completion.py under python/samples/concepts/chat_completion/.
  • Added section 5.1 OpenAI-Compatible Endpoints Example (e.g., PZERO) in dotnet/docs/OPENAI-CONNECTOR-MIGRATION.md and corrected example token usage syntax in section 9.8.
  • Updated dotnet/samples/Concepts/README.md to index the new sample.

Testing

  • Verified Python sample with py_compile.
  • Ran unit tests in Python test suite (uv run pytest tests/unit/connectors/ai/open_ai/services/ - 218 passed).
  • Verified clean git diff --check.

Closes #14347

Copilot AI lite review requested due to automatic review settings August 30, 2026 11:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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}}",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

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

Labels

None yet

2 participants