Skip to content

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

[Feature Request] Allow arguments to be passed to the prompt when calling AskAsync #394

Closed
stavroskasidis opened this issue Apr 5, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@stavroskasidis
Copy link

Context / Scenario

I would like to be able to pass parameters to a custom prompt when calling the AskAsync method.

For example:
I want to conditionally instruct the LLM to automatically translate the response to a specific language that is selected by the user at runtime.

The problem

Cannot pass arguments to a customized prompt when asking.

Proposed solution

Lets say I add a custom prompt provider as shown here that has the following prompt:

"""
Facts:
{{$facts}}
======
Given only the facts above, provide a comprehensive/detailed answer.
You don't know where the knowledge comes from, just answer.
If you don't have sufficient information, reply with '{{$notFound}}'.
The answer must be translated in {{$translateLanguage}}
Question: {{$input}}
Answer: 
"""

I would like to be able to pass a Dictionary<string,string> with arguments to the AskAsync method that contains the translateLanguage argument, for example

var result = await memory.AskAsync(question, 
promptArguments: new { { "translateLanguage", userLanguage } });

Importance

would be great to have

@stavroskasidis stavroskasidis added the enhancement New feature or request label Apr 5, 2024
@luismanez
Copy link
Contributor

Haven't tried this, but have you considered to use SemanticKernel and KernelMemory as Plugin? that way, you can configure your Prompt as you say, and the facts section would be replaced by a call to the KM plugin.
This article is a good starting point: https://www.developerscantina.com/p/semantic-kernel-memory/

@stavroskasidis
Copy link
Author

This is an interesting suggestion. I will give a try, thank you

@microsoft microsoft locked and limited conversation to collaborators Jun 5, 2024
@dluc dluc converted this issue into discussion #617 Jun 5, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants