Spaces:
Running
Running
create knowledgegraph
Browse files- KnowledgeGraph.ipynb +296 -0
KnowledgeGraph.ipynb
ADDED
@@ -0,0 +1,296 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [
|
3 |
+
{
|
4 |
+
"cell_type": "code",
|
5 |
+
"execution_count": null,
|
6 |
+
"id": "b191af1d",
|
7 |
+
"metadata": {},
|
8 |
+
"outputs": [],
|
9 |
+
"source": [
|
10 |
+
"import os\n",
|
11 |
+
"from dotenv import load_dotenv\n",
|
12 |
+
"load_dotenv()\n",
|
13 |
+
"# Set your API key for GroQ LLM (replace with actual key)\n",
|
14 |
+
"GROQ_API_KEY = os.getenv('GROQ_API_KEY')\n",
|
15 |
+
"\n",
|
16 |
+
"NEO4J_URI = os.getenv('NEO4J_URI')\n",
|
17 |
+
"NEO4J_USERNAME = os.getenv('NEO4J_USERNAME')\n",
|
18 |
+
"NEO4J_PASSWORD = os.getenv('NEO4J_PASSWORD')\n"
|
19 |
+
]
|
20 |
+
},
|
21 |
+
{
|
22 |
+
"cell_type": "code",
|
23 |
+
"execution_count": 4,
|
24 |
+
"id": "3ac71ed4",
|
25 |
+
"metadata": {},
|
26 |
+
"outputs": [
|
27 |
+
{
|
28 |
+
"name": "stderr",
|
29 |
+
"output_type": "stream",
|
30 |
+
"text": [
|
31 |
+
"/workspaces/codespaces-blank/TroubleGraph/.venv/lib/python3.12/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
|
32 |
+
" from .autonotebook import tqdm as notebook_tqdm\n",
|
33 |
+
"Generating train split: 100%|██████████| 1112/1112 [00:00<00:00, 33334.76 examples/s]\n",
|
34 |
+
"Generating test split: 100%|██████████| 278/278 [00:00<00:00, 60635.28 examples/s]\n"
|
35 |
+
]
|
36 |
+
},
|
37 |
+
{
|
38 |
+
"data": {
|
39 |
+
"text/plain": [
|
40 |
+
"{'body': 'Hello Customer Support,\\n\\nI am writing to express concern about my HP DeskJet 3755 printer, which is malfunctioning. It encounters errors when printing wirelessly, affecting all connected devices in my home network. This has significantly disrupted my ability to manage daily tasks. Could you please assist in diagnosing and resolving this issue? Any help would be appreciated. \\n\\nBest regards,\\n\\n<name> <acc_num>\\n<tel_num>',\n",
|
41 |
+
" 'answer': 'Subject: Re: Issues with HP DeskJet 3755 Printer\\n\\nHello <name>,\\n\\nThank you for reaching out regarding your HP DeskJet 3755 printer issue. To address the wireless printing problem, please try the following steps:\\n\\n1. Restart your printer and router to refresh the network connection.\\n2. Ensure your printer’s firmware is up to date via the manufacturer’s website.\\n3. Confirm that all devices are connected to the same network.\\n4. Reinstall the printer drivers on your devices.\\n\\nIf the problem persists, please let us know so we can further assist you. \\n\\nBest regards,\\nCustomer Support',\n",
|
42 |
+
" 'type': 'Incident',\n",
|
43 |
+
" 'queue': 'Product Support'}"
|
44 |
+
]
|
45 |
+
},
|
46 |
+
"execution_count": 4,
|
47 |
+
"metadata": {},
|
48 |
+
"output_type": "execute_result"
|
49 |
+
}
|
50 |
+
],
|
51 |
+
"source": [
|
52 |
+
"from datasets import load_dataset\n",
|
53 |
+
"\n",
|
54 |
+
"# Replace with the actual dataset identifier on Hugging Face\n",
|
55 |
+
"dataset = load_dataset(\"Talhat/Customer_IT_Support\")\n",
|
56 |
+
"\n",
|
57 |
+
"# View the first few rows of the dataset\n",
|
58 |
+
"dataset[\"train\"][0]"
|
59 |
+
]
|
60 |
+
},
|
61 |
+
{
|
62 |
+
"cell_type": "code",
|
63 |
+
"execution_count": 5,
|
64 |
+
"id": "c93d0904",
|
65 |
+
"metadata": {},
|
66 |
+
"outputs": [],
|
67 |
+
"source": [
|
68 |
+
"from langchain_core.prompts import ChatPromptTemplate\n",
|
69 |
+
"\n",
|
70 |
+
"prompt = ChatPromptTemplate.from_template(\"\"\"\n",
|
71 |
+
"You are a knowledge graph builder.\n",
|
72 |
+
"\n",
|
73 |
+
"Extract **structured triples** (subject, relationship, object) from the input text.\n",
|
74 |
+
"\n",
|
75 |
+
"Your goal is to build a knowledge graph that connects:\n",
|
76 |
+
"- **Products or Services** to the **issues** they have.\n",
|
77 |
+
"- **Issues** to **all the solutions** that address them.\n",
|
78 |
+
"\n",
|
79 |
+
"### Instructions:\n",
|
80 |
+
"- Extract multi-word product or service names as nodes.\n",
|
81 |
+
"- Extract detailed issue descriptions as nodes (not just keywords).\n",
|
82 |
+
"- Extract **all full solution steps** mentioned — including **alternative fixes, workarounds, and sequential steps**.\n",
|
83 |
+
"- Use the relationship `has_issue` between a product/service and an issue.\n",
|
84 |
+
"- Use the relationship `has_solution` between an issue and **each individual solution**.\n",
|
85 |
+
"- Include technical details like OS, version numbers, error codes, hardware components, or setting names if available.\n",
|
86 |
+
"- Use complete phrases or full sentences for clarity.\n",
|
87 |
+
"- Each solution should be output as a separate triple.\n",
|
88 |
+
"- **Do NOT include any markup characters like < >, [ ], or XML/HTML tags** in your output. Use plain text only.\n",
|
89 |
+
"\n",
|
90 |
+
"### Input Text:\n",
|
91 |
+
"{input}\n",
|
92 |
+
"\n",
|
93 |
+
"### Output Triples (format: subject, relation, object):\n",
|
94 |
+
"\"\"\")\n"
|
95 |
+
]
|
96 |
+
},
|
97 |
+
{
|
98 |
+
"cell_type": "code",
|
99 |
+
"execution_count": 7,
|
100 |
+
"id": "f5dd421b",
|
101 |
+
"metadata": {},
|
102 |
+
"outputs": [
|
103 |
+
{
|
104 |
+
"name": "stderr",
|
105 |
+
"output_type": "stream",
|
106 |
+
"text": [
|
107 |
+
"/tmp/ipykernel_3938/1867942914.py:9: LangChainDeprecationWarning: The class `Neo4jGraph` was deprecated in LangChain 0.3.8 and will be removed in 1.0. An updated version of the class exists in the :class:`~langchain-neo4j package and should be used instead. To use it run `pip install -U :class:`~langchain-neo4j` and import as `from :class:`~langchain_neo4j import Neo4jGraph``.\n",
|
108 |
+
" graph = Neo4jGraph()\n"
|
109 |
+
]
|
110 |
+
}
|
111 |
+
],
|
112 |
+
"source": [
|
113 |
+
"from langchain_experimental.graph_transformers import LLMGraphTransformer\n",
|
114 |
+
"from langchain_groq import ChatGroq\n",
|
115 |
+
"from langchain_community.graphs import Neo4jGraph\n",
|
116 |
+
"# Initialize GroQ LLM (assuming GroQ is supported with LangChain interface)\n",
|
117 |
+
"groq_llm = ChatGroq(temperature=0.7, model_name=\"meta-llama/llama-4-scout-17b-16e-instruct\", api_key=GROQ_API_KEY,max_retries=10)\n",
|
118 |
+
"# Initialize the Graph Transformer\n",
|
119 |
+
"llm_transformer = LLMGraphTransformer(llm=groq_llm,allowed_nodes=['product','service','Issue','solution'], prompt=prompt,allowed_relationships=['has_issue','has_solution'])\n",
|
120 |
+
"\n",
|
121 |
+
"graph = Neo4jGraph()"
|
122 |
+
]
|
123 |
+
},
|
124 |
+
{
|
125 |
+
"cell_type": "code",
|
126 |
+
"execution_count": null,
|
127 |
+
"id": "b2082dc1",
|
128 |
+
"metadata": {},
|
129 |
+
"outputs": [],
|
130 |
+
"source": [
|
131 |
+
"from langchain_core.documents import Document\n",
|
132 |
+
"\n",
|
133 |
+
"# Convert dataset responses into LangChain documents\n",
|
134 |
+
"\n",
|
135 |
+
"documents = [Document(page_content=row['body']+\"\\n\"+row['answer']) for row in dataset['train']]\n",
|
136 |
+
"text=dataset['train'][3]['body']+\"\\n\"+dataset['train'][3]['answer']\n",
|
137 |
+
"documents=[Document(page_content=text)]\n",
|
138 |
+
"graph_documents = llm_transformer.convert_to_graph_documents(documents)\n",
|
139 |
+
"\n",
|
140 |
+
"# Inspect the generated graph data\n",
|
141 |
+
"for i, doc in enumerate(graph_documents[:3]): # Print first 3 examples\n",
|
142 |
+
" print(f\"Document {i+1} - Nodes: {doc.nodes}\")\n",
|
143 |
+
" print(f\"Document {i+1} - Relationships: {doc.relationships}\")\n",
|
144 |
+
"\n",
|
145 |
+
"# Store the graph data in Neo4j\n",
|
146 |
+
"graph.add_documents(graph_documents)"
|
147 |
+
]
|
148 |
+
},
|
149 |
+
{
|
150 |
+
"cell_type": "code",
|
151 |
+
"execution_count": null,
|
152 |
+
"id": "4f379a89",
|
153 |
+
"metadata": {},
|
154 |
+
"outputs": [],
|
155 |
+
"source": [
|
156 |
+
"for i in range(10,100):\n",
|
157 |
+
" text=dataset['train'][i]['body']+\"\\n\"+dataset['train'][i]['answer']\n",
|
158 |
+
" documents=[Document(page_content=text)]\n",
|
159 |
+
" graph_documents = llm_transformer.convert_to_graph_documents(documents)\n",
|
160 |
+
" graph.add_graph_documents(graph_documents)"
|
161 |
+
]
|
162 |
+
},
|
163 |
+
{
|
164 |
+
"cell_type": "code",
|
165 |
+
"execution_count": 8,
|
166 |
+
"id": "a48bcc36",
|
167 |
+
"metadata": {},
|
168 |
+
"outputs": [],
|
169 |
+
"source": [
|
170 |
+
"from langchain.prompts import PromptTemplate\n",
|
171 |
+
"\n",
|
172 |
+
"CYPHER_GENERATION_TEMPLATE = \"\"\"Task: Generate a Cypher query to perform **multihop reasoning** in a graph database.\n",
|
173 |
+
"Instructions:\n",
|
174 |
+
"- Use only the provided relationship types and properties in the schema.\n",
|
175 |
+
"- The query should traverse **multiple hops** between nodes.\n",
|
176 |
+
"- Start from a specific entity (e.g., Product or Service), then navigate through related entities (e.g., Issues, Causes, Solutions).\n",
|
177 |
+
"- Ensure the query spans at least two or more relationships to extract connected information.\n",
|
178 |
+
"- Do not use any relationship types or properties that are not provided in the schema.\n",
|
179 |
+
"\n",
|
180 |
+
"Schema:\n",
|
181 |
+
"{schema}\n",
|
182 |
+
"\n",
|
183 |
+
"Note:\n",
|
184 |
+
"- Do not include any explanations or apologies in your responses.\n",
|
185 |
+
"- Do not respond to any questions except for constructing a Cypher statement.\n",
|
186 |
+
"- Do not include any text except the generated Cypher statement.\n",
|
187 |
+
"\n",
|
188 |
+
"The question is:\n",
|
189 |
+
"{question}\"\"\"\n",
|
190 |
+
"\n",
|
191 |
+
"CYPHER_GENERATION_PROMPT = PromptTemplate(\n",
|
192 |
+
" input_variables=[\"schema\", \"question\"], template=CYPHER_GENERATION_TEMPLATE\n",
|
193 |
+
")\n",
|
194 |
+
"qa_prompt = ChatPromptTemplate.from_template(\"\"\"\n",
|
195 |
+
"You are a helpful support assistant using a knowledge graph of products, issues, and solutions.\n",
|
196 |
+
"\n",
|
197 |
+
"Based on the question and the extracted relationships from the graph, explain the issue and its solutions in a clear and helpful way.\n",
|
198 |
+
"\n",
|
199 |
+
"### Question:\n",
|
200 |
+
"{question}\n",
|
201 |
+
"\n",
|
202 |
+
"### Extracted Knowledge Graph Triples:\n",
|
203 |
+
"{context}\n",
|
204 |
+
"\n",
|
205 |
+
"### Guidelines:\n",
|
206 |
+
"- Rephrase technical triples into complete, helpful sentences.\n",
|
207 |
+
"- Explain each solution clearly, including steps or conditions.\n",
|
208 |
+
"- Include any relevant product/service names, error messages, version numbers, or technical details.\n",
|
209 |
+
"- Do not refer to nodes or relationships as \"triples\"; speak naturally.\n",
|
210 |
+
"\n",
|
211 |
+
"### Answer:\n",
|
212 |
+
"\"\"\")\n"
|
213 |
+
]
|
214 |
+
},
|
215 |
+
{
|
216 |
+
"cell_type": "code",
|
217 |
+
"execution_count": 9,
|
218 |
+
"id": "dace99ae",
|
219 |
+
"metadata": {},
|
220 |
+
"outputs": [],
|
221 |
+
"source": [
|
222 |
+
"from langchain_neo4j import GraphCypherQAChain\n",
|
223 |
+
"chain = GraphCypherQAChain.from_llm(\n",
|
224 |
+
" llm=groq_llm,\n",
|
225 |
+
" graph=graph,\n",
|
226 |
+
" verbose=True,\n",
|
227 |
+
" top_k=100,\n",
|
228 |
+
" cypher_prompt=CYPHER_GENERATION_PROMPT,\n",
|
229 |
+
" qa_prompt=qa_prompt,\n",
|
230 |
+
" allow_dangerous_requests=True,\n",
|
231 |
+
")"
|
232 |
+
]
|
233 |
+
},
|
234 |
+
{
|
235 |
+
"cell_type": "code",
|
236 |
+
"execution_count": 10,
|
237 |
+
"id": "4e9086bb",
|
238 |
+
"metadata": {},
|
239 |
+
"outputs": [
|
240 |
+
{
|
241 |
+
"name": "stdout",
|
242 |
+
"output_type": "stream",
|
243 |
+
"text": [
|
244 |
+
"\n",
|
245 |
+
"\n",
|
246 |
+
"\u001b[1m> Entering new GraphCypherQAChain chain...\u001b[0m\n",
|
247 |
+
"Generated Cypher:\n",
|
248 |
+
"\u001b[32;1m\u001b[1;3mcypher\n",
|
249 |
+
"MATCH p=(:Product {id: 'Macbook Air M1'})-[:HAS_ISSUE*1..2]-(issue:Issue)-[:HAS_SOLUTION*1..2]-(solution:Solution)\n",
|
250 |
+
"RETURN DISTINCT issue.id AS issueId, solution.id AS solutionId\n",
|
251 |
+
"\u001b[0m\n",
|
252 |
+
"Full Context:\n",
|
253 |
+
"\u001b[32;1m\u001b[1;3m[{'issueId': 'Charger Not Functioning', 'solutionId': 'Confirm That The Charger Is Securely Plugged In'}, {'issueId': 'Charger Not Functioning', 'solutionId': 'Utilize An Outlet That Is Known To Be Operational'}, {'issueId': 'Charger Not Functioning', 'solutionId': 'Inspect The Charging Port For Any Obstructions'}, {'issueId': 'Charger Not Functioning', 'solutionId': 'Perform A System Management Controller (Smc) Reset'}, {'issueId': 'Ram Sizes', 'solutionId': '8Gb Ram'}, {'issueId': 'Ram Sizes', 'solutionId': '16Gb Ram'}, {'issueId': 'Ssd Storage Capacities', 'solutionId': '256Gb Ssd'}, {'issueId': 'Ssd Storage Capacities', 'solutionId': '2Tb Ssd'}, {'issueId': 'Color Options', 'solutionId': 'Gold'}, {'issueId': 'Color Options', 'solutionId': 'Silver'}, {'issueId': 'Color Options', 'solutionId': 'Space Gray'}, {'issueId': 'Upgrades', 'solutionId': 'Upgrade Ram'}, {'issueId': 'Upgrades', 'solutionId': 'Upgrade Ssd'}, {'issueId': 'Promotions', 'solutionId': 'Discounts'}, {'issueId': 'Promotions', 'solutionId': 'Bundled Accessories'}, {'issueId': 'Screen Flickering Issue', 'solutionId': 'Visit Service Center'}, {'issueId': 'Screen Flickering Issue', 'solutionId': 'Perform A Complete Shutdown And Restart Of The Laptop'}, {'issueId': 'Screen Flickering Issue', 'solutionId': 'Ensure All System Updates Are Installed'}, {'issueId': 'Screen Flickering Issue', 'solutionId': 'Check If The Issue Persists In Safe Mode'}, {'issueId': 'Screen Flickering Issue', 'solutionId': 'Run Diagnostics By Pressing F12 During Startup To Identify Any Hardware Issues'}, {'issueId': 'Screen Flickering Issue', 'solutionId': 'Arrange For Repair Services'}, {'issueId': 'Screen Flickering Issue', 'solutionId': 'Adjusting The Screen Brightness'}, {'issueId': 'Screen Flickering Issue', 'solutionId': 'Restarting The Device'}, {'issueId': 'Screen Flickering Issue', 'solutionId': 'Ensure Macos Is Up To Date'}, {'issueId': 'Screen Flickering Issue', 'solutionId': 'Backing Up Data'}, {'issueId': 'Screen Flickering Issue', 'solutionId': 'Performing An Smc Reset'}, {'issueId': 'Screen Flickering Issue', 'solutionId': 'Sending Device To Service Center'}, {'issueId': 'Screen Flickering Issue', 'solutionId': \"Ensure Device'S Firmware Is Up-To-Date\"}, {'issueId': 'Screen Flickering Issue', 'solutionId': 'Perform A Hard Reset'}, {'issueId': 'Screen Flickering Issue', 'solutionId': 'Test Device In Safe Mode'}, {'issueId': 'Screen Flickering Issue', 'solutionId': 'Contact Support Team Directly'}, {'issueId': 'Non-Functional Battery', 'solutionId': 'Resetting The Smc'}, {'issueId': 'Non-Functional Battery', 'solutionId': 'Ensuring The Charging Adapter Is Functioning Properly'}, {'issueId': 'Non-Functional Battery', 'solutionId': 'Full Refund'}, {'issueId': 'Data Migration Issue', 'solutionId': 'Migration Assistant'}, {'issueId': 'Data Migration Issue', 'solutionId': 'Time Machine Backup'}, {'issueId': 'Faulty Keyboard', 'solutionId': 'Request An Exchange'}, {'issueId': 'Faulty Keyboard', 'solutionId': 'Contact Support Team'}, {'issueId': 'Faulty Keyboard', 'solutionId': 'Visit Nearest Store'}]\u001b[0m\n",
|
254 |
+
"\n",
|
255 |
+
"\u001b[1m> Finished chain.\u001b[0m\n"
|
256 |
+
]
|
257 |
+
},
|
258 |
+
{
|
259 |
+
"data": {
|
260 |
+
"text/plain": [
|
261 |
+
"{'query': 'what are the issues in Macbook Air M1 and solutions',\n",
|
262 |
+
" 'result': \"The MacBook Air M1 is a powerful and efficient laptop, but like any device, it's not immune to issues. Let's explore some common problems that users may encounter and their solutions.\\n\\n**Charger Not Functioning**\\n\\nIf your MacBook Air M1 charger is not functioning, try these steps:\\n\\n1. **Confirm that the charger is securely plugged in**: Ensure the charger is properly connected to both your MacBook Air and the power outlet.\\n2. **Utilize an outlet that is known to be operational**: Try plugging the charger into a different outlet to rule out any electrical issues.\\n3. **Inspect the charging port for any obstructions**: Check the charging port for dust, debris, or corrosion that may be preventing the charger from functioning properly.\\n4. **Perform a System Management Controller (SMC) reset**: Sometimes, a simple SMC reset can resolve charging issues. To do this, press the power button, the Command+Option+Shift+Power buttons, or the Power button and the Volume Down button, depending on your MacBook model.\\n\\n**Screen Flickering Issue**\\n\\nIf you're experiencing screen flickering on your MacBook Air M1, try these solutions:\\n\\n1. **Adjust the screen brightness**: Sometimes, adjusting the screen brightness can resolve flickering issues.\\n2. **Restart your device**: A simple reboot can often resolve screen flickering problems.\\n3. **Ensure macOS is up to date**: Make sure your MacBook Air is running the latest version of macOS.\\n4. **Perform an SMC reset**: An SMC reset can also help resolve screen flickering issues.\\n5. **Test your device in Safe Mode**: Restart your MacBook Air in Safe Mode to isolate the issue.\\n6. **Run diagnostics**: Press F12 during startup to run diagnostics and identify any hardware issues.\\n7. **Visit a service center**: If none of the above steps resolve the issue, visit an authorized Apple service center for further assistance.\\n\\n**Non-Functional Battery**\\n\\nIf your MacBook Air M1 battery is not functioning properly, try:\\n\\n1. **Resetting the SMC**: Resetting the SMC can sometimes resolve battery issues.\\n2. **Ensuring the charging adapter is functioning properly**: Check that the charging adapter is working correctly.\\n\\n**Data Migration Issue**\\n\\nIf you're experiencing issues migrating data to your MacBook Air M1, consider:\\n\\n1. **Using Migration Assistant**: Apple's Migration Assistant tool can help transfer data from your old Mac to your new one.\\n2. **Using Time Machine Backup**: Restore your data from a Time Machine backup.\\n\\n**Faulty Keyboard**\\n\\nIf your MacBook Air M1 keyboard is faulty, you can:\\n\\n1. **Contact the support team**: Reach out to Apple's support team for assistance.\\n2. **Request an exchange**: If the keyboard is faulty, you may be eligible for an exchange.\\n3. **Visit the nearest store**: Visit an Apple Store or authorized service provider for further assistance.\\n\\n**RAM Sizes and SSD Storage Capacities**\\n\\nThe MacBook Air M1 is available with:\\n\\n* **8GB or 16GB RAM**: Choose the RAM configuration that suits your needs.\\n* **256GB to 2TB SSD storage capacities**: Select the SSD storage capacity that fits your requirements.\\n\\n**Color Options**\\n\\nThe MacBook Air M1 is available in:\\n\\n* **Gold**\\n* **Silver**\\n* **Space Gray**\\n\\n**Upgrades and Promotions**\\n\\nYou can:\\n\\n* **Upgrade RAM**: Upgrade your MacBook Air M1 to a higher RAM configuration.\\n* **Upgrade SSD**: Upgrade your MacBook Air M1 to a larger SSD storage capacity.\\n* **Enjoy discounts and bundled accessories**: Look out for promotions and discounts on Apple's website or through authorized resellers.\"}"
|
263 |
+
]
|
264 |
+
},
|
265 |
+
"execution_count": 10,
|
266 |
+
"metadata": {},
|
267 |
+
"output_type": "execute_result"
|
268 |
+
}
|
269 |
+
],
|
270 |
+
"source": [
|
271 |
+
"chain.invoke({\"query\": \"what are the issues in Macbook Air M1 and solutions\"})"
|
272 |
+
]
|
273 |
+
}
|
274 |
+
],
|
275 |
+
"metadata": {
|
276 |
+
"kernelspec": {
|
277 |
+
"display_name": ".venv",
|
278 |
+
"language": "python",
|
279 |
+
"name": "python3"
|
280 |
+
},
|
281 |
+
"language_info": {
|
282 |
+
"codemirror_mode": {
|
283 |
+
"name": "ipython",
|
284 |
+
"version": 3
|
285 |
+
},
|
286 |
+
"file_extension": ".py",
|
287 |
+
"mimetype": "text/x-python",
|
288 |
+
"name": "python",
|
289 |
+
"nbconvert_exporter": "python",
|
290 |
+
"pygments_lexer": "ipython3",
|
291 |
+
"version": "3.12.1"
|
292 |
+
}
|
293 |
+
},
|
294 |
+
"nbformat": 4,
|
295 |
+
"nbformat_minor": 5
|
296 |
+
}
|