From b1779cf348d36a4087ce438802effeb407f519a6 Mon Sep 17 00:00:00 2001 From: Vadym Barda Date: Tue, 19 Nov 2024 11:57:26 -0500 Subject: [PATCH] docs: update autogen docs (#2470) --- docs/_scripts/prepare_notebooks_for_ci.py | 2 ++ docs/docs/how-tos/autogen-integration.ipynb | 26 +++++++++---------- .../how-tos/autogen-langgraph-platform.ipynb | 24 ++++++++--------- 3 files changed, 25 insertions(+), 27 deletions(-) diff --git a/docs/_scripts/prepare_notebooks_for_ci.py b/docs/_scripts/prepare_notebooks_for_ci.py index eee19acab..dfa1e1c70 100644 --- a/docs/_scripts/prepare_notebooks_for_ci.py +++ b/docs/_scripts/prepare_notebooks_for_ci.py @@ -36,6 +36,8 @@ NOTEBOOKS_NO_EXECUTION = [ "docs/docs/tutorials/rag/langgraph_self_rag_local.ipynb", # this loads a massive dataset from gcp "docs/docs/tutorials/usaco/usaco.ipynb", + # TODO: figure out why autogen notebook is not runnable (they are just hanging. possible due to code execution?) + "docs/docs/how-tos/autogen-integration.ipynb", # TODO: need to update these notebooks to make sure they are runnable in CI "docs/docs/tutorials/storm/storm.ipynb", # issues only when running with VCR "docs/docs/tutorials/lats/lats.ipynb", # issues only when running with VCR diff --git a/docs/docs/how-tos/autogen-integration.ipynb b/docs/docs/how-tos/autogen-integration.ipynb index 1673014d4..207a3b6f3 100644 --- a/docs/docs/how-tos/autogen-integration.ipynb +++ b/docs/docs/how-tos/autogen-integration.ipynb @@ -29,7 +29,7 @@ "metadata": {}, "outputs": [], "source": [ - "# %pip install autogen bs4 langgraph langchain-openai langchain-community" + "%pip install autogen bs4 langgraph langchain-openai langchain-community" ] }, { @@ -39,11 +39,17 @@ "metadata": {}, "outputs": [], "source": [ - "# import os\n", - "# import getpass\n", + "import getpass\n", + "import os\n", "\n", - "# os.environ[\"OPENAI_API_KEY\"] = getpass.getpass()\n", - "# os.environ[\"TAVILY_API_KEY\"] = getpass.getpass()" + "\n", + "def _set_env(var: str):\n", + " if not os.environ.get(var):\n", + " os.environ[var] = getpass.getpass(f\"{var}: \")\n", + "\n", + "\n", + "_set_env(\"OPENAI_API_KEY\")\n", + "_set_env(\"TAVILY_API_KEY\")" ] }, { @@ -300,14 +306,6 @@ "):\n", " print(chunk)" ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "ab2a7e63-a842-4e58-9c6a-e2203edec7b0", - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { @@ -326,7 +324,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.1" + "version": "3.12.3" } }, "nbformat": 4, diff --git a/docs/docs/how-tos/autogen-langgraph-platform.ipynb b/docs/docs/how-tos/autogen-langgraph-platform.ipynb index 0d8cc4b19..29bd24ba5 100644 --- a/docs/docs/how-tos/autogen-langgraph-platform.ipynb +++ b/docs/docs/how-tos/autogen-langgraph-platform.ipynb @@ -31,7 +31,7 @@ }, "outputs": [], "source": [ - "# %pip install autogen langgraph" + "%pip install autogen langgraph" ] }, { @@ -41,10 +41,16 @@ "metadata": {}, "outputs": [], "source": [ - "# import os\n", - "# import getpass\n", + "import getpass\n", + "import os\n", "\n", - "# os.environ[\"OPENAI_API_KEY\"] = getpass.getpass()" + "\n", + "def _set_env(var: str):\n", + " if not os.environ.get(var):\n", + " os.environ[var] = getpass.getpass(f\"{var}: \")\n", + "\n", + "\n", + "_set_env(\"OPENAI_API_KEY\")" ] }, { @@ -139,14 +145,6 @@ "\n", "You can now deploy this as you normally would with LangGraph Platform. See [these instructions](https://langchain-ai.github.io/langgraph/concepts/deployment_options/) for more details." ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "2b9c3ecb-0f36-4cfb-a10f-8a2e0ef6c730", - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { @@ -165,7 +163,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.1" + "version": "3.12.3" } }, "nbformat": 4,