There are various places with sample code that needs to be updated. Known places are
- [x] reference documentation
- [x] Azure AI Workshop
- [x] Sample Carnia RAG search application
Comment From: bertilmuth
Since I tried to use it, failed and had to adapt it anyway, I can provide an update to the example in: Open AI - Getting Started
If you want that, which format is best? Pull request?
Comment From: markpollack
Hi @bertilmuth
Sorry, I sort of wrote this issue as a reminder to myself as these samples are sort of scattered all over the place. I keep forgetting there are helpful people out there like yourself! Next time this issue comes up for the next release, i'll write a better issue on what to do. In some cases, like the Azure workshop, it is on the azure github org and only I have access to that.
Comment From: emileastih1
Hello,
I tried to use this section of the documentation OpenAI Manual Configuration to manual configure the OpenAI embedding client by creating an instance of OpenAiEmbeddingClient but it is not working.
The ".withDefaultOptions" method is not present on the OpenAiEmbeddingClient class.
I ended up doing the following to make it work:
var openAiApi = new OpenAiApi(openaiApiKey);
return new OpenAiEmbeddingClient(
openAiApi,
MetadataMode.EMBED,
OpenAiEmbeddingOptions.builder().withModel(OpenAiApi.DEFAULT_EMBEDDING_MODEL).build(),
RetryUtils.DEFAULT_RETRY_TEMPLATE);
Comment From: markpollack
Thanks for reporting. I think we need to remove or at least rename withDefaultOptions
in AzureOpenAiChatClient
as it is acting as a setter, not really changing any 'default' options, but changing the options completely. That indeed in missing in OpenAiEmbeddingClient
. I'll add a constructor to OpenAiEmbeddingClient to take options once I fix the CI github build action.
I'll move this to another issue.
Comment From: markpollack
https://github.com/spring-projects/spring-ai/issues/447 and thanks @emileastih1