Azure OpenAI %Embedding.Config
Hi all!
I want to create an %Embedding.Config to use with an %Embedding property. I followed the documentation for %Embedding.OpenAI, and it works fine after setting sslConfig, modelName, and apiKey.
However, I need to use AzureOpenAI. While the embedding process is similar to OpenAI's, Azure requires additional connection parameters, like an endpoint. My question is: is it possible to configure these extra parameters with %Embedding.Config, and if so, how?
Comments
Hi Henry,
The embedding class can be extended.
I give an example in demo application: https://openexchange.intersystems.com/package/toot
My parametrs were:
- modelName
- tokenizerPath
- HotStart
- modelPath
The config
The new config needs to be already present before you can compile a custom embedding class. The "toot" app above shows this in file "iris.script" ie: how you can set this when building in docker from scratch.
It currently is not available to add via SQL at this point of a dockerfile build, hence object insert.
Set embedConf=##class(%Embedding.Config).%New()
Set embedConf.Name="toot-v2-config"
Set embedConf.Configuration="{""modelName"": ""toot-v2-config"",""modelPath"":""/opt/hub/toot/"",""tokenizerPath"":""/opt/hub/toot/tokenizer_tune.json"",""HotStart"":1}"
Set embedConf.EmbeddingClass="TOOT.Data.Embedding2"
Set embedConf.VectorLength=384
Set embedConf.Description="an embedding model provided by Alex Woodhead"
Set tSC=embedConf.%Save()If you have an already installed instance, you can also use SQL to add and also update an existing embedding config.
Custom embedding class
In "toot" app, Look at source file "/src/XML/TOOT_Data_Embedding2_CLS.xml" this shows how the additional parameters are consumed by the custom embedding class.
Discussion
I started discussion article if you learn some new tricks and could consider also share about new challenges there also.
https://community.intersystems.com/post/vector-embeddings-feedback
Hope this helps
Help me a lot, thanks