-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #285 from gs-snagaraj/main
Support OpenAIFunction Custom object Schema
- Loading branch information
Showing
6 changed files
with
160 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
...-examples/src/main/java/com/microsoft/semantickernel/samples/demos/lights/LightModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
.../main/java/com/microsoft/semantickernel/samples/demos/lights/LightModelTypeConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.microsoft.semantickernel.samples.demos.lights; | ||
|
||
import com.google.gson.Gson; | ||
import com.microsoft.semantickernel.contextvariables.ContextVariableTypeConverter; | ||
|
||
public class LightModelTypeConverter extends ContextVariableTypeConverter<LightModel> { | ||
private static final Gson gson = new Gson(); | ||
|
||
public LightModelTypeConverter() { | ||
super( | ||
LightModel.class, | ||
obj -> { | ||
if(obj instanceof String) { | ||
return gson.fromJson((String)obj, LightModel.class); | ||
} else { | ||
return gson.fromJson(gson.toJson(obj), LightModel.class); | ||
} | ||
}, | ||
(types, lightModel) -> gson.toJson(lightModel), | ||
json -> gson.fromJson(json, LightModel.class) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters