-
Notifications
You must be signed in to change notification settings - Fork 537
[WIP -DO NOT REVIEW] AI: Adds AzureOpenAIEmbeddingGenerator provider for issue #5842 #5849
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ananth7592
wants to merge
10
commits into
main
Choose a base branch
from
users/amudumba/5842-azureopenai-embedding-generator
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
22a16ff
Adds EmbeddingSource block to Embedding mode
aavasthy 2eebc48
Query: Adds IEmbeddingGenerator interface and EmbeddingGenerator opti…
ananth7592 075f499
Query: Refactors IEmbeddingGenerator per review feedback
ananth7592 c1f0672
Embedding: Adds Microsoft.Azure.Cosmos.Embedding package scaffold
ananth7592 946678c
Embedding: Renames package from Microsoft.Azure.Cosmos.Embedding to M…
ananth7592 559ffed
[Internal] Embedding: Adds Azure DevOps publishing pipelines for Micr…
ananth7592 a7aca08
[Internal] Embedding: Fixes Newtonsoft.Json explicit reference requir…
ananth7592 e524bd5
AI: Adds AzureOpenAIEmbeddingGenerator with unit tests
ananth7592 e36db3e
[Internal] AI: Fixes SDK project reference to compile preview-gated t…
ananth7592 b2af876
[Internal] AI: Sets IsPreview=true in csproj so VS and plain dotnet b…
ananth7592 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
| <Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" /> | ||
| </Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| // ------------------------------------------------------------ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // ------------------------------------------------------------ | ||
|
|
||
| using System.Runtime.CompilerServices; | ||
|
|
||
| [assembly: InternalsVisibleTo("Microsoft.Azure.Cosmos.AI.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100197c25d0a04f73cb271e8181dba1c0c713df8deebb25864541a66670500f34896d280484b45fe1ff6c29f2ee7aa175d8bcbd0c83cc23901a894a86996030f6292ce6eda6e6f3e6c74b3c5a3ded4903c951e6747e6102969503360f7781bf8bf015058eb89b7621798ccc85aaca036ff1bc1556bb7f62de15908484886aa8bbae")] | ||
373 changes: 373 additions & 0 deletions
373
Microsoft.Azure.Cosmos.AI/src/AzureOpenAIEmbeddingGenerator.cs
Large diffs are not rendered by default.
Oops, something went wrong.
89 changes: 89 additions & 0 deletions
89
Microsoft.Azure.Cosmos.AI/src/Microsoft.Azure.Cosmos.AI.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
| <PropertyGroup> | ||
| <TargetFramework>netstandard2.0</TargetFramework> | ||
| <AssemblyName>Microsoft.Azure.Cosmos.AI</AssemblyName> | ||
| <RootNamespace>Microsoft.Azure.Cosmos.AI</RootNamespace> | ||
| <LangVersion>$(LangVersion)</LangVersion> | ||
| <!-- This package depends on ICosmosEmbeddingGenerator and EmbeddingSource which are | ||
| #if PREVIEW-gated public types in the core SDK. Setting IsPreview=true here ensures | ||
| Directory.Build.props adds the PREVIEW compile symbol for this project (and transitively | ||
| for the core SDK when using ProjectReference via AdditionalProperties), so VS and plain | ||
| 'dotnet build' both work without passing /p:IsPreview=true on the command line. --> | ||
| <IsPreview>true</IsPreview> | ||
| <CosmosAIVersion Condition=" '$(IsPreview)' != 'true' ">$(CosmosAIOfficialVersion)</CosmosAIVersion> | ||
| <CosmosAIVersion Condition=" '$(IsPreview)' == 'true' ">$(CosmosAIPreviewVersion)</CosmosAIVersion> | ||
| <CosmosAIVersionSuffix Condition=" '$(IsPreview)' == 'true' ">$(CosmosAIPreviewSuffixVersion)</CosmosAIVersionSuffix> | ||
| <Version Condition=" '$(CosmosAIVersionSuffix)' == '' ">$(CosmosAIVersion)</Version> | ||
| <Version Condition=" '$(CosmosAIVersionSuffix)' != '' ">$(CosmosAIVersion)-$(CosmosAIVersionSuffix)</Version> | ||
| <CurrentDate>$([System.DateTime]::Now.ToString(yyyyMMdd))</CurrentDate> | ||
| <Company>Microsoft Corporation</Company> | ||
| <Authors>Microsoft</Authors> | ||
| <Description>AI extensions library for Azure Cosmos DB for NoSQL. Provides an Azure OpenAI / Foundry-backed embedding provider for automatic vector embedding generation in hybrid and vector search queries. Designed to be extensible for broader AI scenarios including semantic re-ranking, OCR, and model integrations. For more information, refer to https://aka.ms/CosmosDB</Description> | ||
| <Copyright>© Microsoft Corporation. All rights reserved.</Copyright> | ||
| <Title>Microsoft Azure Cosmos DB AI extensions library</Title> | ||
| <PackageId>Microsoft.Azure.Cosmos.AI</PackageId> | ||
| <PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance> | ||
| <PackageLicenseExpression>MIT</PackageLicenseExpression> | ||
| <PackageProjectUrl>https://github.com/Azure/azure-cosmos-dotnet-v3</PackageProjectUrl> | ||
| <GeneratePackageOnBuild>false</GeneratePackageOnBuild> | ||
| <GenerateDocumentationFile>true</GenerateDocumentationFile> | ||
| <TreatWarningsAsErrors>true</TreatWarningsAsErrors> | ||
| <PackageTags>microsoft;azure;cosmos;cosmosdb;documentdb;nosql;azureofficial;dotnetcore;netcore;netstandard;ai;embedding;vector;openai;semanticranking</PackageTags> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <AdditionalFiles Include="..\..\Microsoft.Azure.Cosmos\src\stylecop.json" Link="stylecop.json" /> | ||
| </ItemGroup> | ||
|
|
||
| <!-- Core SDK reference: project ref when building from source, otherwise NuGet pin. | ||
| This package depends on ICosmosEmbeddingGenerator and EmbeddingSource which are | ||
| #if PREVIEW-gated in the core SDK, so we always need a preview-built SDK. | ||
| - ProjectReference: AdditionalProperties forces IsPreview=true on the core SDK build | ||
| so the preview-gated types are compiled as public, without requiring the caller | ||
| to pass /p:IsPreview=true globally. | ||
| - NuGet: always reference the preview version (preview NuGet is built with PREVIEW defined). --> | ||
| <ItemGroup Condition=" '$(SdkProjectRef)' != 'True' "> | ||
| <PackageReference Include="Microsoft.Azure.Cosmos" Version="3.60.0-preview.0" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup Condition=" '$(SdkProjectRef)' == 'True' "> | ||
| <ProjectReference Include="..\..\Microsoft.Azure.Cosmos\src\Microsoft.Azure.Cosmos.csproj" | ||
| AdditionalProperties="IsPreview=true" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <None Include="..\..\Icon.png" Pack="true" PackagePath=""/> | ||
| </ItemGroup> | ||
|
|
||
| <!-- Required by Microsoft.Azure.Cosmos SDK; PrivateAssets=All keeps it off the public dependency graph --> | ||
| <ItemGroup> | ||
| <PackageReference Include="Newtonsoft.Json" Version="10.0.2" NoWarn="NU1903" PrivateAssets="All" /> | ||
| </ItemGroup> | ||
|
|
||
| <!-- Azure OpenAI provider dependency --> | ||
| <ItemGroup> | ||
| <PackageReference Include="Azure.AI.OpenAI" Version="2.1.0" /> | ||
| </ItemGroup> | ||
|
|
||
| <!-- Analyzers --> | ||
| <ItemGroup> | ||
| <PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" /> | ||
| <PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="16.0.102" PrivateAssets="All" /> | ||
| </ItemGroup> | ||
|
|
||
| <!-- Strong-name signing --> | ||
| <PropertyGroup> | ||
| <SigningType>Product</SigningType> | ||
| <SignAssembly>true</SignAssembly> | ||
| <DelaySign>true</DelaySign> | ||
| <AssemblyOriginatorKeyFile>..\..\35MSSharedLib1024.snk</AssemblyOriginatorKeyFile> | ||
| </PropertyGroup> | ||
|
|
||
| <PropertyGroup Condition=" '$(SdkProjectRef)' == 'True' "> | ||
| <DefineSdkProjectRefSymbol Condition=" '$(DefineSdkProjectRefSymbol)' == '' ">true</DefineSdkProjectRefSymbol> | ||
| </PropertyGroup> | ||
|
|
||
| <PropertyGroup Condition=" '$(DefineSdkProjectRefSymbol)' == 'true' "> | ||
| <DefineConstants>$(DefineConstants);SDKPROJECTREF</DefineConstants> | ||
| </PropertyGroup> | ||
| </Project> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the .NET org, they have a task to generate this at build time so that you don't have to look at the PublicKey in source, not important, as this works too, but might be interesting to look at.