Implementation:Microsoft Semantic kernel CloudEvents Grpc DocumentGeneration
| Knowledge Sources | |
|---|---|
| Domains | gRPC, Protobuf, CloudEvents, TypeScript, Code_Generation |
| Last Updated | 2026-02-11 00:00 GMT |
Overview
Concrete auto-generated protobuf-ts TypeScript type definitions for the document generation gRPC service, provided by the CloudEvents Process demo.
Description
documentGeneration.ts is an auto-generated TypeScript file produced by the protobuf-ts code generator (version 2.9.6) from the documentGeneration.proto protobuf definition file. It provides complete binary serialization/deserialization logic and type definitions for the gRPC document generation service used in the CloudEvents demo.
The file defines the following protobuf message types as TypeScript interfaces and runtime message type classes:
- FeatureDocumentationRequest -- Contains title, userDescription, content, and processId fields for requesting AI-generated documentation.
- DocumentationContentRequest -- Contains title, content, assistantMessage, and a nested ProcessData reference for document content transfer.
- DocumentationApprovalRequest -- Contains documentationApproved (boolean), reason (string), and nested ProcessData for user review submissions.
- ProcessData -- Contains a single processId string field used as the process identifier.
- Empty -- An empty message type used as a void return value.
Each message type class includes create(), internalBinaryRead(), and internalBinaryWrite() methods for protobuf wire format serialization.
The file also exports a GrpcDocumentationGeneration ServiceType descriptor defining six RPC methods including two server-streaming methods (RequestUserReviewDocumentation and ReceivePublishedDocumentation).
Usage
This file is imported by the gRPC client class (documentGeneration.client.ts) which the App component uses to communicate with the .NET backend. Developers should not edit this file directly; instead, they should modify the .proto source file and regenerate using the @protobuf-ts/plugin tool.
Code Reference
Source Location
- Repository: Microsoft_Semantic_kernel
- File: dotnet/samples/Demos/ProcessWithCloudEvents/ProcessWithCloudEvents.Client/src/services/grpc/gen/documentGeneration.ts
- Lines: 1-385
Signature
export interface FeatureDocumentationRequest {
title: string;
userDescription: string;
content: string;
processId: string;
}
export interface DocumentationContentRequest {
title: string;
content: string;
assistantMessage: string;
processData?: ProcessData;
}
export interface DocumentationApprovalRequest {
documentationApproved: boolean;
reason: string;
processData?: ProcessData;
}
export interface ProcessData {
processId: string;
}
export interface Empty {}
export const GrpcDocumentationGeneration = new ServiceType("GrpcDocumentationGeneration", [
{ name: "UserRequestFeatureDocumentation", options: {}, I: FeatureDocumentationRequest, O: ProcessData },
{ name: "RequestUserReviewDocumentationFromProcess", options: {}, I: DocumentationContentRequest, O: Empty },
{ name: "RequestUserReviewDocumentation", serverStreaming: true, options: {}, I: ProcessData, O: DocumentationContentRequest },
{ name: "UserReviewedDocumentation", options: {}, I: DocumentationApprovalRequest, O: Empty },
{ name: "PublishDocumentation", options: {}, I: DocumentationContentRequest, O: Empty },
{ name: "ReceivePublishedDocumentation", serverStreaming: true, options: {}, I: ProcessData, O: DocumentationContentRequest }
]);
Import
import {
FeatureDocumentationRequest,
DocumentationContentRequest,
DocumentationApprovalRequest,
ProcessData,
GrpcDocumentationGeneration,
} from "./services/grpc/gen/documentGeneration";
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| documentGeneration.proto | Protobuf file | yes | Source protobuf definition file from which this TypeScript code is generated |
| @protobuf-ts/plugin | npm package | yes | Code generator tool that produces this file from the .proto source |
Outputs
| Name | Type | Description |
|---|---|---|
| FeatureDocumentationRequest | MessageType<T> | Runtime type with binary read/write for feature documentation requests |
| DocumentationContentRequest | MessageType<T> | Runtime type with binary read/write for documentation content data |
| DocumentationApprovalRequest | MessageType<T> | Runtime type with binary read/write for documentation approval/rejection |
| ProcessData | MessageType<T> | Runtime type with binary read/write for process identifier |
| Empty | MessageType<T> | Runtime type with binary read/write for empty messages |
| GrpcDocumentationGeneration | ServiceType | Service descriptor defining six RPC methods for the gRPC service |
Usage Examples
Creating a FeatureDocumentationRequest
import { FeatureDocumentationRequest } from "./services/grpc/gen/documentGeneration";
const request = FeatureDocumentationRequest.create({
title: "New Feature Documentation",
userDescription: "A new AI-powered feature",
content: "Please generate documentation for...",
processId: "550e8400-e29b-41d4-a716-446655440000",
});
// Serialize to binary
const bytes = FeatureDocumentationRequest.toBinary(request);
Using the Service Descriptor for gRPC Client
import { GrpcDocumentationGeneration } from "./services/grpc/gen/documentGeneration";
// The service type defines 6 RPC methods:
// - UserRequestFeatureDocumentation (unary)
// - RequestUserReviewDocumentationFromProcess (unary)
// - RequestUserReviewDocumentation (server streaming)
// - UserReviewedDocumentation (unary)
// - PublishDocumentation (unary)
// - ReceivePublishedDocumentation (server streaming)
console.log(GrpcDocumentationGeneration.typeName); // "GrpcDocumentationGeneration"
console.log(GrpcDocumentationGeneration.methods.length); // 6
Related Pages
- Environment:Microsoft_Semantic_kernel_DotNet_SDK_Environment
- Microsoft_Semantic_kernel_CloudEvents_App -- Root App component that uses the gRPC client built from these types
- Microsoft_Semantic_kernel_CloudEvents_GenerateDocumentsChat -- Chat component that drives the document generation workflow
- Microsoft_Semantic_kernel_CloudEvents_PackageLock -- npm lock file containing @protobuf-ts dependencies