-
Notifications
You must be signed in to change notification settings - Fork 4k
.Net MEVD: Dependency Injection #12097
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
.Net MEVD: Dependency Injection #12097
Conversation
…o evenMoreDi # Conflicts: # dotnet/src/VectorDataIntegrationTests/PineconeIntegrationTests/PineconeEmbeddingGenerationTests.cs
Func<IServiceProvider, SearchIndexClient>? clientProvider = default, | ||
Func<IServiceProvider, AzureAISearchVectorStoreOptions>? optionsProvider = default, |
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.
this is the most flexible overload: the user can read anything form the service provider to create SearchIndexClient
and/or AzureAISearchVectorStoreOptions
or do nothing and we are going to try to resolve it from the DI
public static IServiceCollection AddAzureAISearchVectorStore( | ||
this IServiceCollection services, | ||
Uri endpoint, | ||
AzureKeyCredential keyCredential, |
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.
Same as above, but using AzureKeyCredential
rather than TokenCredential
(I kept it for backward copat and ease of use)
{ | ||
Endpoint = endpoint, | ||
ApiKey = apiKey | ||
}; |
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.
So far, we had an overload that was taking an optional HttpClient
and WeaviateVectorStoreOptions
:
Lines 32 to 33 in d7c2489
HttpClient? httpClient = default, | |
WeaviateVectorStoreOptions? options = default, |
And one of them was supposed to set the endpoint and api key. I decided to simplify it and just take the raw values here.
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.
I think this is OK, someone can still provide an httpclient via the clientProvider overloads.
this IServiceCollection services, | ||
object? serviceKey, | ||
Uri endpoint, | ||
string? apiKey, |
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.
This argument is nullable because for local testing, it can be null.
It's not optional, because I believe that it would be error prone for real-life scenarios (users missing the value in prod).
|
||
namespace RedisIntegrationTests.Support; | ||
|
||
internal class FakeDatabase : IDatabase |
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.
The Redis API does not allow to get a database without connecting to the server first. I wanted to keep those tests work no matter what, so I decided to fake the IDatabase
. I had no idea that this interface implements few hundreds of methods!
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.
Not a big deal, but also consider using Moq
35a7beb
into
microsoft:feature-vector-data-preb3
These are all the missing connectors.
Fixes #10549