{ "cells": [ { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [], "source": [ "from langchain.llms import OpenAI\n", "\n", "llm = OpenAI(model_name=\"text-davinci-002\", n=2, best_of=2, cache=False)" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "CPU times: user 5.07 ms, sys: 2.21 ms, total: 7.28 ms\n", "Wall time: 995 ms\n" ] }, { "data": { "text/plain": [ "'\\n\\nWhy did the chicken cross the road?\\n\\nTo get to the other side!'" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "%%time\n", "llm(\"Tell me a joke\")" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "CPU times: user 5.11 ms, sys: 2.25 ms, total: 7.36 ms\n", "Wall time: 818 ms\n" ] }, { "data": { "text/plain": [ "'\\n\\nWhy did the chicken cross the road?\\n\\nTo get to the other side.'" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "%%time\n", "llm(\"Tell me a joke\")" ] } ], "metadata": { "kernelspec": { "display_name": "base", "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.10.10" }, "orig_nbformat": 4 }, "nbformat": 4, "nbformat_minor": 2 }