RoadieHQ/roadie-backstage-plugins

RAG AI plugin - support for Azure OpenAI

Opened this issue ยท 5 comments

Feature Suggestion

Support for Microsoft Azure OpenAI Service as an optional service provider that can be swapped out instead of OpenAI itself.

Possible Implementation

Not sure about implementation details, sorry ๐Ÿ˜… this is just an idea I wanted to share here.

Context

This would allow customers for whom Azure is the primary cloud provider to take advantage of this plugin, especially where there are concerns around AI and usage of an organization's proprietary data.

also have the same request here!

Hi, thanks. This makes a ton of sense and would be a good addition. I don't have an Azure account with OpenAI enabled at the moment so we would need some implementation help on this. Luckily it shouldn't be too big of a task to add this in.

The implementation of this on a base level would be very similar as AWS Bedrock currently is. There would be a need to create a new (Azure OpenAI) embeddings package, add the configuration options for it, and use the Langchain dependency to initialize these embeddings.

The approach would likely be mostly copy-pasting the current AWS implementation and modifying it to call Azure OpenAI instead.

Resources for this:

  • LangChain docs provides a full working example of everything needed. This should likely work as a first draft already
  • The AWS embeddings package can be used as a more or less direct copy-paste source to start from

Hi @Xantier,

I started to look into the implementation of the Azure OpenAI support, but I ran into the following issue:
Using AzureOpenAIEmbeddings from the latest @langchain/openai throws an error, as roadie's DefaultVectorAugmentationIndexer uses a different version of @langchain/core than the latest @langchain/openai.

I did a bit of digging and found that version 0.0.9 of @langchain/openai uses the matching version of @langchain/core, but that version doesn't have the AzureOpenAIEmbeddings yet.

Do you know any implementation of AzureOpenAIEmbeddings that uses a @langchain/core version that can be used with the DefaultVectorAugmentationIndexer? It would be great to use something without the need to update the retrieval augmenter.

Otherwise the implementation indeed seems quite straight-forward.

P.S.: Here is the issue I'm getting:

Type 'AzureOpenAIEmbeddings' is not assignable to type 'Embeddings'.
  Types of property 'caller' are incompatible.
    Type 'import("/Users/x/dev/developer-portal-2/backstage/node_modules/@langchain/core/dist/utils/async_caller").AsyncCaller' is not assignable to type 'import("/Users/x/dev/developer-portal-2/backstage/node_modules/@roadiehq/rag-ai-node/node_modules/@langchain/core/dist/utils/async_caller").AsyncCaller'.
      Property 'maxConcurrency' is protected but type 'AsyncCaller' is not a class derived from 'AsyncCaller'.

@szajcz Would the upgrade of the rest of the libraries to match Azure lib versions solve this or are there too many dependencies that would break in that case?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.