openai / openai/openai-java

SDK Size

Open
#602 7 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question sdk
Dominant language
Kotlin
Stars
1.5k
Forks
264
Avg merge
9h 46m
Merged PRs (30d)
96

Description

Context

  • The jar dependency adds around 30MB to my final spring boot project, based on the main dependency and its child dependencies.
  • The decompressed openai-java-core takes about 76MB.
  • The ResponseStreamEvent.class is by itself 91KB. The contents of this file are more equivalent to a god function written in C than object oriented code written in Java. Maybe due to some sort of scripted code creation?
 62M	./com/openai/models
 10M	./com/openai/services

Concerns

  • The first concern is the added size in terms of MB to the project size.
  • The second concern is that when this code runs, it will instantiate larger than necessary objects that will consume more memory (compared to a better design).
    • For instance ResponseStreamEvent, it has: 51 member variables, leading to very large functions such as equals, hashcode, toString, and most other methods; across 2400 lines of code
  • The third concern is about forcing integrators to have to pull in Kotlin into a server side project. Additionally, when there is no intention to run on Android.

Feature Request

Please consider to:

  • refactor and remove the kotlin dependency
  • refactor and reduce the overall SDK size.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by measuring the openai-java-core dependency and inspecting the generated com/openai/models and com/openai/services contents, especially ResponseStreamEvent.class. Determine the scope of the Kotlin dependency and identify a feasible design for reducing generated code and SDK size; done means the requested dependency and size reductions are demonstrated without breaking the SDK.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, kotlin
Domain
backend-api-design, developer-experience
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.