Replies: 1 comment 1 reply
-
Hi! Could you provide the full stack trace? It'd also be nice if you can reformat your question so that the code is easier to read. Usually, when you see the |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have created two files test.py and ai_agents.py
i have invoke orchestration logic in test.py like below
if parsed_response["proceed"]=="true":
agents, handoffs = get_agents(kernel)
handoff_orchestration = HandoffOrchestration(
members=agents,
handoffs=handoffs,
agent_response_callback=agent_response_callback
)
orchestration_input = ChatMessageContent(
role=AuthorRole.USER,
content=f"""{json.dumps(parsed_response["category"])} """)
runtime = InProcessRuntime()
runtime.start()
print(handoff_orchestration) //Code works correctly till here
orchestration_result = await handoff_orchestration.invoke(orchestration_input,runtime=runtime)
value = await orchestration_result.get()
print(value)
await runtime.stop_when_idle()
return {"status": "success", "result": value}
ai_agents.py file
from semantic_kernel.functions import kernel_function
from semantic_kernel import Kernel
from semantic_kernel.agents import Agent, ChatCompletionAgent, HandoffOrchestration, OrchestrationHandoffs
from semantic_kernel.connectors.ai.open_ai import OpenAIChatCompletion,AzureChatCompletion
from semantic_kernel.contents import AuthorRole, ChatMessageContent
from config.logs import AzureMonitorConfig
class CreditCardPlugin:
@kernel_function(name="block_credit_card", description="Block a credit card")
async def block_credit_card(card_details: str = "") -> str:
print(f" Blocking credit card: {card_details}")
return f"Credit card has been blocked successfully. Details: {card_details}"
class CustomerServiceAgent:
@kernel_function(name="update_customer_info", description="Update customer information")
async def update_customer_info(self, update_details: str = "") -> str:
print(f"Updating customer info: {update_details}")
return f" Your customer information has been updated successfully. Details: {update_details}"
class RefundPlugin:
@kernel_function(name="process_refund", description="Process a refund request")
async def process_refund(self, refund_details: str = "") -> str:
print(f" Processing refund: {refund_details}")
return f" Your refund request has been processed successfully. Details: {refund_details}"
def get_agents(kernel:Kernel) -> tuple[list[Agent], OrchestrationHandoffs]:
"""Return a list of agents that will participate in the Handoff orchestration and the handoff relationships.
def agent_response_callback(message: ChatMessageContent) -> None:
"""Observer function to print the messages from the agents."""
print(f"{message.name}: {message.content}")
return f"{message.name}: {message.content}"
It was working fine but after sometime it started giving error like
lambda agent=agent, handoff_connections=handoff_connections: HandoffAgentActor( # type: ignore[misc]
_deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
rv = reductor(4)
^^^^^^^^^^^
TypeError: cannot pickle '_thread.RLock' object
This error is constantly coming and is it a bug in latest semantic kernel version?
I am working with latest 1.33.0 version of semantic kernel , Please provide some inputs or if any package is missing?
Beta Was this translation helpful? Give feedback.
All reactions