Skip to content

Commit

Permalink
Small tutorial adjustment
Browse files Browse the repository at this point in the history
  • Loading branch information
okhat committed Nov 24, 2024
1 parent f0efe45 commit bff476a
Showing 1 changed file with 0 additions and 272 deletions.
272 changes: 0 additions & 272 deletions docs/docs/tutorials/rag/index.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2305,278 +2305,6 @@
"loaded_rag(question=\"cmd+tab does not work on hidden or minimized windows\")"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"\n",
"\n",
"\n",
"\u001b[34m[2024-11-23T22:14:01.562290]\u001b[0m\n",
"\n",
"\u001b[31mSystem message:\u001b[0m\n",
"\n",
"Your input fields are:\n",
"1. `question` (str)\n",
"2. `ground_truth` (str)\n",
"3. `system_response` (str)\n",
"\n",
"Your output fields are:\n",
"1. `reasoning` (str)\n",
"2. `ground_truth_key_ideas` (str): enumeration of key ideas in the ground truth\n",
"3. `system_response_key_ideas` (str): enumeration of key ideas in the system response\n",
"4. `discussion` (str): discussion of the overlap between ground truth and system response\n",
"5. `recall` (float): fraction (out of 1.0) of ground truth covered by the system response\n",
"6. `precision` (float): fraction (out of 1.0) of system response covered by the ground truth\n",
"\n",
"All interactions will be structured in the following way, with the appropriate values filled in.\n",
"\n",
"[[ ## question ## ]]\n",
"{question}\n",
"\n",
"[[ ## ground_truth ## ]]\n",
"{ground_truth}\n",
"\n",
"[[ ## system_response ## ]]\n",
"{system_response}\n",
"\n",
"[[ ## reasoning ## ]]\n",
"{reasoning}\n",
"\n",
"[[ ## ground_truth_key_ideas ## ]]\n",
"{ground_truth_key_ideas}\n",
"\n",
"[[ ## system_response_key_ideas ## ]]\n",
"{system_response_key_ideas}\n",
"\n",
"[[ ## discussion ## ]]\n",
"{discussion}\n",
"\n",
"[[ ## recall ## ]]\n",
"{recall} # note: the value you produce must be a single float value\n",
"\n",
"[[ ## precision ## ]]\n",
"{precision} # note: the value you produce must be a single float value\n",
"\n",
"[[ ## completed ## ]]\n",
"\n",
"In adhering to this structure, your objective is: \n",
" Compare a system's response to the ground truth to compute recall and precision of key ideas.\n",
" You will first enumerate key ideas in each response, discuss their overlap, and then report recall and precision.\n",
"\n",
"\n",
"\u001b[31mUser message:\u001b[0m\n",
"\n",
"[[ ## question ## ]]\n",
"how to use pip after the os x el capitan upgrade?\n",
"\n",
"[[ ## ground_truth ## ]]\n",
"One quick solution is to install Python using homebrew into a directory such as `/usr/local/bin`, which allows for the use of pip and python regardless of the system provided version. \n",
"Additionally, opting to use `pip3 install` alongside the desired package name helps to solve permission problem. \n",
"A direct and secure approach without altering system settings is to install Python modules for the individual user using the `pip install --user` command followed by the module name. \n",
"An alternative method involves installing Python with homebrew and then obtaining pip through the `sudo easy_install pip` command. \n",
"Lastly, using virtual environments, specifically using virtualenv or virtualenvwrapper, creates an isolated environment for each project, permitting seamless pip usage for package management within these enclosed spaces.\n",
"\n",
"[[ ## system_response ## ]]\n",
"After upgrading to OS X El Capitan, you can use pip by following these steps:\n",
"\n",
"1. **Check Python Installation**: Ensure that you have the correct version of Python installed. You can check this by running `python --version` or `python3 --version` in the terminal.\n",
"\n",
"2. **Install pip**: If pip is not already installed, you can install it using the following command:\n",
" ```bash\n",
" sudo easy_install pip\n",
" ```\n",
" Alternatively, if you are using a specific version of Python installed via MacPorts, make sure to use the corresponding pip version, such as `py36-pip` for Python 3.6.\n",
"\n",
"3. **Verify pip Installation**: After installation, verify that pip is working by running:\n",
" ```bash\n",
" pip --version\n",
" ```\n",
"\n",
"4. **Using pip**: You can now use pip to install packages. For example, to install the `nltk` package, you would run:\n",
" ```bash\n",
" pip install nltk\n",
" ```\n",
"\n",
"5. **Managing Multiple Versions**: If you have multiple versions of Python installed (e.g., via MacPorts or Homebrew), ensure you are using the correct pip associated with the desired Python version. You can do this by using the `port select` command to set the active Python version.\n",
"\n",
"6. **Check PATH**: If you encounter issues with pip not being recognized, check your PATH settings. You may need to add the directory containing pip to your PATH by editing the `/etc/paths` file:\n",
" ```bash\n",
" sudo vim /etc/paths\n",
" ```\n",
" Add the path to the pip installation (e.g., `/usr/local/bin`) at the end of the file, save, and exit.\n",
"\n",
"By following these steps, you should be able to use pip effectively after your OS X El Capitan upgrade.\n",
"\n",
"Respond with the corresponding output fields, starting with the field `[[ ## reasoning ## ]]`, then `[[ ## ground_truth_key_ideas ## ]]`, then `[[ ## system_response_key_ideas ## ]]`, then `[[ ## discussion ## ]]`, then `[[ ## recall ## ]]` (must be formatted as a valid Python float), then `[[ ## precision ## ]]` (must be formatted as a valid Python float), and then ending with the marker for `[[ ## completed ## ]]`.\n",
"\n",
"\n",
"\u001b[31mResponse:\u001b[0m\n",
"\n",
"\u001b[32m[[ ## reasoning ## ]]\n",
"The system response provides a detailed guide on how to use pip after upgrading to OS X El Capitan, including checking the Python installation, installing pip, verifying the installation, and managing multiple versions of Python. The ground truth also covers similar points but emphasizes using Homebrew for Python installation, using `pip3`, and installing packages for the individual user. Both responses address the installation and usage of pip, but the ground truth includes additional methods and best practices for managing Python environments.\n",
"\n",
"[[ ## ground_truth_key_ideas ## ]]\n",
"1. Install Python using Homebrew into `/usr/local/bin`.\n",
"2. Use `pip3 install` to solve permission issues.\n",
"3. Install Python modules for the individual user with `pip install --user`.\n",
"4. Install pip using `sudo easy_install pip`.\n",
"5. Use virtual environments (virtualenv or virtualenvwrapper) for isolated package management.\n",
"\n",
"[[ ## system_response_key_ideas ## ]]\n",
"1. Check Python installation version.\n",
"2. Install pip using `sudo easy_install pip`.\n",
"3. Verify pip installation.\n",
"4. Use pip to install packages (e.g., `pip install nltk`).\n",
"5. Manage multiple Python versions and check PATH settings.\n",
"\n",
"[[ ## discussion ## ]]\n",
"There is a significant overlap between the ground truth and the system response regarding the installation and usage of pip. Both mention the installation of pip and the verification of its functionality. However, the ground truth provides additional methods for managing Python installations and permissions, such as using Homebrew and user-specific installations. The system response focuses more on the steps to ensure pip is set up correctly after the OS X upgrade, including managing multiple Python versions and checking PATH settings. Overall, while both responses cover the essential aspects of using pip, the ground truth offers a broader perspective on installation methods and user management.\n",
"\n",
"[[ ## recall ## ]]\n",
"0.5\n",
"\n",
"[[ ## precision ## ]]\n",
"0.5\n",
"\n",
"[[ ## completed ## ]]\u001b[0m\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\u001b[34m[2024-11-23T22:14:01.708696]\u001b[0m\n",
"\n",
"\u001b[31mSystem message:\u001b[0m\n",
"\n",
"Your input fields are:\n",
"1. `context` (str)\n",
"2. `question` (str)\n",
"\n",
"Your output fields are:\n",
"1. `reasoning` (str)\n",
"2. `response` (str)\n",
"\n",
"All interactions will be structured in the following way, with the appropriate values filled in.\n",
"\n",
"[[ ## context ## ]]\n",
"{context}\n",
"\n",
"[[ ## question ## ]]\n",
"{question}\n",
"\n",
"[[ ## reasoning ## ]]\n",
"{reasoning}\n",
"\n",
"[[ ## response ## ]]\n",
"{response}\n",
"\n",
"[[ ## completed ## ]]\n",
"\n",
"In adhering to this structure, your objective is: \n",
" Using the provided `context` which contains detailed information about transferring photos from an iPhone to a computer, and the `question` regarding how to transfer edited photos specifically, generate a comprehensive `response` that outlines the necessary steps or methods to effectively transfer the edited photos. Ensure to highlight any limitations of direct import methods and suggest alternative approaches such as AirDrop, emailing, or using iCloud Photo Library for a successful transfer of edited images.\n",
"\n",
"\n",
"\u001b[31mUser message:\u001b[0m\n",
"\n",
"This is an example of the task, though some input or output fields are not supplied.\n",
"\n",
"[[ ## context ## ]]\n",
"Not supplied for this particular example.\n",
"\n",
"[[ ## question ## ]]\n",
"can i create a shortcut to open a specific application on os x?\n",
"\n",
"Respond with the corresponding output fields, starting with the field `[[ ## reasoning ## ]]`, then `[[ ## response ## ]]`, and then ending with the marker for `[[ ## completed ## ]]`.\n",
"\n",
"\n",
"\u001b[31mAssistant message:\u001b[0m\n",
"\n",
"[[ ## reasoning ## ]]\n",
"Not supplied for this particular example.\n",
"\n",
"[[ ## response ## ]]\n",
"While Mac OS X does have a built-in method for setting keyboard shortcuts, it doesn't work for Firefox. \n",
"Karabiner-Elements allows for customization of keyboard shortcuts on Mac versions 10.12 and later, including executing shell commands. \n",
"Alfred, particularly in its Power Pack version, offers the ability to map shortcuts to applications, among its various features. \n",
"Using Automator Services in combination with built-in keyboard shortcuts is another method to create shortcuts without third party apps. \n",
"Spark 3 is a free Shortcuts manager which enables you to create Hot Keys to launch applications and documents, execute AppleScript, control iTunes, etc. \n",
"Some users have found Apptivate to be the easiest to use for assigning global shortcuts to apps. \n",
"To open Terminal with a shortcut on Mac without third-party software, one can utilize a custom Quick Action created in Automator and assign it a unique hotkey, like ⌘ + ⌥ + F12. \n",
"For iTerm2 users with Oh My Zsh, one can replace AppleScript with the 'Launch Application' action in Automator. \n",
"Furthermore, Terminal app already has built-in shortcut keys for opening new terminals or tabs at a folder location: New Terminal at Folder ^+⇧+T New Terminal at Tab Folder ⌥+^+⇧+T.\n",
"\n",
"[[ ## completed ## ]]\n",
"\n",
"\n",
"\u001b[31mUser message:\u001b[0m\n",
"\n",
"[[ ## context ## ]]\n",
"[1] «On linux, /sbin/nologin comes from the util-linux project, while /bin/false is part of GNU Coreutils. They serve different roles, and nologin has the option of printing a message for people who have it as their shell who are logging in. The linux commands come from BSD, where they seem to have a long history of being different. The FreeBSD false simply returns 1, while the nologin checks to make sure its running on a TTY and sends a message to syslog during login attempts. The linux versions are a bit more complicated (false doing all sorts of fun stuff with internationalization for the output of --help, I assume) but essentially perform the same way.»\n",
"[2] «/bin/false is a system command that is used anytime you need to pass a command to a program that should do nothing more than exit with an error. Its the companion to /bin/true. Both of these are very old and standard POSIX utilities and neither produce any output by definition. true is sometimes used for a shell script that should loop indefinitely, like: while true; do ... # Waste time if [ $wasted_time -gt 100000 ]; then exit 0 fi ... done /usr/sbin/nologin is specifically designed to replace a shell and produces output complaining you cant log-in. Before it existed, it was common to use /bin/false for dummy users, but could be confusing since the user doesnt know why theyre kicked off.»\n",
"[3] «/bin/false only job is to exit with a non-zero exit code. Try it at the command line: $:> /bin/false $:> echo $? 1 $:> Some institutions use /bin/false in the shell field of the password file. If user tries to login, the shell is /bin/false, so they are exited right away»\n",
"[4] «Some FTP servers will allow you FTP access only if you have a valid shell. /sbin/nologin is regarded as a valid shell, whereas /bin/false is not. (I think valid means its exit status is 0, but /etc/shells may also come into it, it probably depends on the system, the FTP software, and your configuration.)»\n",
"[5] «You can use false (/bin/false, /usr/bin/false, or shell builtin): $ false || echo It failed. It failed. $ You can also use exit 1 from a subshell: $ (exit 1) || echo Gosh, it failed too. Gosh, it failed too. $»\n",
"\n",
"[[ ## question ## ]]\n",
"whats the difference between /sbin/nologin and /bin/false\n",
"\n",
"Respond with the corresponding output fields, starting with the field `[[ ## reasoning ## ]]`, then `[[ ## response ## ]]`, and then ending with the marker for `[[ ## completed ## ]]`.\n",
"\n",
"\n",
"\u001b[31mAssistant message:\u001b[0m\n",
"\n",
"[[ ## reasoning ## ]]\n",
"The context provides detailed information about the roles and behaviors of `/sbin/nologin` and `/bin/false`. `/sbin/nologin` is designed to prevent users from logging in while providing a message indicating that login is not allowed. In contrast, `/bin/false` simply exits with a non-zero exit code without any output, serving as a command that does nothing. The distinction lies in their intended use cases and the feedback they provide to users.\n",
"\n",
"[[ ## response ## ]]\n",
"The main difference between `/sbin/nologin` and `/bin/false` is their purpose and behavior during login attempts. `/sbin/nologin` is used to prevent users from logging in while displaying a message that informs them they cannot log in. It is considered a valid shell for certain applications, such as FTP servers. On the other hand, `/bin/false` is a command that simply exits with a non-zero exit code and does not provide any output. It is often used in situations where a command needs to do nothing and is not intended to inform the user of any restrictions.\n",
"\n",
"[[ ## completed ## ]]\n",
"\n",
"\n",
"\u001b[31mUser message:\u001b[0m\n",
"\n",
"[[ ## context ## ]]\n",
"[1] «If you hold command and quickly tap tab you will cycle between your two most recently used applications without bringing up the heads up display. If you want to use a third party app Witch has options to ignore minimized windows.»\n",
"[2] «Try this: On your Mac, Navigate to System Preferences Go to Mission Control Uncheck When switching to an application, switch to a Space with open windows for the application Try using the cmd+tab now.»\n",
"[3] «Command + Tab until you get the apps icon. Before releasing the Command key, press and hold the Option key. You must switch to another app and let it take focus first. In other words, you cant just Command + Tab to another app and before actually selecting that app (by releasing the Command and Tab keys), switch right back to your minimized app, which you might attempt to do if you minimized it by accident or just simply changed your mind shortly after minimizing. Both the Command and left Option keys must be pressed on the same side (left or right) of the keyboard.»\n",
"[4] «Command-option-click does not hide all open windows. As stated in the linked Apple article, this command hides all other open items leaving the clicked item visible. It is possible to hide all other items and minimize your most recently item with command+option+h+m. This is a combination of command+option+h - Hide Others and command+option+m - Minimize.»\n",
"[5] «Cmd+` of course will work but I do it in different way. I do the Cmd+tab when i do that, I dont release the Cmd so the opened apps are still visible. While it is visible, I will press ▼. This way it will show all your opened application with animated displayed so you can navigate using arrow keys.»\n",
"\n",
"[[ ## question ## ]]\n",
"cmd+tab does not work on hidden or minimized windows\n",
"\n",
"Respond with the corresponding output fields, starting with the field `[[ ## reasoning ## ]]`, then `[[ ## response ## ]]`, and then ending with the marker for `[[ ## completed ## ]]`.\n",
"\n",
"\n",
"\u001b[31mResponse:\u001b[0m\n",
"\n",
"\u001b[32m[[ ## reasoning ## ]]\n",
"The context explains how the Command + Tab shortcut functions on macOS, particularly in relation to switching between applications. It notes that this shortcut does not bring back minimized or hidden windows directly. Instead, it cycles through applications that are currently open and visible. The information also suggests alternative methods for managing minimized windows and provides insights into how to navigate between applications effectively.\n",
"\n",
"[[ ## response ## ]]\n",
"The Command + Tab shortcut on macOS is designed to switch between currently open applications, but it does not directly restore minimized or hidden windows. When you use Command + Tab, it cycles through the applications that are actively running, and minimized windows do not count as active. To manage minimized windows, you can use other shortcuts or methods. For example, you can use Command + Option + H + M to hide all other applications and minimize the most recently used one. Alternatively, you can navigate to the application you want to restore using Command + Tab and then manually click on the minimized window in the Dock to bring it back to focus.\n",
"\n",
"[[ ## completed ## ]]\u001b[0m\n",
"\n",
"\n",
"\n",
"\n",
"\n"
]
}
],
"source": [
"dspy.inspect_history(n=2)"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down

0 comments on commit bff476a

Please sign in to comment.