244 lines
13 KiB
Plaintext
244 lines
13 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 1,
|
|
"id": "2339ceca-9dc4-4b58-b2fb-b4a22c844d3a",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"with open(\"spanish_customer_email.txt\", \"rb\") as f:\n",
|
|
" spanish_email = f.read()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 2,
|
|
"id": "e805e323-0f40-40c0-bba4-f4d66cd45305",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"spanish_email = str(spanish_email)[1:]"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 3,
|
|
"id": "5aa9a20e-d68b-475a-a206-31370a2dfcc8",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"\"'Asunto: Reporte de Problemas T\\\\xe9cnicos - Funcionalidad del Panel SAAS\\\\r\\\\n\\\\r\\\\nEstimado Equipo de Soporte al Cliente,\\\\r\\\\n\\\\r\\\\nEspero que este mensaje les encuentre bien. Les escribo para informarles sobre un problema t\\\\xe9cnico que he encontrado mientras utilizo su producto de panel SAAS. Como cliente leal, aprecio el valor que su producto aporta a mi negocio, pero actualmente me enfrento a un desaf\\\\xedo que requiere su experiencia.\\\\r\\\\n\\\\r\\\\nMe gustar\\\\xeda describir detalladamente el problema que estoy experimentando:\\\\r\\\\n\\\\r\\\\n1. Problema Gr\\\\xe1fico: Al iniciar sesi\\\\xf3n en el panel SAAS, he notado que los gr\\\\xe1ficos y las tablas en la p\\\\xe1gina principal del panel no se renderizan correctamente. Los puntos de datos aparecen distorsionados y algunos elementos se superponen, lo que dificulta la interpretaci\\\\xf3n precisa de la informaci\\\\xf3n.\\\\r\\\\n\\\\r\\\\n2. Fallo en la Funci\\\\xf3n de Exportaci\\\\xf3n: Adem\\\\xe1s, no he podido exportar informes y datos desde el panel. Cada vez que intento exportar un informe en formato CSV o PDF, recibo un mensaje de error que indica que la exportaci\\\\xf3n ha fallado. Esta funcionalidad es crucial para compartir informaci\\\\xf3n con mi equipo y partes interesadas externas, por lo que es imperativo que se resuelva r\\\\xe1pidamente.\\\\r\\\\n\\\\r\\\\n3. Lentitud en la Carga: Durante la \\\\xfaltima semana, he notado una disminuci\\\\xf3n significativa en la velocidad de carga del panel SAAS. Las p\\\\xe1ginas tardan un tiempo inusualmente largo en cargarse, lo que afecta mi productividad y genera frustraci\\\\xf3n. Tengo una conexi\\\\xf3n a internet confiable, por lo que creo que el problema radica en el panel mismo.\\\\r\\\\n\\\\r\\\\nYa he realizado los siguientes pasos para solucionar el problema:\\\\r\\\\n\\\\r\\\\n1. Limpieza de Cache: Limpi\\\\xe9 la memoria cach\\\\xe9 y las cookies de mi navegador para asegurarme de que los datos desactualizados no est\\\\xe9n causando conflictos. Sin embargo, los problemas persisten incluso despu\\\\xe9s de realizar esta acci\\\\xf3n.\\\\r\\\\n\\\\r\\\\n2. Varios Navegadores: Prob\\\\xe9 el panel SAAS en diferentes navegadores web (Chrome, Firefox y Safari) para determinar si el problema era espec\\\\xedfico del navegador. Desafortunadamente, los problemas gr\\\\xe1ficos, los fallos en la exportaci\\\\xf3n y la lentitud en la carga persistieron en todos los navegadores.\\\\r\\\\n\\\\r\\\\nLes solicito amablemente su ayuda para resolver estos problemas, ya que est\\\\xe1n obstaculizando mi capacidad de aprovechar todo el potencial de su panel SAAS. Aqu\\\\xed est\\\\xe1n las acciones espec\\\\xedficas que agradecer\\\\xeda:\\\\r\\\\n\\\\r\\\\n1. Soluci\\\\xf3n para Problemas Gr\\\\xe1ficos: Por favor, investiguen y corrijan los problemas gr\\\\xe1ficos presentes en la p\\\\xe1gina principal del panel para garantizar una visualizaci\\\\xf3n precisa de los datos.\\\\r\\\\n\\\\r\\\\n2. Soluci\\\\xf3n para la Funci\\\\xf3n de Exportaci\\\\xf3n: Identifiquen y solucionen el problema con la exportaci\\\\xf3n de informes en formatos CSV y PDF, permiti\\\\xe9ndome compartir datos con mi equipo y partes interesadas de manera fluida.\\\\r\\\\n\\\\r\\\\n3. Optimizaci\\\\xf3n del Rendimiento: Por favor, aborden la lentitud en la carga del panel SAAS para mejorar la experiencia general del usuario y aumentar la productividad.\\\\r\\\\n\\\\r\\\\nEntiendo que los problemas t\\\\xe9cnicos pueden surgir de vez en cuando y aprecio su pronta atenci\\\\xf3n a este asunto. Si requieren informaci\\\\xf3n adicional o ayuda de mi parte, no duden en contactarme. Espero su pronta respuesta y una pronta resoluci\\\\xf3n a estos desaf\\\\xedos.\\\\r\\\\n\\\\r\\\\nGracias por su comprensi\\\\xf3n y apoyo.\\\\r\\\\n\\\\r\\\\nAtentamente,\\\\r\\\\n\\\\r\\\\nMar\\\\xeda Rodr\\\\xedguez\\\\r\\\\nID de Cliente: 123456789\\\\r\\\\nInformaci\\\\xf3n de la Cuenta: Empresa Ejemplo S.A.'\""
|
|
]
|
|
},
|
|
"execution_count": 3,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"spanish_email"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 4,
|
|
"id": "76967ac7-249b-47d9-95d7-5259f371ce03",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"from langchain.chat_models import ChatOpenAI\n",
|
|
"from langchain.prompts import ChatPromptTemplate\n",
|
|
"from langchain.chains import LLMChain, SequentialChain"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 5,
|
|
"id": "aa084662-32d3-4621-9bb7-f832fabef6fa",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"def translate_and_summarize(email):\n",
|
|
" \"\"\"\n",
|
|
" Translates and email written in a detected language to English to generate a summary.\n",
|
|
"\n",
|
|
" Args:\n",
|
|
" email (str): The email to be processed and translated.\n",
|
|
"\n",
|
|
" Returns:\n",
|
|
" dict: A dictionary containing the following keys:\n",
|
|
" - \"language\": The language the email was written in.\n",
|
|
" - \"translated_email\": The translated version of the email in English.\n",
|
|
" - \"summary\": A short summary of the translated email.\n",
|
|
"\n",
|
|
" Raises:\n",
|
|
" Exception: If any error occurs during the LLM chain execution.\n",
|
|
" \"\"\"\n",
|
|
" llm = ChatOpenAI()\n",
|
|
"\n",
|
|
" template1 = \"Return the language of this email is written in:\\n{email}\\nOnly return the language it was written in.\"\n",
|
|
" prompt1 = ChatPromptTemplate.from_template(template1)\n",
|
|
" chain1 = LLMChain(llm=llm, prompt=prompt1, output_key=\"language\")\n",
|
|
"\n",
|
|
" template2 = \"Translate this email from {language} to English:\\n{email}\"\n",
|
|
" prompt2 = ChatPromptTemplate.from_template(template2)\n",
|
|
" chain2 = LLMChain(llm=llm, prompt=prompt2, output_key=\"translated_email\")\n",
|
|
"\n",
|
|
" template3 = \"Create a short summary of this email:\\n{translated_email}\"\n",
|
|
" prompt3 = ChatPromptTemplate.from_template(template3)\n",
|
|
" chain3 = LLMChain(llm=llm, prompt=prompt3, output_key=\"summary\")\n",
|
|
"\n",
|
|
" sequential_chain = SequentialChain(chains=[chain1, chain2, chain3],\n",
|
|
" input_variables=[\"email\"],\n",
|
|
" output_variables=[\"language\", \"translated_email\", \"summary\"],\n",
|
|
" verbose=True)\n",
|
|
" return sequential_chain(email)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 6,
|
|
"id": "f7195f74-1006-4670-854f-21984a56db56",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"\n",
|
|
"\n",
|
|
"\u001b[1m> Entering new SequentialChain chain...\u001b[0m\n",
|
|
"\n",
|
|
"\u001b[1m> Finished chain.\u001b[0m\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"result = translate_and_summarize(spanish_email)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 9,
|
|
"id": "961f278f-21f9-478c-8ba5-7db5c4ee7712",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"The language of this email is Spanish.\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"print(result[\"language\"])"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 10,
|
|
"id": "fe229816-32df-4ee4-ac4e-df72f98fe67b",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"Subject: Technical Issues Report - SAAS Panel Functionality\n",
|
|
"\n",
|
|
"Dear Customer Support Team,\n",
|
|
"\n",
|
|
"I hope this message finds you well. I am writing to inform you about a technical issue I have encountered while using your SAAS panel product. As a loyal customer, I appreciate the value your product brings to my business, but I am currently facing a challenge that requires your expertise.\n",
|
|
"\n",
|
|
"I would like to describe in detail the problem I am experiencing:\n",
|
|
"\n",
|
|
"1. Graphic Issue: When logging into the SAAS panel, I have noticed that the graphics and tables on the main panel page are not rendering correctly. The data points appear distorted and some elements overlap, making it difficult to accurately interpret the information.\n",
|
|
"\n",
|
|
"2. Export Function Failure: Additionally, I have been unable to export reports and data from the panel. Every time I try to export a report in CSV or PDF format, I receive an error message indicating that the export has failed. This functionality is crucial for sharing information with my team and external stakeholders, so it is imperative that it is resolved quickly.\n",
|
|
"\n",
|
|
"3. Slow Loading: Over the past week, I have noticed a significant decrease in the loading speed of the SAAS panel. Pages take an unusually long time to load, which affects my productivity and causes frustration. I have a reliable internet connection, so I believe the issue lies within the panel itself.\n",
|
|
"\n",
|
|
"I have already taken the following steps to troubleshoot the problem:\n",
|
|
"\n",
|
|
"1. Cache Cleaning: I cleared my browser's cache memory and cookies to ensure that outdated data is not causing conflicts. However, the issues persist even after taking this action.\n",
|
|
"\n",
|
|
"2. Multiple Browsers: I tried the SAAS panel on different web browsers (Chrome, Firefox, and Safari) to determine if the problem was browser-specific. Unfortunately, the graphic issues, export failures, and slow loading persisted on all browsers.\n",
|
|
"\n",
|
|
"I kindly request your assistance in resolving these issues as they are hindering my ability to fully leverage the potential of your SAAS panel. Here are the specific actions I would appreciate:\n",
|
|
"\n",
|
|
"1. Graphic Issues Solution: Please investigate and correct the graphic issues present on the main panel page to ensure accurate data visualization.\n",
|
|
"\n",
|
|
"2. Export Function Solution: Identify and resolve the problem with exporting reports in CSV and PDF formats, allowing me to smoothly share data with my team and stakeholders.\n",
|
|
"\n",
|
|
"3. Performance Optimization: Please address the slow loading of the SAAS panel to improve the overall user experience and increase productivity.\n",
|
|
"\n",
|
|
"I understand that technical issues can arise from time to time, and I appreciate your prompt attention to this matter. If you require additional information or assistance from me, please do not hesitate to contact me. I look forward to your prompt response and a swift resolution to these challenges.\n",
|
|
"\n",
|
|
"Thank you for your understanding and support.\n",
|
|
"\n",
|
|
"Sincerely,\n",
|
|
"\n",
|
|
"Maria Rodriguez\n",
|
|
"Customer ID: 123456789\n",
|
|
"Account Information: Example Company S.A.\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"print(result[\"translated_email\"])"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 11,
|
|
"id": "114f7cf5-3ee0-417c-9357-c0a442fec07d",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"The email is from a customer named Maria Rodriguez who is experiencing technical issues with a SAAS panel product. She describes the problems she is facing, including graphic issues, export function failure, and slow loading. Maria has already taken some troubleshooting steps but the issues persist. She requests assistance in resolving these issues and outlines specific actions she would appreciate, including correcting the graphic issues, resolving the export function problem, and optimizing the performance of the SAAS panel. Maria acknowledges that technical issues can happen and appreciates prompt attention to the matter. She provides her customer ID and account information for reference.\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"print(result[\"summary\"])"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "e617a638-915d-4958-8c86-34efe9eaf85c",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": []
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "Python 3 (ipykernel)",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.11.4"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 5
|
|
}
|