{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "jukit_cell_id": "O4HPx3boF0" }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": { "jukit_cell_id": "hqQkbPEwTJ" }, "source": [ "# Using the DockerWrapper utility" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "jukit_cell_id": "vCepuypaFH" }, "outputs": [], "source": [ "from langchain.utilities.docker import DockerWrapper, DockerSocket" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "jukit_cell_id": "BtYVqy2YtO" }, "outputs": [], "source": [ "d = DockerWrapper()\n", "query = \"\"\"\n", "for i in $(seq 1 10)\n", "do\n", " echo $i\n", "done\n", "\"\"\"" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "jukit_cell_id": "ELWWm03ptQ" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[header] blocking IO\n", "{'stdout': '1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n9\\n10\\n'}\n", "1\n", "2\n", "3\n", "4\n", "5\n", "6\n", "7\n", "8\n", "9\n", "10\n", "\n" ] } ], "source": [ "print(d.exec_run(query, \"alpine\"))" ] } ], "metadata": { "anaconda-cloud": {}, "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "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.9.11" } }, "nbformat": 4, "nbformat_minor": 4 }