Files
semantic-kernel/python/semantic_kernel/semantic_functions/semantic_function_config.py
T
Jordan Henkel 0ce2acbf6d ChatGPT API Python Support (#121)
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.
2023-04-13 16:12:36 -07:00

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)