sashirestela / simple-openai

A Java library to use the OpenAI Api in the simplest possible way.
MIT License
144 stars 15 forks source link

FR: native-image metadata #174

Open dcolascione opened 3 weeks ago

dcolascione commented 3 weeks ago

It'd be nice if the reflection stuff were somehow included with the simple-openai library so that it's no longer necessary to use the native-image agent to dynamically collect reflection and proxy information.

sashirestela commented 3 weeks ago

@dcolascione Thanks for using simple-openai! I'm curious about what you are doing with that information?

dcolascione commented 3 weeks ago

Python's official OAI module takes 700ms to load. With GraalVM native image, the equivalent Java program with the same logic starts in 10ms.

dcolascione commented 3 weeks ago

That said, my FR should probably get punted over to Lombok. :-( Lombok uses runtime reflection for its various fancy automatic builder classes, and the right way to clue GraalVM native-image into this reflection scheme would be for Lombok to provide a Graal "feature" plugin that scans the code and adds any needed reflection declarations to the native image build configuration.