File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
python-recipes/context-engineering/notebooks/section-4-optimizations Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change 363363 " # Load and use the view\n " ,
364364 " print(\"\\ nUsing the catalog view in an agent...\\ n\" )\n " ,
365365 " \n " ,
366- " catalog_view = redis_client.get(\" course_catalog_view\" ).decode('utf-8') \n " ,
366+ " catalog_view = redis_client.get(\" course_catalog_view\" ) or \"\" \n" ,
367367 " \n " ,
368368 " system_prompt = f\"\"\" You are a class scheduling agent for Redis University.\n " ,
369369 " \n " ,
592592 " # Load and use the profile\n " ,
593593 " print(\"\\ nUsing the profile view in an agent...\\ n\" )\n " ,
594594 " \n " ,
595- " profile_json = json.loads(redis_client.get(f\" user_profile:{user_data['student_id']}\" ).decode('utf-8'))\n " ,
595+ " profile_data = redis_client.get(f\" user_profile:{user_data['student_id']}\" )\n " ,
596+ " profile_json = json.loads(profile_data) if profile_data else {}\n " ,
596597 " profile_text = profile_json['profile_text']\n " ,
597598 " \n " ,
598599 " system_prompt = f\"\"\" You are a class scheduling agent for Redis University.\n " ,
You can’t perform that action at this time.
0 commit comments