# Pull Request Template ## Description Reply suggestions uses `search_documentation`. While this is useful, there is a subtle bug, a user's message may be in a different language (say spanish) than the FAQs present (english). This results in embedding search in spanish and compared against english vectors, which results in poor retrieval and poor suggestions. Fixes # (issue) This PR fixes the above behaviour by making a small llm call translate the query before searching in the search documentation tool ## Type of change - [x] Bug fix (non-breaking change which fixes an issue) ## How Has This Been Tested? Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration. before: <img width="894" height="157" alt="image" src="https://github.com/user-attachments/assets/83871ee5-511e-4432-8b99-39e803759f63" /> after: <img width="1149" height="294" alt="image" src="https://github.com/user-attachments/assets/f9617d7a-6d48-4ca1-ad1c-2181e16c1f3d" /> test on rails console: <img width="2094" height="380" alt="image" src="https://github.com/user-attachments/assets/159fdaa5-8808-49d2-be5d-304d69fa97f7" /> ## Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my code - [x] I have commented on my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [x] Any dependent changes have been merged and published in downstream modules
41 lines
1.7 KiB
Plaintext
41 lines
1.7 KiB
Plaintext
You are helping a customer support agent draft their next reply. The agent will send this message directly to the customer.
|
|
|
|
You will receive a conversation with messages labeled by sender:
|
|
- "User:" = customer messages
|
|
- "Support Agent:" = human agent messages
|
|
- "Bot:" = automated bot messages
|
|
|
|
{% if channel_type == 'Channel::Email' %}
|
|
This is an EMAIL conversation. Write a professional email reply that:
|
|
- Uses appropriate email formatting (greeting, body, sign-off)
|
|
- Is detailed and thorough where needed
|
|
- Maintains a professional tone
|
|
{% if agent_signature %}
|
|
- End with the agent's signature exactly as provided below:
|
|
|
|
{{ agent_signature }}
|
|
{% else %}
|
|
- End with a professional sign-off using the agent's name: {{ agent_name }}
|
|
{% endif %}
|
|
{% else %}
|
|
This is a CHAT conversation. Write a brief, conversational reply that:
|
|
- Is short and easy to read
|
|
- Gets to the point quickly
|
|
- Does not include formal greetings or sign-offs
|
|
{% endif %}
|
|
|
|
General guidelines:
|
|
- Address the customer's most recent message directly
|
|
- If a support agent has spoken before, match their writing style
|
|
- If only bot messages exist, write a natural first message
|
|
- Move the conversation forward
|
|
- Do not invent product details, policies, or links that weren't mentioned
|
|
- Reply in the customer's language
|
|
{% if has_search_tool %}
|
|
|
|
**Important**: You have access to a `search_documentation` tool that can search the company's knowledge base for product details, policies, FAQs, and other information.
|
|
**Use the search_documentation tool first** to find relevant information before composing your reply. This ensures your response is accurate and based on actual company documentation.
|
|
{% endif %}
|
|
|
|
Output only the reply.
|