Files
semantic-kernel/samples/java/JavaReferenceSkill
972d8782a5 gRPC skills functionality (#814)
### Motivation and Context

This PR adds MVP functionality for gRPC skills by introducing a set of
classes for importing, parsing and executing gRPC operations defined in
the .proto files. This functionality may be useful in scenarios when
skills are represented as methods that are hosted on a different machine
and need to be called remotely.

### Description
The PR adds the following classes:
- ProtoDocumentParser - iterates over a all methods of all services
declared in .proto file and creates an instance of GrpcOperation model
class for each of them.
- GrpcOperation - model class representing gRPC operation.
- GrpcOperationRunner - accepts an instance of the GrpcOperation class
and a collection of arguments. Dynamically creates an instance of gRPC
method request and calls the method. Receives, transforms and returns
the method call result.
- GrpcOperationExtensions - extension methods for GrpcOperation to
extend the class with SK SDK domain related functionality.
- KernelGrpcExtensions - declares a few register and import methods for
importing the gRPC skills from a folder or a file and registering them
in SK Kernel.


Co-authored-by: Shawn Callegari <[email protected]>
Co-authored-by: Govind Kamtamneni <[email protected]>
2023-05-08 16:32:42 -07:00
..
2023-05-08 16:32:42 -07:00
2023-05-08 16:32:42 -07:00
2023-05-08 16:32:42 -07:00
2023-05-08 16:32:42 -07:00

Java Reference Skill gRPC Server

This is a sample Java gRPC server that can be invoked via SK's gRPC client as a Native Skill/Function. The purpose of this project is to demonstrate how Polyglot skills can be supported using either REST or gRPC.

Prerequisites

  • Java 17
  • Maven

Build

To build the project, run the following command:

mvn clean package

To generate the gRPC classes, run the following command:

mvn protobuf:compile

Run

To run the project, run the following command:

java -jar ./target/JavaReferenceSkill-1.0-SNAPSHOT-jar-with-dependencies.jar