spring-ai icon indicating copy to clipboard operation
spring-ai copied to clipboard

Add constructor to OpenAiEmbeddingClient that takes OpenAiEmbeddingOptions

Open markpollack opened this issue 1 year ago • 5 comments
trafficstars

See https://github.com/spring-projects/spring-ai/issues/262 for initial discussion.

markpollack avatar Mar 14 '24 19:03 markpollack

Can I take this issue by creating a new PR ?

emileastih1 avatar Mar 14 '24 20:03 emileastih1

I was looking at this issue, and I think the way that the class is created is sufficient and doesn't need any change because they are using constructor chaining to initialize a new instance of the OpenAiEmbeddingClient class.

Also there is already two constructors that takes "OpenAiEmbeddingOptions".

I was thinking about adding a new method called "withDefaultOptions" like what is suggested in the spring ai documentation but this is not needed because the initialization of the default options is done withing the constructors if the user didn't specify any, so it is already handled.

Finally, I think we could update the SpringAI documentation to match the actual code of the OpenAiEmbeddingClient class, but the only thing that is bugging me is to have different APIs (To initialize a new instance) for the OpenAiEmbeddingClient and for example OllamaEmbeddingClient which should practically be implemented in the same manner.

What do you think?

emileastih1 avatar Mar 15 '24 08:03 emileastih1

The same thing goes for OpenAiChatClient.java

emileastih1 avatar Mar 15 '24 08:03 emileastih1

Is anyone working on this issue?

jehyn923 avatar Mar 25 '24 13:03 jehyn923

Hello @jehyn923 , I am the last one who commented on this issue and was waiting for a reply from [markpollack] to check how to move forward with the issue.

emileastih1 avatar Mar 25 '24 14:03 emileastih1

Apologies for my poor project management skills. Looks like we are good now.

	public AzureOpenAiEmbeddingModel(OpenAIClient azureOpenAiClient, MetadataMode metadataMode,
			AzureOpenAiEmbeddingOptions options) {

markpollack avatar Jul 22 '24 18:07 markpollack