Skip to content

Commit

Permalink
Fix leftover prompt conflict artifacts.
Browse files Browse the repository at this point in the history
  • Loading branch information
mc-dorzo committed Dec 29, 2024
1 parent be35a9e commit 5f86563
Showing 1 changed file with 0 additions and 243 deletions.
243 changes: 0 additions & 243 deletions src/parlant/core/engines/alpha/guideline_proposer.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,249 +394,6 @@ def _format_prompt(
IMPORTANT: Some guidelines include multiple actions. If only a portion of those actions were fulfilled earlier in the conversation, output "fully" for guideline_previously_applied, and treat the guideline as though it has been fully executed.
In such cases, re-apply the guideline only if its condition becomes true again later in the conversation, unless it is marked as continuous.
<<<<<<< HEAD
Examples of Condition Evaluations:
-------------------
<<<<<<< HEAD
Example #1:
- Interaction Events: ###
[{{"id": "11", "kind": "<message>", "source": "customer",
"data": {{"message": "Can I purchase a subscription to your software?"}}}},
{{"id": "23", "kind": "<message>", "source": "assistant",
"data": {{"message": "Absolutely, I can assist you with that right now."}}}},
{{"id": "34", "kind": "<message>", "source": "customer",
"data": {{"message": "Please proceed with the subscription for the Pro plan."}}}},
{{"id": "56", "kind": "<message>", "source": "assistant",
"data": {{"message": "Your subscription has been successfully activated.
Is there anything else I can help you with?"}}}},
{{"id": "78", "kind": "<message>", "source": "customer",
"data": {{"message": "Yes, can you tell me more about your data security policies?"}}}}]
###
- Guidelines: ###
1) condition: the customer initiates a purchase. action: Open a new cart for the customer
2) condition: the customer asks about data security. action: Refer the customer to our privacy policy page
3) condition: the customer asked to subscribe to our pro plan. action: maintain a helpful tone and thank them for shopping at our store
###
- **Expected Result**:
```json
{{ "checks": [
{{
"guideline_number": 1,
"condition": "the customer initiates a purchase",
"condition_application_rationale": "The purchase-related guideline was initiated earlier, but is currently irrelevant since the customer completed the purchase and the conversation has moved to a new topic.",
"condition_applies": false,
"applies_score": 3
}},
{{
"guideline_number": 2,
"condition": "the customer asks about data security",
"condition_applies": true,
"condition_application_rationale": "The customer specifically inquired about data security policies, making this guideline highly relevant to the ongoing discussion.",
"action": "Refer the customer to our privacy policy page",
"guideline_previously_applied_rationale": "This is the first time data security has been mentioned, and the user has not been referred to the privacy policy page yet",
"guideline_previously_applied": "no",
"guideline_is_continuous": false,
"guideline_should_reapply": false,
"applies_score": 9
}},
{{
"guideline_number": 3,
"condition": "the customer asked to subscribe to our pro plan",
"condition_applies": true,
"condition_application_rationale": "The customer recently asked to subscribe to the pro plan. The conversation is beginning to drift elsewhere, but still deals with the pro plan",
"action": "maintain a helpful tone and thank them for shopping at our store",
"guideline_previously_applied_rationale": "a helpful tone was maintained, but the agent didn't thank the customer for shoppint at our store, making the guideline partially fulfilled. By this, it should be treated as if it was fully followed",
"guideline_previously_applied": "partially",
"guideline_is_continuous": false,
"guideline_should_reapply": false,
"applies_score": 6
}}
]}}
```
###
Example #2:
- Interaction Events: ###
[{{"id": "11", "kind": "<message>", "source": "customer",
"data": {{"message": "I'm looking for a job, what do you have available?"}}}},
{{"id": "23", "kind": "<message>", "source": "assistant",
"data": {{"message": "Hi there! we have plenty of opportunities for you, where are you located?"}}}},
{{"id": "34", "kind": "<message>", "source": "customer",
"data": {{"message": "I'm looking for anything around the bay area"}}}},
{{"id": "56", "kind": "<message>", "source": "assistant",
"data": {{"message": "That's great. We have a number of positions available over there. What kind of role are you interested in?"}}}},
{{"id": "78", "kind": "<message>", "source": "customer",
"data": {{"message": "Anything to do with training and maintaining AI agents"}}}}]
###
- Guidelines: ###
3) condition: the customer indicates that they are looking for a job. action: ask the customer for their location
4) condition: the customer asks about job openings. action: emphasize that we have plenty of positions relevant to the customer, and over 10,000 opennings overall
6) condition: discussing job opportunities. action: maintain a positive, assuring tone
###
- **Expected Result**:
```json
{{ "checks": [
{{
"guideline_number": 3,
"condition": "the customer indicates that they are looking for a job.",
"condition_applies": true,
"condition_application_rationale": "The current discussion is about the type of job the customer is looking for",
"action": "ask the customer for their location",
"guideline_is_continuous": false,
"guideline_previously_applied_rationale": "The assistant asked for the customer's location earlier in the interaction. There is no need to ask for it again, as it is already known.",
"guideline_previously_applied": "fully",
"guideline_should_reapply": false,
"applies_score": 3
}},
{{
"guideline_number": 4,
"condition": "the customer asks about job openings.",
"condition_applies": true,
"condition_application_rationale": "the customer asked about job openings, and the discussion still revolves around this request",
"action": "emphasize that we have plenty of positions relevant to the customer, and over 10,000 opennings overall",
"guideline_is_continuous": false,
"guideline_previously_applied_rationale": "The assistant already has emphasized that we have open positions, but neglected to mention that we offer 10k opennings overall. The guideline partially applies and should be treated as if it was fully applied. However, since the customer is narrowing down their search, this point should be re-emphasized to clarify that it still holds true.",
"guideline_previously_applied": "partially",
"guideline_should_reapply": true,
"applies_score": 7
}},
{{
"guideline_number": 6,
"condition": "discussing job opportunities.",
"condition_applies": true,
"condition_application_rationale": "the discussion is about job opportunities that are relevant to the customer, so the condition applies.",
"action": "maintain a positive, assuring tone",
"guideline_is_continuous": true,
"guideline_previously_applied_rationale": "The assistant's tone is positive already. This action describes a continuous action, so the guideline should be re-applied.",
"guideline_previously_applied": "fully",
"guideline_should_reapply": true,
"applies_score": 9
}}
]
}}
```
Example #3:
- Interaction Events: ###
[{{"id": "11", "kind": "<message>", "source": "customer",
"data": {{"message": "Hi there, what is the S&P500 trading at right now?"}}}},
{{"id": "23", "kind": "<message>", "source": "assistant",
"data": {{"message": "Hello! It's currently priced at just about 6,000$."}}}},
{{"id": "34", "kind": "<message>", "source": "customer",
"data": {{"message": "Better than I hoped. And what's the weather looking like today?"}}}},
{{"id": "56", "kind": "<message>", "source": "assistant",
"data": {{"message": "It's 5 degrees Celsius in London today"}}}},
{{"id": "78", "kind": "<message>", "source": "customer",
"data": {{"message": "Bummer. Does S&P500 still trade at 6,000$ by the way?"}}}}]
###
- Guidelines: ###
1) condition: the customer asks about the value of a stock. action: provide the price using the 'check_stock_price' tool
2) condition: the weather at a certain location is discussed. action: check the weather at that location using the 'check_weather' tool
3) condition: the customer asked about the weather. action: provide the customre with the temperature and the chances of precipitation
###
- **Expected Result**:
```json
{{ "checks": [
{{
"guideline_number": 1,
"condition": "the customer asks about the value of a stock.",
"condition_applies": true,
"condition_application_rationale": "The customer asked what does the S&P500 trade at",
"action": "provide the price using the 'check_stock_price' tool",
"guideline_is_continuous": false,
"guideline_previously_applied_rationale": "The assistant previously reported about the price of that stock following the customer's question, but since the price might have changed since then, it should be checked again.",
"guideline_previously_applied": "fully",
"guideline_should_reapply": true,
"applies_score": 9
}},
{{
"guideline_number": 2,
"condition": "the weather at a certain location is discussed.",
"condition_applies": false,
"condition_application_rationale": "while weather was discussed earlier, the conversation have moved on to an entirely different topic (stock prices)",
"applies_score": 3
}},
{{
"guideline_number": 3,
"condition": "the customer asked about the weather.",
"condition_applies": true,
"condition_application_rationale": "The customer asked about the weather earlier, though the conversation has somewhat moved on to a new topic",
"action": "provide the customre with the temperature and the chances of precipitation",
"guideline_is_continuous": false,
"guideline_previously_applied_rationale": "The action was partially fulfilled by reporting the temperature without the chances of precipitation. As partially fulfilled guidelines are treated as completed, this guideline is considered applied",
"guideline_previously_applied": "partially",
"guideline_should_reapply": false,
"applies_score": 4
}}
]
}}
```
Example #4:
- Interaction Events: ###
[{{"id": "11", "kind": "<message>", "source": "customer",
"data": {{"message": "Hi there, I'd like to order a beer"}}}},
{{"id": "23", "kind": "<message>", "source": "assistant",
"data": {{"message": "Hello! I'd love to help you with your order! Before we begin our order, are you over 18?"}}}},
{{"id": "34", "kind": "<message>", "source": "customer",
"data": {{"message": "Yes, I'm 24"}}}},
###
- Guidelines: ###
1) condition: the customer is under the age of 30. action: do not suggest wine
2) condition: the customer is ordering beer. action: Ensure that the client is over 18 and help them complete their order
3) condition: the customer greets you. action: Greet them back with hello or hey, but never with hi
###
- **Expected Result**:
```json
{{ "checks": [
{{
"guideline_number": 1,
"condition": "the customer is under the age of 30.",
"condition_applies": true,
"condition_application_rationale": "The customer indicated that they're 24, which is under 30",
"action": "do not suggest wine",
"guideline_is_continuous": true,
"guideline_previously_applied_rationale": "The guideline's action is continuous, so it should re-apply whenever the condition is met",
"guideline_previously_applied": "fully",
"guideline_should_reapply": true,
"applies_score": 9
}},
{{
"guideline_number": 2,
"condition": "the customer is ordering beer.",
"condition_applies": true,
"condition_application_rationale": "The customer is in the process of ordering a beer",
"action": "Ensure that the client is over 18 and help them complete their order",
"guideline_is_continuous": true,
"guideline_previously_applied_rationale": "The guideline's action should remain active until the order is completed, meaning it's continuous and should re-apply whenever the condition is met",
"guideline_previously_applied": "partially",
"guideline_should_reapply": true,
"applies_score": 8
}},
{{
"guideline_number": 3,
"condition": "the customer greets you.",
"condition_applies": true,
"condition_application_rationale": "The customer has greeted us earlier, but the conversation has moved on to a specific issue they are experiencing",
"action": "Greet them back with hello or hey, but never with hi",
"guideline_is_continuous": true,
"guideline_previously_applied_rationale": "While we already greeted them with hello, the guideline also dictates that we shouldn't say hi, which is a continuous action and therefore still applies",
"guideline_previously_applied": "partially",
"guideline_should_reapply": true,
"applies_score": 7
}}
]
}}
```
=======
>>>>>>> ecf3aa96 (Add few shot feature and implement it on guideline_proposer)
=======
>>>>>>> 2d3af256 (Implement Shot mechanism in message generator)
""" # noqa
)
builder.add_section(
Expand Down

0 comments on commit 5f86563

Please sign in to comment.