diff --git a/cookbook/liteLLM_Ollama.ipynb b/cookbook/liteLLM_Ollama.ipynb index 3aab935f9..9abfadb17 100644 --- a/cookbook/liteLLM_Ollama.ipynb +++ b/cookbook/liteLLM_Ollama.ipynb @@ -2,16 +2,45 @@ "cells": [ { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Defaulting to user installation because normal site-packages is not writeable\n", + "Requirement already satisfied: litellm==0.1.385 in /Users/ishaanjaffer/Library/Python/3.9/lib/python/site-packages (0.1.385)\n", + "Requirement already satisfied: openai<0.28.0,>=0.27.8 in /Users/ishaanjaffer/Library/Python/3.9/lib/python/site-packages (from litellm==0.1.385) (0.27.8)\n", + "Requirement already satisfied: python-dotenv<2.0.0,>=1.0.0 in /Users/ishaanjaffer/Library/Python/3.9/lib/python/site-packages (from litellm==0.1.385) (1.0.0)\n", + "Requirement already satisfied: tiktoken<0.5.0,>=0.4.0 in /Users/ishaanjaffer/Library/Python/3.9/lib/python/site-packages (from litellm==0.1.385) (0.4.0)\n", + "Requirement already satisfied: requests>=2.20 in /Users/ishaanjaffer/Library/Python/3.9/lib/python/site-packages (from openai<0.28.0,>=0.27.8->litellm==0.1.385) (2.28.2)\n", + "Requirement already satisfied: tqdm in /Users/ishaanjaffer/Library/Python/3.9/lib/python/site-packages (from openai<0.28.0,>=0.27.8->litellm==0.1.385) (4.65.0)\n", + "Requirement already satisfied: aiohttp in /Users/ishaanjaffer/Library/Python/3.9/lib/python/site-packages (from openai<0.28.0,>=0.27.8->litellm==0.1.385) (3.8.4)\n", + "Requirement already satisfied: regex>=2022.1.18 in /Users/ishaanjaffer/Library/Python/3.9/lib/python/site-packages (from tiktoken<0.5.0,>=0.4.0->litellm==0.1.385) (2023.6.3)\n", + "Requirement already satisfied: charset-normalizer<4,>=2 in /Users/ishaanjaffer/Library/Python/3.9/lib/python/site-packages (from requests>=2.20->openai<0.28.0,>=0.27.8->litellm==0.1.385) (3.1.0)\n", + "Requirement already satisfied: idna<4,>=2.5 in /Users/ishaanjaffer/Library/Python/3.9/lib/python/site-packages (from requests>=2.20->openai<0.28.0,>=0.27.8->litellm==0.1.385) (3.4)\n", + "Requirement already satisfied: urllib3<1.27,>=1.21.1 in /Users/ishaanjaffer/Library/Python/3.9/lib/python/site-packages (from requests>=2.20->openai<0.28.0,>=0.27.8->litellm==0.1.385) (1.26.6)\n", + "Requirement already satisfied: certifi>=2017.4.17 in /Users/ishaanjaffer/Library/Python/3.9/lib/python/site-packages (from requests>=2.20->openai<0.28.0,>=0.27.8->litellm==0.1.385) (2023.5.7)\n", + "Requirement already satisfied: attrs>=17.3.0 in /Users/ishaanjaffer/Library/Python/3.9/lib/python/site-packages (from aiohttp->openai<0.28.0,>=0.27.8->litellm==0.1.385) (23.1.0)\n", + "Requirement already satisfied: multidict<7.0,>=4.5 in /Users/ishaanjaffer/Library/Python/3.9/lib/python/site-packages (from aiohttp->openai<0.28.0,>=0.27.8->litellm==0.1.385) (6.0.4)\n", + "Requirement already satisfied: async-timeout<5.0,>=4.0.0a3 in /Users/ishaanjaffer/Library/Python/3.9/lib/python/site-packages (from aiohttp->openai<0.28.0,>=0.27.8->litellm==0.1.385) (4.0.2)\n", + "Requirement already satisfied: yarl<2.0,>=1.0 in /Users/ishaanjaffer/Library/Python/3.9/lib/python/site-packages (from aiohttp->openai<0.28.0,>=0.27.8->litellm==0.1.385) (1.9.2)\n", + "Requirement already satisfied: frozenlist>=1.1.1 in /Users/ishaanjaffer/Library/Python/3.9/lib/python/site-packages (from aiohttp->openai<0.28.0,>=0.27.8->litellm==0.1.385) (1.3.3)\n", + "Requirement already satisfied: aiosignal>=1.1.2 in /Users/ishaanjaffer/Library/Python/3.9/lib/python/site-packages (from aiohttp->openai<0.28.0,>=0.27.8->litellm==0.1.385) (1.3.1)\n", + "\n", + "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m23.1.2\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m23.2.1\u001b[0m\n", + "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49m/Library/Developer/CommandLineTools/usr/bin/python3 -m pip install --upgrade pip\u001b[0m\n" + ] + } + ], "source": [ "!pip install litellm==0.1.385" ] }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 3, "metadata": {}, "outputs": [], "source": [ @@ -29,7 +58,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 4, "metadata": {}, "outputs": [], "source": [ @@ -47,14 +76,14 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "\n" + "\n" ] } ], @@ -73,71 +102,29 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - " I\n", - "{'role': 'assistant', 'content': ' I'}\n", - " am\n", - "{'role': 'assistant', 'content': ' am'}\n", - " L\n", - "{'role': 'assistant', 'content': ' L'}\n", - "La\n", - "{'role': 'assistant', 'content': 'La'}\n", - "MA\n", - "{'role': 'assistant', 'content': 'MA'}\n", - ",\n", - "{'role': 'assistant', 'content': ','}\n", - " an\n", - "{'role': 'assistant', 'content': ' an'}\n", - " A\n", - "{'role': 'assistant', 'content': ' A'}\n", - "I\n", - "{'role': 'assistant', 'content': 'I'}\n", - " assistant\n", - "{'role': 'assistant', 'content': ' assistant'}\n", - " developed\n", - "{'role': 'assistant', 'content': ' developed'}\n", - " by\n", - "{'role': 'assistant', 'content': ' by'}\n", - " Meta\n", - "{'role': 'assistant', 'content': ' Meta'}\n", - " A\n", - "{'role': 'assistant', 'content': ' A'}\n", - "I\n", - "{'role': 'assistant', 'content': 'I'}\n", - " that\n", - "{'role': 'assistant', 'content': ' that'}\n", - " can\n", - "{'role': 'assistant', 'content': ' can'}\n", - " understand\n", - "{'role': 'assistant', 'content': ' understand'}\n", - " and\n", - "{'role': 'assistant', 'content': ' and'}\n", - " respond\n", - "{'role': 'assistant', 'content': ' respond'}\n", - " to\n", - "{'role': 'assistant', 'content': ' to'}\n", - " human\n", - "{'role': 'assistant', 'content': ' human'}\n", - " input\n", - "{'role': 'assistant', 'content': ' input'}\n", - " in\n", - "{'role': 'assistant', 'content': ' in'}\n", - " a\n", - "{'role': 'assistant', 'content': ' a'}\n", - " convers\n", - "{'role': 'assistant', 'content': ' convers'}\n", - "ational\n", - "{'role': 'assistant', 'content': 'ational'}\n", - " manner\n", - "{'role': 'assistant', 'content': ' manner'}\n", - ".\n", - "{'role': 'assistant', 'content': '.'}\n" + "{'choices': [{'delta': {'role': 'assistant', 'content': ' I'}}]}\n", + "{'choices': [{'delta': {'role': 'assistant', 'content': \"'\"}}]}\n", + "{'choices': [{'delta': {'role': 'assistant', 'content': 'm'}}]}\n", + "{'choices': [{'delta': {'role': 'assistant', 'content': ' an'}}]}\n", + "{'choices': [{'delta': {'role': 'assistant', 'content': ' A'}}]}\n", + "{'choices': [{'delta': {'role': 'assistant', 'content': 'I'}}]}\n", + "{'choices': [{'delta': {'role': 'assistant', 'content': ' assistant'}}]}\n", + "{'choices': [{'delta': {'role': 'assistant', 'content': ' trained'}}]}\n", + "{'choices': [{'delta': {'role': 'assistant', 'content': ' to'}}]}\n", + "{'choices': [{'delta': {'role': 'assistant', 'content': ' help'}}]}\n", + "{'choices': [{'delta': {'role': 'assistant', 'content': ' with'}}]}\n", + "{'choices': [{'delta': {'role': 'assistant', 'content': ' tasks'}}]}\n", + "{'choices': [{'delta': {'role': 'assistant', 'content': ' and'}}]}\n", + "{'choices': [{'delta': {'role': 'assistant', 'content': ' answer'}}]}\n", + "{'choices': [{'delta': {'role': 'assistant', 'content': ' questions'}}]}\n", + "{'choices': [{'delta': {'role': 'assistant', 'content': '.'}}]}\n" ] } ], @@ -152,6 +139,13 @@ "\n", "string_response = await get_response(response)" ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": {