diff --git a/docs/docs/get-started/quick-tour-notebook/quick-tour.ipynb b/docs/docs/get-started/quick-tour-notebook/quick-tour.ipynb new file mode 100644 index 00000000..299fc6cc --- /dev/null +++ b/docs/docs/get-started/quick-tour-notebook/quick-tour.ipynb @@ -0,0 +1,518 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "57cUBU_kW8YI" + }, + "source": [ + "

LaVague: Quick-tour guide

" + ] + }, + { + "attachments": {}, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Installation\n", + "\n", + "We can install everything we need to get started with LaVague using our `setup.sh` script.\n", + "\n", + "We'll also download the config and instruction files we will use in this demo.\n", + "\n", + "> This downloads the webdriver needed to leverage Selenium to interact with the browser, as well as the LaVague package." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Run the LaVague setup script\n", + "!wget https://raw.githubusercontent.com/lavague-ai/LaVague/main/setup.sh\n", + "!sudo bash setup.sh\n", + "\n", + "# Download files needed for demo to current repo\n", + "!wget https://raw.githubusercontent.com/lavague-ai/LaVague/main/examples/configurations/api/openai_api.py\n", + "!wget https://raw.githubusercontent.com/lavague-ai/LaVague/main/examples/instructions/huggingface.yaml" + ] + }, + { + "attachments": {}, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### OpenAI API key\n", + "\n", + "By default, LaVague uses OpenAI GPT3.5 and an OpenAI light embedder. Please make sure you've set the `OPENAI_API_KEY` environment variable with your OpenAI key, or if you're running this in our Google Colab, set it in the command below." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import os\n", + "\n", + "os.environ['OPENAI_API_KEY'] = # ADD YOUR OPENAI KEY HERE" + ] + }, + { + "attachments": {}, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### LaVague Launch\n", + "\n", + "Let's now run the `lavague [OPTIONS] launch` command!\n", + "\n", + "- The `--instructions` or `-i` option accepts a text file containing: the URL of the website we will interact with & the instructions for the actions we wish to automate\n", + "- The `--config` or `-c` option with a Python file which can be used to set a desired LLM, embedder etc.\n", + "\n", + "For more info on these, see the [customization guide](./customization.md)!" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "!lavague -i huggingface.yaml -c openai_api.py launch" + ] + }, + { + "attachments": {}, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "You can now click on the public (if you are using Google Colab) or local URL to open your interactive LaVague demo.\n", + "\n", + "⚠️ You'll need to interact with this demo:\n", + "\n", + "1) Click on the URL textbox and press enter. This will show a screenshot of your inital page.\n", + "\n", + "\n", + "\n", + "2) Then select an instruction or write your own, and again click within the instruction textbox and press enter.\n", + "\n", + "At this point, your Python code leveraging Selenium is generated by the LLM & executed. You will see an updated image of the website after the code is executed.\n", + "\n", + "" + ] + }, + { + "attachments": {}, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### LaVague Build\n", + "\n", + "We can use `lavague [OPTIONS] build` command to generate a file containing this automation code without launching an interactive demo." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "!lavague -i huggingface.yaml -c openai_api.py build" + ] + }, + { + "attachments": {}, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "This creates a script in your current directory named `hf_openai_api_gen.py` - a combination of the two input file names separated by a `_` character with a `_gen` suffix.\n", + "\n", + "We can now inspect the code and execute it locally!\n", + "\n", + "\n" + ] + }, + { + "attachments": {}, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "If you have any further questions, join us on the LaVague Discord [here](https://discord.com/invite/SDxn9KpqX9)." + ] + } + ], + "metadata": { + "accelerator": "GPU", + "colab": { + "gpuType": "T4", + "machine_shape": "hm", + "provenance": [] + }, + "kernelspec": { + "display_name": "Python 3", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.10.13" + }, + "widgets": { + "application/vnd.jupyter.widget-state+json": { + "0d9126c291a04e8fb1ce30a7103197d1": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "1.2.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "15c0d6723eba4298b61ddd67c1595f66": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "1.5.0", + "model_name": "FloatProgressModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "FloatProgressModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "ProgressView", + "bar_style": "success", + "description": "", + "description_tooltip": null, + "layout": "IPY_MODEL_0d9126c291a04e8fb1ce30a7103197d1", + "max": 4, + "min": 0, + "orientation": "horizontal", + "style": "IPY_MODEL_a36c6df55813490a9e0b42b67a698327", + "value": 4 + } + }, + "2600f072828a4abf8e8ed51cd64f2dc2": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "1.5.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "HTMLView", + "description": "", + "description_tooltip": null, + "layout": "IPY_MODEL_984f401572a645f7861db035993c806b", + "placeholder": "​", + "style": "IPY_MODEL_2ba0655ceb93417d859921bf08b5ec9d", + "value": "Loading checkpoint shards: 100%" + } + }, + "2ba0655ceb93417d859921bf08b5ec9d": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "1.5.0", + "model_name": "DescriptionStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "DescriptionStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "StyleView", + "description_width": "" + } + }, + "398c2359c137457b94fe7ed7b8c4b939": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "1.5.0", + "model_name": "HBoxModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "HBoxModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "HBoxView", + "box_style": "", + "children": [ + "IPY_MODEL_2600f072828a4abf8e8ed51cd64f2dc2", + "IPY_MODEL_15c0d6723eba4298b61ddd67c1595f66", + "IPY_MODEL_d1a4215edd20433482d339c83c9d0060" + ], + "layout": "IPY_MODEL_c71a506bf63948c8bfb79b6811705de5" + } + }, + "777ac9bad3974a2ab7062644bda6a3c6": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "1.5.0", + "model_name": "DescriptionStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "DescriptionStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "StyleView", + "description_width": "" + } + }, + "984f401572a645f7861db035993c806b": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "1.2.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "a36c6df55813490a9e0b42b67a698327": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "1.5.0", + "model_name": "ProgressStyleModel", + "state": { + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "ProgressStyleModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "StyleView", + "bar_color": null, + "description_width": "" + } + }, + "c71a506bf63948c8bfb79b6811705de5": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "1.2.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + }, + "d1a4215edd20433482d339c83c9d0060": { + "model_module": "@jupyter-widgets/controls", + "model_module_version": "1.5.0", + "model_name": "HTMLModel", + "state": { + "_dom_classes": [], + "_model_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "_model_name": "HTMLModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/controls", + "_view_module_version": "1.5.0", + "_view_name": "HTMLView", + "description": "", + "description_tooltip": null, + "layout": "IPY_MODEL_ec5d092ea24946279f14f03570a48c98", + "placeholder": "​", + "style": "IPY_MODEL_777ac9bad3974a2ab7062644bda6a3c6", + "value": " 4/4 [00:12<00:00,  2.89s/it]" + } + }, + "ec5d092ea24946279f14f03570a48c98": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "1.2.0", + "model_name": "LayoutModel", + "state": { + "_model_module": "@jupyter-widgets/base", + "_model_module_version": "1.2.0", + "_model_name": "LayoutModel", + "_view_count": null, + "_view_module": "@jupyter-widgets/base", + "_view_module_version": "1.2.0", + "_view_name": "LayoutView", + "align_content": null, + "align_items": null, + "align_self": null, + "border": null, + "bottom": null, + "display": null, + "flex": null, + "flex_flow": null, + "grid_area": null, + "grid_auto_columns": null, + "grid_auto_flow": null, + "grid_auto_rows": null, + "grid_column": null, + "grid_gap": null, + "grid_row": null, + "grid_template_areas": null, + "grid_template_columns": null, + "grid_template_rows": null, + "height": null, + "justify_content": null, + "justify_items": null, + "left": null, + "margin": null, + "max_height": null, + "max_width": null, + "min_height": null, + "min_width": null, + "object_fit": null, + "object_position": null, + "order": null, + "overflow": null, + "overflow_x": null, + "overflow_y": null, + "padding": null, + "right": null, + "top": null, + "visibility": null, + "width": null + } + } + } + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/docs/docs/get-started/quick-tour.ipynb b/docs/docs/get-started/quick-tour.ipynb index 1bcc5d0f..4597c19d 100644 --- a/docs/docs/get-started/quick-tour.ipynb +++ b/docs/docs/get-started/quick-tour.ipynb @@ -6,11 +6,7 @@ "id": "57cUBU_kW8YI" }, "source": [ - "
\n", - "

LaVague: Quick-tour guide

\n", - " \n", - " \"Open\n", - "
" + "

LaVague: Quick-tour guide

" ] }, { @@ -21,58 +17,21 @@ "In this quick tour we're going to show you how you can use LaVague to perform actions on web from text instructions 🤯\n", "\n", "We'll get you started with our two CLI commands:\n", - "- `lavague [OPTIONS] launch`: Launch an interactive in-browser Gradio demo where you can test out instructing LaVague to perform actions on a website!\n", - "- `lavague [OPTIONS] build`: Get the raw Python code generated by LaVague which you can then execute locally" - ] - }, - { - "attachments": {}, - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Installation\n", + "- `lavague launch`: Launch an interactive in-browser Gradio demo where you can test out instructing LaVague to perform actions on a website!\n", + "- `lavague build`: Get the raw Python code generated by LaVague which you can then execute locally\n", "\n", - "We can install everything we need to get started with LaVague using our `setup.sh` script.\n", + "**Pre-requisites:**\n", + "- We assume you have already installed LaVague & the necessary dependencies as outlined in our [installation guide](./setting-up-la-vague.md)\n", + "- If you are running the notebook locally, you will need Python (test on python>=3.8) and pip installed\n", + "- Our default demo uses the OpenAI API. You will need to have an OPENAI_API_KEY environment variable set in your local environment\n", "\n", - "We'll also download the config and instruction files we will use in this demo.\n", + "> For other integrations, see our [integrations](../integrations/home.md) section\n", "\n", - "> This downloads the webdriver needed to leverage Selenium to interact with the browser, as well as the LaVague package." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "# Run the LaVague setup script\n", - "!wget https://raw.githubusercontent.com/lavague-ai/LaVague/main/setup.sh\n", - "!sudo bash setup.sh\n", - "\n", - "# Download files needed for demo to current repo\n", - "!wget https://raw.githubusercontent.com/lavague-ai/LaVague/main/examples/configurations/api/openai_api.py\n", - "!wget https://raw.githubusercontent.com/lavague-ai/LaVague/main/examples/instructions/huggingface.yaml" - ] - }, - { - "attachments": {}, - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### OpenAI API key\n", - "\n", - "By default, LaVague uses OpenAI GPT3.5 and an OpenAI light embedder. Please make sure you've set the `OPENAI_API_KEY` environment variable with your OpenAI key, or if you're running this in our Google Colab, set it in the command below." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "import os\n", - "\n", - "os.environ['OPENAI_API_KEY'] = # ADD YOUR OPENAI KEY HERE" + "If you prefer to run this example as an end-to-end example with Google Colab, you can follow this link.\n", + "
\n", + " \n", + " \"Run\n", + "
" ] }, { @@ -82,7 +41,7 @@ "source": [ "### LaVague Launch\n", "\n", - "Let's now run the `lavague [OPTIONS] launch` command!\n", + "Let's now run the `lavague launch` command!\n", "\n", "- The `--instructions` or `-i` option accepts a text file containing: the URL of the website we will interact with & the instructions for the actions we wish to automate\n", "- The `--config` or `-c` option with a Python file which can be used to set a desired LLM, embedder etc.\n", @@ -126,7 +85,7 @@ "source": [ "### LaVague Build\n", "\n", - "We can use `lavague [OPTIONS] build` command to generate a file containing this automation code without launching an interactive demo." + "We can use `lavague build` command to generate a file containing this automation code without launching an interactive demo." ] }, { diff --git a/docs/docs/integrations/azure-openai.ipynb b/docs/docs/integrations/api/azure-openai.ipynb similarity index 99% rename from docs/docs/integrations/azure-openai.ipynb rename to docs/docs/integrations/api/azure-openai.ipynb index 132cce55..bab4f7aa 100644 --- a/docs/docs/integrations/azure-openai.ipynb +++ b/docs/docs/integrations/api/azure-openai.ipynb @@ -9,7 +9,7 @@ "source": [ "
\n", "

LaVague: Azure OpenAI integration

\n", - " \n", + " \n", " \"Open\n", "
" ] diff --git a/docs/docs/integrations/hugging-face-api.ipynb b/docs/docs/integrations/api/hugging-face.ipynb similarity index 99% rename from docs/docs/integrations/hugging-face-api.ipynb rename to docs/docs/integrations/api/hugging-face.ipynb index 72ad237a..cb79de72 100644 --- a/docs/docs/integrations/hugging-face-api.ipynb +++ b/docs/docs/integrations/api/hugging-face.ipynb @@ -8,8 +8,8 @@ }, "source": [ "
\n", - "

LaVague: HuggingFace API integration

\n", - " \n", + "

LaVague: HuggingFace integration

\n", + "
\n", " \"Open\n", "
" ] diff --git a/docs/docs/integrations/litellm.ipynb b/docs/docs/integrations/api/litellm.ipynb similarity index 99% rename from docs/docs/integrations/litellm.ipynb rename to docs/docs/integrations/api/litellm.ipynb index fb26a19a..8118b741 100644 --- a/docs/docs/integrations/litellm.ipynb +++ b/docs/docs/integrations/api/litellm.ipynb @@ -9,7 +9,7 @@ "source": [ "
\n", "

LaVague: LiteLLM integration

\n", - " \n", + " \n", " \"Open\n", "
" ] diff --git a/docs/docs/integrations/openai.ipynb b/docs/docs/integrations/api/openai.ipynb similarity index 99% rename from docs/docs/integrations/openai.ipynb rename to docs/docs/integrations/api/openai.ipynb index 197228b3..69bcee02 100644 --- a/docs/docs/integrations/openai.ipynb +++ b/docs/docs/integrations/api/openai.ipynb @@ -9,7 +9,7 @@ "source": [ "
\n", "

LaVague: OpenAI integration

\n", - " \n", + " \n", " \"Open\n", "
" ] diff --git a/docs/docs/integrations/local-inference.ipynb b/docs/docs/integrations/local/local-inference.ipynb similarity index 99% rename from docs/docs/integrations/local-inference.ipynb rename to docs/docs/integrations/local/local-inference.ipynb index 5640bd68..67f18b90 100644 --- a/docs/docs/integrations/local-inference.ipynb +++ b/docs/docs/integrations/local/local-inference.ipynb @@ -8,8 +8,8 @@ }, "source": [ "
\n", - "

LaVague: HuggingFace API integration

\n", - " \n", + "

LaVague: DeepSeek Coder integration

\n", + "
\n", " \"Open\n", "
" ] diff --git a/mkdocs.yml b/mkdocs.yml index 3b5b33ea..deffc4b0 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -102,12 +102,14 @@ nav: - 🤝 Integrations: - Overview: 'docs/integrations/home.md' - - Azure OpenAI: 'docs/integrations/azure-openai.ipynb' - - HuggingFace API: 'docs/integrations/hugging-face-api.ipynb' - - OpenAI: 'docs/integrations/openai.ipynb' - - Local: 'docs/integrations/local-inference.ipynb' - - Litellm: 'docs/integrations/litellm.ipynb' - + - Api: + - Azure OpenAI: 'docs/integrations/api/azure-openai.ipynb' + - HuggingFace: 'docs/integrations/hugging-face-api.ipynb' + - OpenAI: 'docs/integrations/openai.ipynb' + - Litellm: 'docs/integrations/litellm.ipynb' + - Local: + - DeepSeek Coder: 'docs/integrations/local-inference.ipynb' + - ⚡ Advanced: - Architecture: 'docs/get-started/architecture.md' - Telemetry: 'docs/advanced/telemetry.md'