-
Notifications
You must be signed in to change notification settings - Fork 1.3k
AOT refinements for M7 #2664
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AOT refinements for M7 #2664
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,15 +16,10 @@ | |
|
||
package org.springframework.ai.openai.aot; | ||
|
||
import java.util.Set; | ||
|
||
import org.springframework.ai.openai.api.OpenAiApi; | ||
import org.springframework.ai.openai.api.OpenAiAudioApi; | ||
import org.springframework.ai.openai.api.OpenAiImageApi; | ||
import org.springframework.ai.openai.OpenAiChatOptions; | ||
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; | ||
|
||
|
@@ -40,23 +35,13 @@ | |
*/ | ||
public class OpenAiRuntimeHints implements RuntimeHintsRegistrar { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @joshlong what is the reasoning behind removing the OpenAI API types and just adding the OpenAIChatOptions here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It can not hurt to add them. please do. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sure, I will add them back and merge. |
||
|
||
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 : eval(findJsonAnnotatedClassesInPackage(OpenAiApi.class))) { | ||
hints.reflection().registerType(tr, mcs); | ||
} | ||
for (var tr : eval(findJsonAnnotatedClassesInPackage(OpenAiAudioApi.class))) { | ||
hints.reflection().registerType(tr, mcs); | ||
} | ||
for (var tr : eval(findJsonAnnotatedClassesInPackage(OpenAiImageApi.class))) { | ||
for (var tr : (findJsonAnnotatedClassesInPackage(OpenAiChatOptions.class))) { | ||
hints.reflection().registerType(tr, mcs); | ||
} | ||
|
||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will clean this up when merging.