Files
semantic-kernel/python/semantic_kernel/skill_definition/function_view.py
T
77eeff2cd6 Python: Adgudime/python/serialization/skill definition (#2329)
This is part 4 of the Serialization work for semantic kernel.

Corresponding issue:
https://github.com/microsoft/semantic-kernel/issues/131

### Motivation and Context

While there are no user facing changes, the ReadOnlySkillCollection has
been modified to remove
circular dependencies that were causing issues with serialization.

<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
  1. Why is this change required?
  2. What problem does it solve?
  3. What scenario does it contribute to?
  4. If it fixes an open issue, please link to the issue here.
-->

### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->

### Contribution Checklist

<!-- Before submitting this PR, please make sure: -->

- [x] The code builds clean without any errors or warnings
- [x] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [x] All unit tests pass, and I have added new tests where possible
- [x] I didn't break anyone 😄

---------

Co-authored-by: Abby Harrison <[email protected]>
Co-authored-by: Abby Harrison <[email protected]>
2023-08-04 23:46:17 +00:00

36 lines
958 B
Python

# Copyright (c) Microsoft. All rights reserved.
from typing import List
from semantic_kernel.sk_pydantic import SKBaseModel
from semantic_kernel.skill_definition.parameter_view import ParameterView
from semantic_kernel.utils.validation import validate_function_name
class FunctionView(SKBaseModel):
name: str
skill_name: str
description: str
is_semantic: bool
parameters: List[ParameterView]
is_asynchronous: bool = True
def __init__(
self,
name: str,
skill_name: str,
description: str,
parameters: List[ParameterView],
is_semantic: bool,
is_asynchronous: bool = True,
) -> None:
validate_function_name(name)
super().__init__(
name=name,
skill_name=skill_name,
description=description,
parameters=parameters,
is_semantic=is_semantic,
is_asynchronous=is_asynchronous,
)