Enable Dynamic Prompt Selection Using Context in Kernel Memory #909
attila-symanto
started this conversation in
2. Feature requests
Replies: 1 comment
-
@attila-symanto it's already possible to override the prompt using Here's an example: curl -X 'POST' \
'http://127.0.0.1:9001/ask' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"index": "default",
"minRelevance": 0,
"question": "Kernel Memory",
"args": {
"custom_rag_prompt_str": "Facts: {{$facts}}\n======\nSummarize all the facts above."
}
}' |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Summary
The current design of the AskQuestion method in Kernel Memory lacks flexibility in selecting custom prompts dynamically based on context. To address this, we propose passing the IContext object to the ReadPrompt method of the IPromptProvider interface. This enhancement will allow developers to tailor the LLM's responses by dynamically selecting prompts based on the provided context.
Detailed description
Currently, the IPromptProvider interface provides a way to supply custom prompts by implementing the ReadPrompt(string promptName) method. However, there is no mechanism to dynamically select a prompt based on contextual information. The AskQuestion method accepts an IContext object, which contains a key-value pair dictionary (Arguments) that could be leveraged to determine the appropriate prompt.
Unfortunately, the ReadPrompt method does not have access to this context, making it impossible to implement dynamic prompt selection. This limitation reduces the flexibility of the RAG solution, as developers cannot influence which prompt is used during a question-answering session.
By passing the IContext or its Arguments to the ReadPrompt method, the library would allow developers to select prompts based on dynamic input, significantly enhancing the customizability of the solution.
Beta Was this translation helpful? Give feedback.
All reactions