Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat : graph agent is added #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

vipul-maheshwari
Copy link
Contributor

Payload for Restaurant Ordering System

{
    "agent_config": {
        "agent_name": "A Graph Agent",
        "agent_welcome_message": "Hey!",
        "tasks": [
            {
                "tools_config": {
                    "output": {
                        "provider": "twilio"
                    },
                    "input": {
                        "provider": "twilio"
                    },
                    "synthesizer": {
                        "provider": "deepgram",
                        "stream": true,
                        "caching": true,
                        "provider_config": {
                            "voice": "Asteria",
                            "model": "aura-asteria-en"
                        },
                        "buffer_size": 100.0
                    },
                    "llm_agent": {
                        "agent_flow_type": "streaming",
                        "agent_type": "graph_agent",
                        "llm_config": {
                            "provider": "openai",
                            "model": "gpt-4o-mini",
                            "agent_information": "restaurant ordering system",
                            "nodes": [
                                {
                                    "id": "root",
                                    "content": "Welcome to our restaurant!",
                                    "prompt": "You are an AI assistant for a high-end restaurant. Greet the customer warmly and ask if they're interested in placing an order or inquiring about our catering services for events.",
                                    "edges": [
                                        {"to_node_id": "ordering", "condition": "customer wants to place an order"},
                                        {"to_node_id": "catering", "condition": "customer is interested in catering or events"},
                                        {"to_node_id": "end", "condition": "customer is not interested"}
                                    ]
                                },
                                {
                                    "id": "ordering",
                                    "content": "Let's take your order.",
                                    "prompt": "You're now handling a customer's order. Ask if they want to dine in or take out. Be polite and professional.",
                                    "edges": [
                                        {"to_node_id": "dine_in", "condition": "customer wants to dine in"},
                                        {"to_node_id": "takeout", "condition": "customer wants takeout"},
                                        {"to_node_id": "end", "condition": "customer is not interested"}
                                    ]
                                },
                                {
                                    "id": "dine_in",
                                    "content": "Great, let's find you a table.",
                                    "prompt": "You're handling a dine-in order. Ask about the number of people, any seating preferences, and start taking their food and drink orders. After the user is done with it's order, ask if the order is complete or not",
                                    "edges": [
                                        {"to_node_id": "finalize_order", "condition": "order is complete"},
                                        {"to_node_id": "end", "condition": "customer is not interested"},
                                        {"to_node_id": "takeout", "condition": "customer wants takeout"}
                                    ]
                                },
                                {
                                    "id": "takeout",
                                    "content": "Certainly, let's prepare your takeout order.",
                                    "prompt": "You're handling a takeout order. Ask for the items they want to order, suggest any daily specials or popular takeout items. Inquire about any dietary restrictions or preferences.",
                                    "edges": [
                                        {"to_node_id": "finalize_order", "condition": "order is complete"},
                                        {"to_node_id": "end", "condition": "customer is not interested"}
                                    ]
                                },
                                {
                                    "id": "catering",
                                    "content": "Let's discuss our catering services.",
                                    "prompt": "You're now discussing catering services. Ask about the type of event, number of guests, any theme or dietary requirements. Suggest our popular catering packages and any seasonal specialties.",
                                    "edges": [
                                        {"to_node_id": "finalize_catering", "condition": "catering inquiry is complete"},
                                        {"to_node_id": "end", "condition": "customer is not interested"}
                                    ]
                                },
                                {
                                    "id": "finalize_order",
                                    "content": "Let's confirm your order.",
                                    "prompt": "Summarize the customer's order, confirm all details, and provide the total cost. Ask if they need anything else before finalizing.",
                                    "edges": [
                                        {"to_node_id": "order_confirmed", "condition": "order is confirmed"},
                                        {"to_node_id": "end", "condition": "customer is not interested"}
                                    ]
                                },
                                {
                                    "id": "finalize_catering",
                                    "content": "Let's review your catering request.",
                                    "prompt": "Summarize the catering request, including event details, menu choices, and any special requirements. Provide a cost estimate and ask if they want to proceed with a formal booking.",
                                    "edges": [
                                        {"to_node_id": "order_confirmed", "condition": "order is confirmed"},
                                        {"to_node_id": "end", "condition": "customer is not interested"}
                                    ]
                                },
                                {
                                    "id": "order_confirmed",
                                    "content": "Your order has been confirmed.",
                                    "prompt": "Thank the customer for their order and let them know the estimated time for preparation or delivery. Ask if they need any further assistance.",
                                    "edges": [
                                        {"to_node_id": "end", "condition": "customer is satisfied with the order and don't have anything to talk"},
                                        {"to_node_id": "end", "condition": "customer does not need further assistance"}
                                    ]
                                },
                                {
                                    "id": "end",
                                    "content": "Thank you for contacting us",
                                    "prompt": "Everytime a user wants to end the conversation or the order is completed after all the confirmations, we will send them to this node.",
                                    "edges": []
                                } 
                            ],
                            "current_node_id": "root",
                            "context_data": {}
                        }
                    },
                    "transcriber": {
                        "endpointing": 123.0,
                        "stream": true,
                        "provider": "deepgram",
                        "model": "nova2",
                        "language": "en"
                    },
                    "api_tools": null
                },
                "task_config": {
                    "ambient_noise_track": "office-ambience",
                    "hangup_after_LLMCall": false,
                    "hangup_after_silence": 10.0,
                    "ambient_noise": false,
                    "interruption_backoff_period": 0.0,
                    "backchanneling": false,
                    "backchanneling_start_delay": 5.0,
                    "optimize_latency": true,
                    "incremental_delay": 100.0,
                    "call_cancellation_prompt": null,
                    "number_of_words_for_interruption": 3.0,
                    "backchanneling_message_gap": 5.0,
                    "use_fillers": false
                },
                "task_type": "conversation",
                "toolchain": {
                    "execution": "parallel",
                    "pipelines": [
                        [
                            "transcriber",
                            "llm",
                            "synthesizer"
                        ]
                    ]
                }
            }
        ],
        "agent_type": "Lead Qualification"
    },
    "agent_prompts": {
        "task_1": {
            "system_prompt": "You're a helpful assistant that books appointments for people."
        },
        "task_2": {
            "system_prompt": "Extract user's sentiment and get that as sentiment key in a JSON that you respond with."
        },
        "task_3": {
            "system_prompt": "Summarize the user component."
        }
    }
}

@AlexM4H
Copy link
Contributor

AlexM4H commented Sep 28, 2024

Can another person review this pr?

@prateeksachan
Copy link
Member

cc. https://github.com/orgs/bolna-ai/projects/2/views/1?pane=issue&itemId=81447223

@prateeksachan prateeksachan self-assigned this Sep 28, 2024
@dvillaume
Copy link

@vipul-maheshwari , this seems pretty cool! May I suggest adding a section to the README for everyone's benefit?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In progress
Development

Successfully merging this pull request may close these issues.

4 participants