8000 Python: Provide methods to register single native function to the kernel in Python SDK · Issue #2321 · microsoft/semantic-kernel · GitHub
[go: up one dir, main page]

Skip to content

Python: Provide methods to register single native function to the kernel in Python SDK #2321

@blackchoey

Description

@blackchoey

I want to register a native function to the kernel when using the Python SDK. In .NET, the kernel has RegisterCustomFunction method to register a function. But in Python, seems there's only an import_skill method available, which requires me to declare a class with the native function in it.

The current experience of registering a native function:

class Test:
    @sk_function(name="getLightStatus")
    def get_light_status(self) -> str:
        return "off"

kernel.import_skill(Test())

The expected experience I want is:

@sk_function(name="getLightStatus")
def get_light_status() -> str:
    return "off"

kernel.register_native_function(get_light_status)

Metadata

Metadata

Assignees

Labels

.NETIssue or Pull requests regarding .NET codepythonPull requests for the Python Semantic Kernel

Type

No type

Projects

Status

Sprint: Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0