Я работаю с Python SDK из семантического ядра Microsoft и пытаюсь вызвать функцию плагина с аргументами с использованием Agent.invoke (сообщения, аргументы). Тем не менее, аргументы, кажется, не передаются методу плагина. /> < /ol>
# Create a Plugin
class DatabrickConnector:
@kernel_function(description="This function gives description about the asked topic")
async def multiply(self, prompt: str, **kwargs) -> str:
return self.client.beta.chat.completions.parse(
model=openai_gpt_deployment_name,
messages=[
{"role": "user", "content": question + kwargs['topic']}
],
)
# Create AzureChatCompletion Service
from semantic_kernel.connectors.ai.open_ai.services.azure_chat_completion import AzureChatCompletion
service_id = "azure-openai"
chat_service = AzureChatCompletion(
service_id=service_id,
deployment_name=openai_gpt_deployment_name,
api_key = openai_api_key,
api_version = openai_api_version,
endpoint = openai_api_base
)
# Creating the kernel and add service, plugin
from semantic_kernel.kernel import Kernel
kernel_RAG = Kernel()
kernel_RAG.add_service(chat_service)
kernel_RAG.add_plugin(DatabrickConnector(), plugin_name="DatabrickConnector")
# Initialize the agent
from semantic_kernel.agents import ChatCompletionAgent
agent = ChatCompletionAgent(
kernel=kernel_RAG,
name="Response_Agent",
instructions="Provide description about the asked topic"
)
< /code>
response = agent.invoke(messages="Provide very detailed description about ", arguments = KernelArguments(topic = "Semantic Kernel")
< /code>
Here, the kernel function is getting invoked, but KernelArgument is not getting passed to the function. How do I ensure that kernel function is invoked with the right arguments?
Подробнее здесь: https://stackoverflow.com/questions/796 ... tic-kernel
Аргументы, не достигающие методов плагина при призыве к ядру в семантическом ядре (Python) ⇐ Python
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Как получить значение раскрывающегося меню в семантическом пользовательском интерфейсе?
Anonymous » » в форуме Jquery - 0 Ответы
- 75 Просмотры
-
Последнее сообщение Anonymous
-