Skip to content

Commit

Permalink
reproducible.
Browse files Browse the repository at this point in the history
  • Loading branch information
joshlong committed Oct 19, 2024
1 parent a09972a commit d17c072
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@
import org.springframework.aot.hint.MemberCategory;
import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.RuntimeHintsRegistrar;
import org.springframework.aot.hint.TypeReference;
import org.springframework.lang.NonNull;
import org.springframework.lang.Nullable;

import java.util.Set;

import static org.springframework.ai.aot.AiRuntimeHints.findJsonAnnotatedClassesInPackage;

/**
Expand All @@ -36,14 +39,19 @@
*/
public class OpenAiRuntimeHints implements RuntimeHintsRegistrar {

private static Set<TypeReference> eval(Set<TypeReference> referenceSet) {
referenceSet.forEach(tr -> System.out.println(tr.toString()));
return referenceSet;
}

@Override
public void registerHints(@NonNull RuntimeHints hints, @Nullable ClassLoader classLoader) {
var mcs = MemberCategory.values();
for (var tr : findJsonAnnotatedClassesInPackage(OpenAiApi.class))
for (var tr : eval(findJsonAnnotatedClassesInPackage(OpenAiApi.class)))
hints.reflection().registerType(tr, mcs);
for (var tr : findJsonAnnotatedClassesInPackage(OpenAiAudioApi.class))
for (var tr : eval(findJsonAnnotatedClassesInPackage(OpenAiAudioApi.class)))
hints.reflection().registerType(tr, mcs);
for (var tr : findJsonAnnotatedClassesInPackage(OpenAiImageApi.class))
for (var tr : eval(findJsonAnnotatedClassesInPackage(OpenAiImageApi.class)))
hints.reflection().registerType(tr, mcs);
}

Expand Down

0 comments on commit d17c072

Please sign in to comment.