-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support agent app & async tools (#89)
* Support agent demo app * Fixes * Fix tests * Downgrade Kuzu
- Loading branch information
Showing
23 changed files
with
2,088 additions
and
922 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Customer support agent demo | ||
|
||
This is a demo of a customer support app built using motleycrew and Ray. | ||
|
||
It includes sample data for populating the issue tree. | ||
|
||
|
||
## Installation and usage | ||
We suggest you set up a virtualenv for managing the environment. | ||
|
||
``` | ||
git clone https://github.com/ShoggothAI/motleycrew.git | ||
cd motleycrew | ||
pip install -r requirements.txt | ||
python -m motleycrew.applications.customer_support.issue_tree # populate the issue tree | ||
ray start --head | ||
python -m motleycrew.applications.customer_support.ray_serve_app | ||
``` | ||
|
||
Navigate to http://127.0.0.1:8000/ and have fun! | ||
Also, check out the Ray dashboard for the app logs etc. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
from abc import ABC, abstractmethod | ||
import asyncio | ||
|
||
|
||
class CommunicationInterface(ABC): | ||
@abstractmethod | ||
async def send_message_to_customer(self, message: str) -> str: | ||
""" | ||
Send a message to the customer and return their response. | ||
Args: | ||
message (str): The message to send to the customer. | ||
Returns: | ||
str: The customer's response. | ||
""" | ||
pass | ||
|
||
@abstractmethod | ||
def escalate_to_human_agent(self) -> None: | ||
""" | ||
Escalate the current issue to a human agent. | ||
""" | ||
pass | ||
|
||
@abstractmethod | ||
def resolve_issue(self, resolution: str) -> str: | ||
""" | ||
Resolve the current issue. | ||
Args: | ||
resolution (str): The resolution to the issue. | ||
Returns: | ||
str: The resolution to the issue. | ||
""" | ||
pass | ||
|
||
|
||
class DummyCommunicationInterface(CommunicationInterface): | ||
async def send_message_to_customer(self, message: str) -> str: | ||
print(f"Message sent to customer: {message}") | ||
return await asyncio.to_thread(input, "Enter customer's response: ") | ||
|
||
def escalate_to_human_agent(self) -> None: | ||
print("Issue escalated to human agent.") | ||
|
||
def resolve_issue(self, resolution: str) -> str: | ||
print(f"Proposed resolution: {resolution}") | ||
confirmation = input("Is the issue resolved? (y/n): ") | ||
if confirmation.lower().startswith("y"): | ||
return "Issue resolved" | ||
else: | ||
self.escalate_to_human_agent() | ||
|
||
|
||
# Placeholder for future implementation | ||
class RealCommunicationInterface(CommunicationInterface): | ||
async def send_message_to_customer(self, message: str) -> str: | ||
# TODO: Implement real asynchronous communication with the customer | ||
# This could involve integrating with a chat system, email, or other communication channels | ||
pass | ||
|
||
def escalate_to_human_agent(self) -> None: | ||
# TODO: Implement real escalation to a human agent | ||
# This could involve creating a ticket in a support system or notifying a human agent directly | ||
pass |
Oops, something went wrong.