From f954ea105603c120217b62419d9df68c7de50411 Mon Sep 17 00:00:00 2001 From: Jayesh Sharma Date: Thu, 25 Jan 2024 20:08:29 +0530 Subject: [PATCH] fix spellings --- llm-agents/run.ipynb | 179 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 174 insertions(+), 5 deletions(-) diff --git a/llm-agents/run.ipynb b/llm-agents/run.ipynb index edd6e704..c55c8266 100644 --- a/llm-agents/run.ipynb +++ b/llm-agents/run.ipynb @@ -263,7 +263,7 @@ "\n", "This step makes use of the UnstructuredURLLoader wrapper from LangChain to load the URLs as documents.\n", "\n", - "You can import any libraries that you would want to use and use it inside a step definition. Running it locally only requires that you have the library installed on your environment. When you want to run on a remote stack, you can either choose to allow ZenML to derive dependencies from your local envrionment, or pass in the requirements explicitly (more on this later)." + "You can import any libraries that you would want to use and use it inside a step definition. Running it locally only requires that you have the library installed on your environment. When you want to run on a remote stack, you can either choose to allow ZenML to derive dependencies from your local environment, or pass in the requirements explicitly (more on this later)." ] }, { @@ -462,7 +462,7 @@ "\n", "A [pipeline](https://docs.zenml.io/user-guide/starter-guide/create-an-ml-pipeline) is where you chain all the steps together. The order of execution is determined by the relationship between outputs and inputs across steps. You can also choose to add explicit dependencies using `.after()` and `.before()`.\n", "\n", - "The output of each step is tracked and versioned in the artifact store that you configure in your ZenML stack (local, by deafult). ZenML does the heavy-lifting of making sure that the right data is available to the step that needs it." + "The output of each step is tracked and versioned in the artifact store that you configure in your ZenML stack (local, by default). ZenML does the heavy-lifting of making sure that the right data is available to the step that needs it." ] }, { @@ -657,7 +657,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "metadata": {}, "outputs": [], "source": [ @@ -707,9 +707,178 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\u001b[33mYour artifact was materialized under Python version 'unknown' but you are currently using '3.9.5'. This might cause unexpected behavior since pickle is not reproducible across Python versions. Attempting to load anyway...\u001b[0m\n" + ] + }, + { + "data": { + "text/html": [ + "
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮\n",
+       " /tmp/ipykernel_13478/293644048.py:1 in <module>                                                  \n",
+       "                                                                                                  \n",
+       " [Errno 2] No such file or directory: '/tmp/ipykernel_13478/293644048.py'                         \n",
+       "                                                                                                  \n",
+       " /tmp/ipykernel_13478/342580437.py:20 in ask_agent                                                \n",
+       "                                                                                                  \n",
+       " [Errno 2] No such file or directory: '/tmp/ipykernel_13478/342580437.py'                         \n",
+       "                                                                                                  \n",
+       " /home/wjayesh/slackbot/lib/python3.9/site-packages/zenml/models/v2/core/artifact_version.py:322  \n",
+       " in load                                                                                          \n",
+       "                                                                                                  \n",
+       "   319 │   │   \"\"\"                                                                                \n",
+       "   320 │   │   from zenml.artifacts.utils import load_artifact_from_response                      \n",
+       "   321 │   │                                                                                      \n",
+       " 322 │   │   return load_artifact_from_response(self)                                           \n",
+       "   323 │                                                                                          \n",
+       "   324 │   def read(self) -> Any:                                                                 \n",
+       "   325 │   │   \"\"\"(Deprecated) Materializes (loads) the data stored in this artifact.             \n",
+       "                                                                                                  \n",
+       " /home/wjayesh/slackbot/lib/python3.9/site-packages/zenml/artifacts/utils.py:433 in               \n",
+       " load_artifact_from_response                                                                      \n",
+       "                                                                                                  \n",
+       "   430 │   │   │   artifact.id,                                                                   \n",
+       "   431 │   │   )                                                                                  \n",
+       "   432 │                                                                                          \n",
+       " 433 return _load_artifact_from_uri(                                                        \n",
+       "   434 │   │   materializer=artifact.materializer,                                                \n",
+       "   435 │   │   data_type=artifact.data_type,                                                      \n",
+       "   436 │   │   uri=artifact.uri,                                                                  \n",
+       "                                                                                                  \n",
+       " /home/wjayesh/slackbot/lib/python3.9/site-packages/zenml/artifacts/utils.py:535 in               \n",
+       " _load_artifact_from_uri                                                                          \n",
+       "                                                                                                  \n",
+       "   532 │   │   uri,                                                                               \n",
+       "   533 │   )                                                                                      \n",
+       "   534 │   materializer_object: BaseMaterializer = materializer_class(uri)                        \n",
+       " 535 artifact = materializer_object.load(artifact_class)                                    \n",
+       "   536 │   logger.debug(\"Artifact loaded successfully.\")                                          \n",
+       "   537 │                                                                                          \n",
+       "   538 │   return artifact                                                                        \n",
+       "                                                                                                  \n",
+       " /home/wjayesh/apps/zenml-projects/llm-agents/agent/agent_executor_materializer.py:75 in load     \n",
+       "                                                                                                  \n",
+       "    72 │   │                                                                                      \n",
+       "    73 │   │   # load data                                                                        \n",
+       "    74 │   │   filepath = os.path.join(self.uri, DEFAULT_FILENAME)                                \n",
+       "  75 │   │   with fileio.open(filepath, \"rb\") as fid:                                           \n",
+       "    76 │   │   │   data = pickle.load(fid)                                                        \n",
+       "    77 │   │   return data                                                                        \n",
+       "    78                                                                                            \n",
+       "                                                                                                  \n",
+       " /home/wjayesh/slackbot/lib/python3.9/site-packages/zenml/io/fileio.py:64 in open                 \n",
+       "                                                                                                  \n",
+       "    61 Returns:                                                                               \n",
+       "    62 │   │   The opened file.                                                                   \n",
+       "    63 \"\"\"                                                                                    \n",
+       "  64 return _get_filesystem(path).open(path, mode=mode)                                     \n",
+       "    65                                                                                            \n",
+       "    66                                                                                            \n",
+       "    67 def copy(src: \"PathType\", dst: \"PathType\", overwrite: bool = False) -> None:               \n",
+       "                                                                                                  \n",
+       " /home/wjayesh/slackbot/lib/python3.9/site-packages/zenml/io/local_filesystem.py:69 in open       \n",
+       "                                                                                                  \n",
+       "    66 │   │   │   Any: The file object.                                                          \n",
+       "    67 │   │   \"\"\"                                                                                \n",
+       "    68 │   │   encoding = \"utf-8\" if \"b\" not in mode else None                                    \n",
+       "  69 │   │   return open(name, mode=mode, encoding=encoding)                                    \n",
+       "    70 │                                                                                          \n",
+       "    71 │   @staticmethod                                                                          \n",
+       "    72 │   def copyfile(                                                                          \n",
+       "╰──────────────────────────────────────────────────────────────────────────────────────────────────╯\n",
+       "FileNotFoundError: [Errno 2] No such file or directory: \n",
+       "'/home/jovyan/.config/zenml/local_stores/466b79ce-3df9-4549-a50b-67ed433461f3/agent_creator/agent/7613bba6-157e-424\n",
+       "2-a220-317a6f312fdb/agent.pkl'\n",
+       "
\n" + ], + "text/plain": [ + "\u001b[31m╭─\u001b[0m\u001b[31m──────────────────────────────\u001b[0m\u001b[31m \u001b[0m\u001b[1;31mTraceback \u001b[0m\u001b[1;2;31m(most recent call last)\u001b[0m\u001b[31m \u001b[0m\u001b[31m───────────────────────────────\u001b[0m\u001b[31m─╮\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[2;33m/tmp/ipykernel_13478/\u001b[0m\u001b[1;33m293644048.py\u001b[0m:\u001b[94m1\u001b[0m in \u001b[92m\u001b[0m \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[3;31m[Errno 2] No such file or directory: '/tmp/ipykernel_13478/293644048.py'\u001b[0m \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[2;33m/tmp/ipykernel_13478/\u001b[0m\u001b[1;33m342580437.py\u001b[0m:\u001b[94m20\u001b[0m in \u001b[92mask_agent\u001b[0m \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[3;31m[Errno 2] No such file or directory: '/tmp/ipykernel_13478/342580437.py'\u001b[0m \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[2;33m/home/wjayesh/slackbot/lib/python3.9/site-packages/zenml/models/v2/core/\u001b[0m\u001b[1;33martifact_version.py\u001b[0m:\u001b[94m322\u001b[0m \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m in \u001b[92mload\u001b[0m \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[2m319 \u001b[0m\u001b[2;33m│ │ \u001b[0m\u001b[33m\"\"\"\u001b[0m \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[2m320 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[94mfrom\u001b[0m \u001b[4;96mzenml\u001b[0m\u001b[4;96m.\u001b[0m\u001b[4;96martifacts\u001b[0m\u001b[4;96m.\u001b[0m\u001b[4;96mutils\u001b[0m \u001b[94mimport\u001b[0m load_artifact_from_response \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[2m321 \u001b[0m\u001b[2m│ │ \u001b[0m \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m322 \u001b[2m│ │ \u001b[0m\u001b[94mreturn\u001b[0m load_artifact_from_response(\u001b[96mself\u001b[0m) \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[2m323 \u001b[0m\u001b[2m│ \u001b[0m \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[2m324 \u001b[0m\u001b[2m│ \u001b[0m\u001b[94mdef\u001b[0m \u001b[92mread\u001b[0m(\u001b[96mself\u001b[0m) -> Any: \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[2m325 \u001b[0m\u001b[2;90m│ │ \u001b[0m\u001b[33m\"\"\"(Deprecated) Materializes (loads) the data stored in this artifact.\u001b[0m \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[2;33m/home/wjayesh/slackbot/lib/python3.9/site-packages/zenml/artifacts/\u001b[0m\u001b[1;33mutils.py\u001b[0m:\u001b[94m433\u001b[0m in \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[92mload_artifact_from_response\u001b[0m \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[2m430 \u001b[0m\u001b[2m│ │ │ \u001b[0martifact.id, \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[2m431 \u001b[0m\u001b[2m│ │ \u001b[0m) \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[2m432 \u001b[0m\u001b[2m│ \u001b[0m \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m433 \u001b[2m│ \u001b[0m\u001b[94mreturn\u001b[0m _load_artifact_from_uri( \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[2m434 \u001b[0m\u001b[2m│ │ \u001b[0mmaterializer=artifact.materializer, \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[2m435 \u001b[0m\u001b[2m│ │ \u001b[0mdata_type=artifact.data_type, \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[2m436 \u001b[0m\u001b[2m│ │ \u001b[0muri=artifact.uri, \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[2;33m/home/wjayesh/slackbot/lib/python3.9/site-packages/zenml/artifacts/\u001b[0m\u001b[1;33mutils.py\u001b[0m:\u001b[94m535\u001b[0m in \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[92m_load_artifact_from_uri\u001b[0m \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[2m532 \u001b[0m\u001b[2m│ │ \u001b[0muri, \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[2m533 \u001b[0m\u001b[2m│ \u001b[0m) \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[2m534 \u001b[0m\u001b[2m│ \u001b[0mmaterializer_object: BaseMaterializer = materializer_class(uri) \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m535 \u001b[2m│ \u001b[0martifact = materializer_object.load(artifact_class) \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[2m536 \u001b[0m\u001b[2m│ \u001b[0mlogger.debug(\u001b[33m\"\u001b[0m\u001b[33mArtifact loaded successfully.\u001b[0m\u001b[33m\"\u001b[0m) \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[2m537 \u001b[0m\u001b[2m│ \u001b[0m \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[2m538 \u001b[0m\u001b[2m│ \u001b[0m\u001b[94mreturn\u001b[0m artifact \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[2;33m/home/wjayesh/apps/zenml-projects/llm-agents/agent/\u001b[0m\u001b[1;33magent_executor_materializer.py\u001b[0m:\u001b[94m75\u001b[0m in \u001b[92mload\u001b[0m \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[2m 72 \u001b[0m\u001b[2m│ │ \u001b[0m \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[2m 73 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[2m# load data\u001b[0m \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[2m 74 \u001b[0m\u001b[2m│ │ \u001b[0mfilepath = os.path.join(\u001b[96mself\u001b[0m.uri, DEFAULT_FILENAME) \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m 75 \u001b[2m│ │ \u001b[0m\u001b[94mwith\u001b[0m fileio.open(filepath, \u001b[33m\"\u001b[0m\u001b[33mrb\u001b[0m\u001b[33m\"\u001b[0m) \u001b[94mas\u001b[0m fid: \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[2m 76 \u001b[0m\u001b[2m│ │ │ \u001b[0mdata = pickle.load(fid) \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[2m 77 \u001b[0m\u001b[2m│ │ \u001b[0m\u001b[94mreturn\u001b[0m data \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[2m 78 \u001b[0m \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[2;33m/home/wjayesh/slackbot/lib/python3.9/site-packages/zenml/io/\u001b[0m\u001b[1;33mfileio.py\u001b[0m:\u001b[94m64\u001b[0m in \u001b[92mopen\u001b[0m \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[2m 61 \u001b[0m\u001b[2;33m│ \u001b[0m\u001b[33mReturns:\u001b[0m \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[2m 62 \u001b[0m\u001b[2;33m│ │ \u001b[0m\u001b[33mThe opened file.\u001b[0m \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[2m 63 \u001b[0m\u001b[2;33m│ \u001b[0m\u001b[33m\"\"\"\u001b[0m \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m 64 \u001b[2m│ \u001b[0m\u001b[94mreturn\u001b[0m _get_filesystem(path).open(path, mode=mode) \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[2m 65 \u001b[0m \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[2m 66 \u001b[0m \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[2m 67 \u001b[0m\u001b[94mdef\u001b[0m \u001b[92mcopy\u001b[0m(src: \u001b[33m\"\u001b[0m\u001b[33mPathType\u001b[0m\u001b[33m\"\u001b[0m, dst: \u001b[33m\"\u001b[0m\u001b[33mPathType\u001b[0m\u001b[33m\"\u001b[0m, overwrite: \u001b[96mbool\u001b[0m = \u001b[94mFalse\u001b[0m) -> \u001b[94mNone\u001b[0m: \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[2;33m/home/wjayesh/slackbot/lib/python3.9/site-packages/zenml/io/\u001b[0m\u001b[1;33mlocal_filesystem.py\u001b[0m:\u001b[94m69\u001b[0m in \u001b[92mopen\u001b[0m \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[2m 66 \u001b[0m\u001b[2;33m│ │ │ \u001b[0m\u001b[33mAny: The file object.\u001b[0m \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[2m 67 \u001b[0m\u001b[2;33m│ │ \u001b[0m\u001b[33m\"\"\"\u001b[0m \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[2m 68 \u001b[0m\u001b[2m│ │ \u001b[0mencoding = \u001b[33m\"\u001b[0m\u001b[33mutf-8\u001b[0m\u001b[33m\"\u001b[0m \u001b[94mif\u001b[0m \u001b[33m\"\u001b[0m\u001b[33mb\u001b[0m\u001b[33m\"\u001b[0m \u001b[95mnot\u001b[0m \u001b[95min\u001b[0m mode \u001b[94melse\u001b[0m \u001b[94mNone\u001b[0m \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[31m❱ \u001b[0m 69 \u001b[2m│ │ \u001b[0m\u001b[94mreturn\u001b[0m \u001b[96mopen\u001b[0m(name, mode=mode, encoding=encoding) \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[2m 70 \u001b[0m\u001b[2m│ \u001b[0m \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[2m 71 \u001b[0m\u001b[2m│ \u001b[0m\u001b[1;95m@staticmethod\u001b[0m \u001b[31m│\u001b[0m\n", + "\u001b[31m│\u001b[0m \u001b[2m 72 \u001b[0m\u001b[2m│ \u001b[0m\u001b[94mdef\u001b[0m \u001b[92mcopyfile\u001b[0m( \u001b[31m│\u001b[0m\n", + "\u001b[31m╰──────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n", + "\u001b[1;91mFileNotFoundError: \u001b[0m\u001b[1m[\u001b[0mErrno \u001b[1;36m2\u001b[0m\u001b[1m]\u001b[0m No such file or directory: \n", + "\u001b[32m'/home/jovyan/.config/zenml/local_stores/466b79ce-3df9-4549-a50b-67ed433461f3/agent_creator/agent/7613bba6-157e-424\u001b[0m\n", + "\u001b[32m2-a220-317a6f312fdb/agent.pkl'\u001b[0m\n" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "ask_agent(\"Who are you?\")" ]