mirror of
https://github.com/microsoft/semantic-kernel.git
synced 2026-10-12 02:19:06 +00:00
This PR provides a path to using the ChatGPT API in the Python Preview of Semantic Kernel. In addition, this provides `Azure*` versions of many existing models (so Python users can leverage Azure OpenAI). I think that, in general, it may be worth considering how best to work with models that have different modalities: now we have text completions, embeddings, chat completions (and I'd imagine images/etc. may be nice to support someday too). Regardless, this PR provides a fast path to using the exciting new Chat APIs from OpenAI with SK! See the new `python/tests/chat_gpt_api.py` for a usage example.
23 lines
671 B
Python
23 lines
671 B
Python
# Copyright (c) Microsoft. All rights reserved.
|
|
|
|
from dataclasses import dataclass
|
|
from typing import TYPE_CHECKING
|
|
|
|
from semantic_kernel.semantic_functions.chat_prompt_template import ChatPromptTemplate
|
|
|
|
if TYPE_CHECKING:
|
|
from semantic_kernel.semantic_functions.prompt_template import PromptTemplate
|
|
from semantic_kernel.semantic_functions.prompt_template_config import (
|
|
PromptTemplateConfig,
|
|
)
|
|
|
|
|
|
@dataclass
|
|
class SemanticFunctionConfig:
|
|
prompt_template_config: "PromptTemplateConfig"
|
|
prompt_template: "PromptTemplate"
|
|
|
|
@property
|
|
def has_chat_prompt(self) -> bool:
|
|
return isinstance(self.prompt_template, ChatPromptTemplate)
|