Skip to content

Semantic Kernel (Microsoft): using the VIDAI Control Plane as the backend

Semantic Kernel's OpenAIChatCompletion service accepts a custom endpoint. Wire that to the control plane's base URL when you build your kernel and every prompt, plugin, planner, and agent invocation routes through it.

TL;DR (Python)

from semantic_kernel import Kernel
from semantic_kernel.connectors.ai.open_ai import OpenAIChatCompletion

kernel = Kernel()
kernel.add_service(
    OpenAIChatCompletion(
        service_id="vidai",
        ai_model_id="gpt-4o-mini",
        api_key="your-vidai-key",
        endpoint="https://your-vidai-server.example.com/v1",
    )
)

result = await kernel.invoke_prompt("Reply with exactly: ok")
print(result)

TL;DR (.NET / C#)

using Microsoft.SemanticKernel;

var builder = Kernel.CreateBuilder();
builder.AddOpenAIChatCompletion(
    modelId: "gpt-4o-mini",
    apiKey: "your-vidai-key",
    endpoint: new Uri("https://your-vidai-server.example.com/v1"));

var kernel = builder.Build();
var result = await kernel.InvokePromptAsync("Reply with exactly: ok");
Console.WriteLine(result);

Prerequisites

  • Python: pip install semantic-kernel (any version with OpenAIChatCompletion — 1.x onward).
  • .NET: Microsoft.SemanticKernel NuGet package (1.x onward).
  • Control plane base URL and an API key from API Keys.
  • A model registered on the Models page.

Plugins and prompt templates

Any plugin (KernelFunction) and prompt template invoked through the kernel uses the configured service. Nothing changes in how you define plugins:

from semantic_kernel.functions import kernel_function

class WeatherPlugin:
    @kernel_function(description="Get the current weather")
    def get_weather(self, city: str) -> str:
        return f"Sunny in {city}."

kernel.add_plugin(WeatherPlugin(), plugin_name="weather")
result = await kernel.invoke_prompt("What's the weather in Kyoto? Use the weather plugin.")

Every plugin call and every model turn is a control-plane request that shows up in Request Logs.

Planners and agents

The Handlebars planner, function-calling agents, and the new Agent Framework all use whichever chat-completion service the kernel has registered. No extra config — the endpoint config above covers them:

from semantic_kernel.agents import ChatCompletionAgent

agent = ChatCompletionAgent(
    kernel=kernel,
    name="assistant",
    instructions="You are a helpful assistant.",
)

Function calling / tools

SK's function-calling mode is transparent — the plugin functions you register become the tools the model can call. Control-plane routing rules apply the same way whether the model calls tools or replies directly.

Streaming

invoke_prompt_stream() / InvokePromptStreamingAsync() stream tokens back. The control plane forwards the stream unchanged.

Azure OpenAI service class

If you specifically want the Azure OpenAI service class (for its API-version behaviour), point its endpoint at the control plane's Azure-compatible path:

from semantic_kernel.connectors.ai.open_ai import AzureChatCompletion

kernel.add_service(
    AzureChatCompletion(
        service_id="vidai",
        deployment_name="gpt-4o-mini",
        endpoint="https://your-vidai-server.example.com",
        api_key="your-vidai-key",
    )
)

Verify it works

Python:

result = await kernel.invoke_prompt("Reply with exactly: ok")
print(result)

.NET:

var result = await kernel.InvokePromptAsync("Reply with exactly: ok");
Console.WriteLine(result);

If something's off

Raise an issue at github.com/vidaiUK/vidai-quickstart/issues with your kernel setup and the prompt/plugin that reproduces the issue. We'll get it sorted.

Where to go next