Skip to content
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

Kernel Memory Integration #284

Open
tommasodotNET opened this issue Nov 23, 2024 · 5 comments
Open

Kernel Memory Integration #284

tommasodotNET opened this issue Nov 23, 2024 · 5 comments
Assignees
Labels
help wanted Extra attention is needed integration A new .NET Aspire integration

Comments

@tommasodotNET
Copy link
Contributor

tommasodotNET commented Nov 23, 2024

Overview

Kernel Memory is a great way to inject RAG capabilities in an application. It can be run as a container, so it'd be pretty easy to write the integration.

Usage example

var postgres = builder.AddPostres("postgres");

var kernelMemory = builder.AddKernelMemory("rag")
    .WithReference(postgres);

Note: Currently, the appsettings.json of KernelMemory would probably require something more like this:

var postgres = builder.AddPostres("postgres");

var kernelMemory = builder.AddKernelMemory("rag")
   .WithEnvironment("Postgres__ConnectionString", postgres);

Additional context

No response

Help us help you

Yes, I'd like to be assigned to work on this item

@tommasodotNET
Copy link
Contributor Author

cc. @dluc

@aaronpowell aaronpowell added the integration A new .NET Aspire integration label Nov 23, 2024
@aaronpowell
Copy link
Member

Would a client integration also be part of this?

Given you have to provide an appsettings.json would it make sense to model that similar to how the DAB integration works? Does the KM container image support config via environment variables? Given it's a .NET app I'd assume that it uses multiple config sources, so we wouldn't need to have any kind of config transformation.

If it does support environment variables as a config source, you could possibly even ditch the appsettings.json and just have a .NET object model that we translate to WithEnvironment("....", ...) calls.

@tommasodotNET
Copy link
Contributor Author

Since km offers a guided script to set up the appesettings, and given that the appsettings requires lots of configs, it might be worth it to follow the dab model. It would make the apphost using this integration cleaner.

Regarding the client integration, I'm thinking about it. It would surely be helpful to easily inject what is basically an http client with few methods.

@tommasodotNET tommasodotNET self-assigned this Nov 24, 2024
@aaronpowell
Copy link
Member

Being able to provide the config file makes sense for existing applications that use KM and want to add Aspire as the orchestration engine over it, but I would still think we should have a .NET API that allows you to configure the service via Aspire directly. Looking at the source code for KM the service calls https://github.com/microsoft/kernel-memory/blob/3f9a04a74e95195634c2f0107bda918c8dae3369/service/Core/Configuration/ConfigurationBuilderExtensions.cs#L20 and that will enable environment variables.

This means that we, at the very least, provide things like connection strings without having to have them "hacked" into the appsettings.json files.

Fundamentally, we could build an API like so:

var km = builder.AddKernelMemory("km")
    .WithAzureOpenAIText(aoai, "gpt-4o")
    // and configuration for other services
    ;

Also, we should have a client integration, as without that, it's going to really limit the integration of the server.

@tommasodotNET
Copy link
Contributor Author

I agree

@aaronpowell aaronpowell added the help wanted Extra attention is needed label Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed integration A new .NET Aspire integration
Projects
None yet
Development

No branches or pull requests

2 participants