quarkiverse / quarkus-semantic-kernel

This extension eases the integration of Semantic Kernel for Java with Quarkus
https://learn.microsoft.com/en-us/semantic-kernel/overview/
Apache License 2.0
1 stars 1 forks source link

Semantic functions but actually "how to collaborate to this extension" #1

Closed morphy76 closed 1 year ago

morphy76 commented 1 year ago

Hi

I proposed the OpenAI client extension (#36827) which has been redirected to the semantic kernel extension.

It is not clear to me how to contribute to this one, I would like to use this issue to provide a first PR based on the SK-Recipes repository (https://github.com/johnmaeda/SK-Recipes)

The first recipe is about semantic functions and, within this context the task is about creating a semantic function provider.

The expected usage is based on configuration of semantic functions so that they can be injected by name:

quarkus.semantic-kernel.semantic-function.<skill_name>.name #which represents the function name
quarkus.semantic-kernel.semantic-function.<skill_name>.prompt #which represents the prompt of the function
quarkus.semantic-kernel.semantic-function.<skill_name>.[frequencyPenalty, ..., topP] #which represents the configuration of the function

So that it can be injected

@Inject CompletionSKFunction @SemanticFunction("<skill_name>") function;

// and used...
kernel.runAsync("whatever input", test);

This approach could be also usefull in a broader context where a full scan of available @SemanticFunction beans can be used to preconfigure a chained execution.

Looking up for comments or recommendations for a better approach.

Riccardo

morphy76 commented 1 year ago

Changed the configuration syntax into:

quarkus.semantic-kernel.semantic-function.from-directory=IMPORT_DIRECTORY
quarkus.semantic-kernel.semantic-function.skills.<skill_name>.functions.<function_name>.prompt={{\$input}}\n\nSummarize the content above in less than 140 characters.
agoncal commented 1 year ago

Fixed with https://github.com/quarkiverse/quarkus-semantic-kernel/pull/2