-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Description
Describe the bug
From 0.5.0dev, I received the error Value Error : Function with name '{func.name}' already exists in plugin '{plugin_name}. And it is from the duplication check when calling kernel.register_semantic_function().
I have a scenario where each request would pair with a historic messages, so I am using the code below for the registering the semantic chat function:
req_settings = AzureChatPromptExecutionSettings(
max_tokens=2000,
temperature=0,
messages=messages,
extension_data={"chat_system_prompt": self.system_message},
)
config = PromptTemplateConfig(
execution_settings=req_settings,
description="Pass in question and relevant context, you will get the answer relevant to the context",
default_services=["azure_openai_chat4_service"],
)
template = ChatPromptTemplate(
template=self.propmt_template,
template_engine=kernel.prompt_template_engine,
prompt_config=config,
parse_chat_system_prompt=True,
parse_messages=True,
)
function_config = SemanticFunctionConfig(config, template)
return kernel.register_semantic_function(
"rag", "qa_with_context", function_config
)
Since each request has different messages, and the only way right now to construct the messages is through the setting configuration above. so each request will register the semantic function, which caused the duplication check error.
To Reproduce
Running the above code twice in a session would have the error
Expected behavior
- Expose a remove plugin/function so that I could explicitly call it before register.
- Pass the messages attributes when invoking the function, so that I could register the function once and just calling it with messages parameter
It seems now, none of the above is provided.
Screenshots
If applicable, add screenshots to help explain your problem.
Platform
- OS: Windows
- IDE: VS Code
- Language: Python
- Source: 0.5.1dev
Additional context
Add any other context about the problem here.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status