Skip to content

Conversation

@jdubois
Copy link

@jdubois jdubois commented Oct 21, 2025

This follows the discussion on ticket #3368

This is a draft PR as the work is pretty big, I'll start with the simpler implementations (Embeddings) and finish with the more complex one (Chat).

@jdubois
Copy link
Author

jdubois commented Oct 22, 2025

With today's commit, we now have:

  • Support for EmbeddingModel
  • Support for ImageModel

And some basic shared configuration, that will be improved next, so we're ready for the more complex stuff (ChatModel).

@jdubois
Copy link
Author

jdubois commented Oct 23, 2025

The setup logic for the OpenAI SDK should be very similar to this class from LangChain4, because it's basically doing the same thingj:

https://github.com/langchain4j/langchain4j/blob/main/langchain4j-open-ai-official/src/main/java/dev/langchain4j/model/openaiofficial/InternalOpenAiOfficialHelper.java

I'm very careful before taking code from another project, but I believe this is fine: I'm the author of that other class, so I have the copyright on this code. Also, it's simple logic to connect to Azure/GitHub Models/OpenAI, nothing that is very specific or critical.

However, if this causes problems:

  • I can talk to OpenAI to check if that can be included into their code (I don't think they'll agree as they try to have something generic)
  • I can create my own library, but having both projects depend on a small library that I would maintain doesn't seem a good idea to me

Happy to discuss this if needed.

@jdubois
Copy link
Author

jdubois commented Nov 4, 2025

Argh, I updated my fork and now my commit history is all wrong!!!! I'll do my best to fix this.

- Add support for ImageModel
- Refactor the existing code now that we have support for 2 models

Signed-off-by: Julien Dubois <[email protected]>
- Added support for authentication with OpenAI, Azure OpenAI and GitHub models.
- Added support for complex OpenAI client configuration
- Refactored the existing code to use those new methods

Signed-off-by: Julien Dubois <[email protected]>
Create the OpenAiOfficialChatOptions class to prepare for the implementation of the Chat Model

Signed-off-by: Julien Dubois <[email protected]>
Create the OpenAiOfficialChatModel class:
- This is a first implementation that is not of good quality yet
- Tests do not pass yet

Signed-off-by: Julien Dubois <[email protected]>
- Improve authentication, mostly with Azure OpenAI

Signed-off-by: Julien Dubois <[email protected]>
- First tests passing for ChatModel

Signed-off-by: Julien Dubois <[email protected]>
- More tests passing for ChatModel

Signed-off-by: Julien Dubois <[email protected]>
@jdubois
Copy link
Author

jdubois commented Nov 4, 2025

I had to force push my fork, sorry if anyone had this pulled on their side! I'll check if everything is good, otherwise I have a backup on my laptop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant