forked from microsoft/semantic-kernel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkernel_base.py
More file actions
84 lines (70 loc) · 2.19 KB
/
Copy pathkernel_base.py
File metadata and controls
84 lines (70 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# Copyright (c) Microsoft. All rights reserved.
from abc import ABC, abstractmethod
from logging import Logger
from typing import Any, Dict, Optional
from semantic_kernel.kernel_config import KernelConfig
from semantic_kernel.memory.semantic_text_memory_base import SemanticTextMemoryBase
from semantic_kernel.orchestration.context_variables import ContextVariables
from semantic_kernel.orchestration.sk_context import SKContext
from semantic_kernel.orchestration.sk_function_base import SKFunctionBase
from semantic_kernel.semantic_functions.semantic_function_config import (
SemanticFunctionConfig,
)
from semantic_kernel.skill_definition.read_only_skill_collection_base import (
ReadOnlySkillCollectionBase,
)
from semantic_kernel.template_engine.protocols.prompt_templating_engine import (
PromptTemplatingEngine,
)
class KernelBase(ABC):
@property
@abstractmethod
def config(self) -> KernelConfig:
pass
@property
@abstractmethod
def logger(self) -> Logger:
pass
@property
@abstractmethod
def memory(self) -> SemanticTextMemoryBase:
pass
@property
@abstractmethod
def prompt_template_engine(self) -> PromptTemplatingEngine:
pass
@property
@abstractmethod
def skills(self) -> ReadOnlySkillCollectionBase:
pass
@abstractmethod
def register_semantic_function(
self,
skill_name: Optional[str],
function_name: str,
function_config: SemanticFunctionConfig,
) -> SKFunctionBase:
pass
@abstractmethod
def import_skill(
self, skill_instance: Any, skill_name: str = ""
) -> Dict[str, SKFunctionBase]:
pass
@abstractmethod
def register_memory(self, memory: SemanticTextMemoryBase) -> None:
pass
@abstractmethod
async def run_async(
self,
*functions: Any,
input_context: Optional[SKContext],
input_vars: Optional[ContextVariables],
input_str: Optional[str]
) -> SKContext:
pass
@abstractmethod
def func(self, skill_name: str, function_name: str) -> SKFunctionBase:
pass
@abstractmethod
def create_new_context(self) -> SKContext:
pass