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

[Featyre] Reduce context #80

Merged
merged 16 commits into from
Apr 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 47 additions & 18 deletions utils/constants.js → config/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,52 @@ export const UPDATE_STATUS_MESSAGE = {
}

export const BECKN_STATUS_CALL = {
"context": {
"domain": "",
"location": {
"country": {
"code": "DE"
}
},
"action": "status",
"version": "1.1.0",
"bap_uri": "",
"bap_id": "",
"bpp_id": "",
"bpp_uri": "",
"timestamp": "2023-05-25T05:23:03.443Z",
"ttl": "P30M"
"context": {
"domain": "",
"location": {
"country": {
"code": "DE"
}
},
"message": {
"order_id": ""
}
"action": "status",
"version": "1.1.0",
"bap_uri": "",
"bap_id": "",
"bpp_id": "",
"bpp_uri": "",
"timestamp": "2023-05-25T05:23:03.443Z",
"ttl": "P30M"
},
"message": {
"order_id": ""
}
}

export const EMPTY_BECKN_TRANSACTION = {
id: false,
responses: {
on_search: {},
on_select: {},
on_init: {},
on_confirm: {}
}
}

export const EMPTY_SESSION = {
profile:{
selected_route:null
},
text : [],
actions : {
raw: [],
formatted: []
},
bookings: [],
routes:[],
orders:[],
last_action:false,
beckn_transaction : EMPTY_BECKN_TRANSACTION,
avoid_point: []
}


87 changes: 54 additions & 33 deletions config/language.json
Original file line number Diff line number Diff line change
@@ -1,53 +1,74 @@
{
"FULFILLMENT_STATUS_CODES":{
"order-picked-up":{
"message": "Your order has been picked up"
"FULFILLMENT_STATUS_CODES": {
"order-picked-up": {
"message": "Your order's on its way!"
},
"order-on-the-way": {
"message": "Your order is on the way"
"message": "Hang tight! Your order's cruising over to you."
},
"order-delivered":{
"message": "Your order has been delivered"
"order-delivered": {
"message": "Package alert! Your order's been delivered."
},
"ticket-issued":{
"message": "Your ticket has been issued"
},
"ticket-validated":{
"message": "Your ticket has been validated"
"ticket-issued": {
"message": "All set! Your ticket's ready to go."
},
"ticket-validated": {
"message": "You're all good! Your ticket's been validated."
},
"charging-started": {
"message": "Your charging has started"
},
"charging-stopped":{
"message": "Your charging has stopped"
},
"charger-not-working":{
"message": "Hi, it looks likes your charger is not working. DO you want to find other chargin stations?"
},
"charging-completed":{
"message": "Hi, your chargin is complete!"
"message": "Juice up! Your charging session's begun."
},
"charging-stopped": {
"message": "Heads up! Your charging session's been paused."
},
"charger-not-working": {
"message": "Uh-oh, looks like there's a glitch with your charger ⚡😓. Need help finding another spot? 📍🔍"
},
"charging-completed": {
"message": "Charged and ready! Your battery's full."
},
"checked-in": {
"message": "You have succesfully checked-in to your stay!"
},
"checked-out":{
"message": "You have succesfully checked-out from your stay!"
"message": "Welcome! You've successfully checked in."
},
"checked-out": {
"message": "Safe travels! You've checked out."
}
},
"ALL_MESSAGES": {
"session_cleared": "Your session has been cleared! You're all set to start a new one.",
"session_and_profile_cleared": "Both your session and profile have been cleared! You're ready to start fresh.",
"route_selected": "Your route is all set! Here's your navigation link: ${url}. What's next on your agenda?",
"request_in_progress": "Hang tight! We're currently processing your request...",
"request_processed": "All done! Your request has been processed and we're getting your response ready...",
"request_failed": "Oops, we hit a snag processing your request. Want to give it another shot?",
"request_to_beckn_failed": "Looks like we couldn't get that request through. How about we try something different?",
"request_in_progress": "Hang tight! I'm currently processing your request...",
"request_processed": "All done! Your request has been processed and I'm getting your response ready...",
"request_failed": "Oops, hit a snag processing your request. Want to give it another shot?",
"request_to_beckn_failed": "Looks like I couldn't get that request through. How about we try something different?",
"incident_on_road": "Heads up: ${message}. Could you share your current location so I can find some alternative routes for you?",
"formatting_failed": "We had trouble understanding that instruction.",
"api_call_failed": "Oops, we ran into an issue calling the API.",
"failed_to_process_instruction": "We had trouble processing that instruction.",
"formatting_failed": "I had trouble understanding that instruction.",
"api_call_failed": "Oops, I ran into an issue calling the API.",
"failed_to_process_instruction": "I had trouble processing that instruction.",
"missing_source": "Mind sharing the starting point for your journey?",
"missing_destination": "Could you let us know your destination?",
"route_list_description": "Here are some route options for you. Which one do you prefer?"
}
},
"TEST_MESSAGES_USER": [
"---Days before the travel---",
"Adam: Hey Alfred, you around?",
"Adam: I’m hitting Yellowstone National Park on April 12th for 2 days. Got any places to stay?",
"Adam: First one sounds awesome. Lets go with that",
"Adam: You got it - John A. Smith, [email protected], (555) 123-4567.",
"Adam: Sure, lets confirm!",

"---On the date of travel---",
"Adam: Alfred, can you find the best route to Yellowstone national park from Denver?",
"Adam: lets go with Route 1",
"Adam: Can you find ev chargers on the route?",
"Adam: Lets go with Tesla Supercharger",


"---Charging stopped due to an error---",
"Adam: Yeah, let’s find another charger",
"Adam: Let’s go with the second one.",
"Adam: Sure thing, lets book it",
"Adam: Yeah, let’s do it."
]
}
52 changes: 26 additions & 26 deletions config/message.json
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
{
"FULFILLMENT_STATUS_CODES":{
"order-picked-up":{
"message": "Your order has been picked up"
"FULFILLMENT_STATUS_CODES": {
"order-picked-up": {
"message": "Your order's on its way!"
},
"order-on-the-way": {
"message": "Your order is on the way"
"message": "Hang tight! Your order's cruising over to you."
},
"order-delivered":{
"message": "Your order has been delivered"
"order-delivered": {
"message": "Package alert! Your order's been delivered."
},
"ticket-issued":{
"message": "Your ticket has been issued"
},
"ticket-validated":{
"message": "Your ticket has been validated"
"ticket-issued": {
"message": "All set! Your ticket's ready to go."
},
"ticket-validated": {
"message": "You're all good! Your ticket's been validated."
},
"charging-started": {
"message": "Your charging has started"
},
"charging-stopped":{
"message": "Your charging has stopped"
},
"charger-not-working":{
"message": "Hi, it looks likes your charger is not working. DO you want to find other chargin stations?"
},
"charging-completed":{
"message": "Hi, your chargin is complete!"
"message": "Juice up! Your charging session's begun."
},
"charging-stopped": {
"message": "Heads up! Your charging session's been paused."
},
"charger-not-working": {
"message": "Uh-oh, looks like there's a glitch with your charger. Need help finding another spot?"
},
"charging-completed": {
"message": "Charged and ready! Your battery's full."
},
"checked-in": {
"message": "You have succesfully checked-in to your stay!"
},
"checked-out":{
"message": "You have succesfully checked-out from your stay!"
"message": "Welcome! You've successfully checked in."
},
"checked-out": {
"message": "Safe travels! You've checked out."
}
}
}
}
10 changes: 5 additions & 5 deletions config/openai.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
{ "action": "get_routes", "description": "If the user has requested for routes for a travel plan between two places. If the assistant has suggested to re-route in the last message and asked user to share current location, it should be a get_routes." },
{ "action": "select_route", "description": "If the user selects one of the routes from the routes shared by the assistant." },
{ "action": "search", "description": "If the user clearly indicates to perform a search for a specific product. Sample instructions : 'find a hotel', 'find an ev charger', 'find tickets'" },
{ "action": "select", "description": "If the user likes or selects any item, this action should be used. This action can only be called if a search has been called before." },
{ "action": "init", "description": "If the user wants to place an order after search and select and has shared the billing details. This action can only be called if a select has been called before." },
{ "action": "confirm", "description": "Confirm an order. This action gets called when users confirms an order. This action can only be called if an init has been called before." }
{ "action": "select", "description": "If the user likes or selects any item, this action should be used. This action can only be called if the last action was 'search'." },
{ "action": "init", "description": "If the user wants to place an order after search and select and has shared the billing details. This action can only be called if the last action was 'select'." },
{ "action": "confirm", "description": "Confirm an order. This action gets called when users confirms an order. This action can only be called if the last action was 'init'." }
],
"SCHEMA_TRANSLATION_CONTEXT": [
{ "role": "system", "content": "Your job is to identify the endpoint, method and request body from the given schema, based on the last user input and return the extracted details in the following JSON structure : \n\n {'url':'', 'method':'', 'body':''}'"},
{ "role": "system", "content": "Your job is to identify the endpoint, method and request body from the given schema, based on the last user input, conversation history, user profile, last action response and return the extracted details in the following JSON structure : \n\n {'url':'', 'method':'', 'body':''}'"},
{ "role": "system", "content": "A typical order flow should be search > select > init > confirm."},
{ "role": "system", "content": "Use the response of search from assistant to select items from the list of items provided by the assistant."},
{ "role": "system", "content": "Use the response of search request from assistant for filling transaction_id, bpp_id, bpp_uri in the context of all calls except `search`."},
{ "role": "system", "content": "Use the response of search request for filling transaction_id, bpp_id, bpp_uri in the context of all calls except `search`."},
{ "role": "system", "content": "For `select`, `init`, `confirm`, you must use the item `id` as part of the payload for selected item instead of name or any other key."}
]
}
Loading
Loading