-
Notifications
You must be signed in to change notification settings - Fork 313
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
SM like SK should be AI service agnostic #101
Comments
hi @geffzhang I think the solution is already provider agnostic, isn't it? SearchClient depends on |
thanks, I see repo only support openai/azure openai,I tried to support llamasharp these two days and it is indeed service agnostic. but how to support config service in SemanticMemoryConfig: config.DataIngestion.EmbeddingGeneratorTypes QdrantConfig should has vectorsize , 1536 is openai embedding vectorsize |
Can we extract the ITextEmbeddingGeneration and ITextGeneration interfaces into a separate Nuget package so that AI providers can implement them on their own? |
@geffzhang the integration with llamasharp should look something like this: using Microsoft.SemanticMemory;
using Microsoft.SemanticMemory.AI;
using Microsoft.SemanticMemory.MemoryStorage.Qdrant;
public class Program
{
public static void Main()
{
var llamaConfig = new LlamaConfig
{
// ...
};
var openAIConfig = new OpenAIConfig
{
EmbeddingModel = "text-embedding-ada-002",
APIKey = Env.Var("OPENAI_API_KEY")
};
var memory = new MemoryClientBuilder()
.WithCustomTextGeneration(new LlamaTextGeneration(llamaConfig))
.WithOpenAITextEmbedding(openAIConfig)
.WithQdrant(new QdrantConfig { /* ... */ });
// ...
}
}
public class LlamaConfig
{
// ...
}
public class LlamaTextGeneration : ITextGeneration
{
private readonly LlamaConfig _config;
public LlamaTextGeneration(LlamaConfig config)
{
this._config = config;
}
public IAsyncEnumerable<string> GenerateTextAsync(
string prompt,
TextGenerationOptions options,
CancellationToken cancellationToken = new())
{
// ...
}
} The vector size is handled automatically, as long as it is consistent across executions. The code above is using:
@xbotter it should be possible to use custom logic with the existing nuget. |
## Motivation and Context (Why the change? What's the scenario?) Refactoring some hard coded logic and allowing overrides/configuration, in order to support more scenarios. See #93 #101 #164 #182 ## High level description (Approach, Design) * custom search options for SearchClient, to support smaller models and custom deployments * allow to use a custom SearchClient, replacing the default used by KM
@geffzhang I think this is now solved. The solution allows to customize text generation, embedding generation, tokenization and RAG parameters such as how many tokens can be used. Summarization also takes into account the model characteristics. As far as possible the code will also log errors or throw exceptions if some value is incorrect, e.g. trying to run an 8000 tokens prompt with a model that supports only 4096 tokens, or trying to generate embedding for a string 4000 tokens long with a model that supports only 2000 tokens, etc. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Semantic Kernel 1.0 is AI service agnostic. Semantic kernel now only support azure openai/openai , We should make the Semantic memory AI provider agnostic.
The text was updated successfully, but these errors were encountered: