mirror of https://github.com/hwchase17/langchain
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
424 lines
186 KiB
Plaintext
424 lines
186 KiB
Plaintext
1 year ago
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"attachments": {},
|
||
|
"cell_type": "markdown",
|
||
|
"id": "8d10861f-a550-4443-bc63-4ce2ae13b841",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# Infino - LangChain LLM Monitoring Example\n",
|
||
|
"\n",
|
||
|
"This example shows how one can track the following while calling OpenAI models via LangChain and [Infino](https://github.com/infinohq/infino):\n",
|
||
|
"\n",
|
||
|
"* prompt input,\n",
|
||
|
"* response from chatgpt or any other LangChain model,\n",
|
||
|
"* latency,\n",
|
||
|
"* errors,\n",
|
||
|
"* number of tokens consumed"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 9,
|
||
|
"id": "3a5a0976-9953-41d8-880c-eb3f2992e936",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"Requirement already satisfied: matplotlib in /Users/vinaykakade/.pyenv/versions/3.10.11/lib/python3.10/site-packages (3.7.1)\n",
|
||
|
"Requirement already satisfied: contourpy>=1.0.1 in /Users/vinaykakade/.pyenv/versions/3.10.11/lib/python3.10/site-packages (from matplotlib) (1.0.7)\n",
|
||
|
"Requirement already satisfied: cycler>=0.10 in /Users/vinaykakade/.pyenv/versions/3.10.11/lib/python3.10/site-packages (from matplotlib) (0.11.0)\n",
|
||
|
"Requirement already satisfied: fonttools>=4.22.0 in /Users/vinaykakade/.pyenv/versions/3.10.11/lib/python3.10/site-packages (from matplotlib) (4.39.4)\n",
|
||
|
"Requirement already satisfied: kiwisolver>=1.0.1 in /Users/vinaykakade/.pyenv/versions/3.10.11/lib/python3.10/site-packages (from matplotlib) (1.4.4)\n",
|
||
|
"Requirement already satisfied: numpy>=1.20 in /Users/vinaykakade/.pyenv/versions/3.10.11/lib/python3.10/site-packages (from matplotlib) (1.24.3)\n",
|
||
|
"Requirement already satisfied: packaging>=20.0 in /Users/vinaykakade/.pyenv/versions/3.10.11/lib/python3.10/site-packages (from matplotlib) (23.1)\n",
|
||
|
"Requirement already satisfied: pillow>=6.2.0 in /Users/vinaykakade/.pyenv/versions/3.10.11/lib/python3.10/site-packages (from matplotlib) (9.5.0)\n",
|
||
|
"Requirement already satisfied: pyparsing>=2.3.1 in /Users/vinaykakade/.pyenv/versions/3.10.11/lib/python3.10/site-packages (from matplotlib) (3.0.9)\n",
|
||
|
"Requirement already satisfied: python-dateutil>=2.7 in /Users/vinaykakade/.pyenv/versions/3.10.11/lib/python3.10/site-packages (from matplotlib) (2.8.2)\n",
|
||
|
"Requirement already satisfied: six>=1.5 in /Users/vinaykakade/.pyenv/versions/3.10.11/lib/python3.10/site-packages (from python-dateutil>=2.7->matplotlib) (1.16.0)\n",
|
||
|
"Requirement already satisfied: infinopy in /Users/vinaykakade/.pyenv/versions/3.10.11/lib/python3.10/site-packages (0.0.1)\n",
|
||
|
"Requirement already satisfied: docker in /Users/vinaykakade/.pyenv/versions/3.10.11/lib/python3.10/site-packages (from infinopy) (6.1.3)\n",
|
||
|
"Requirement already satisfied: requests in /Users/vinaykakade/.pyenv/versions/3.10.11/lib/python3.10/site-packages (from infinopy) (2.31.0)\n",
|
||
|
"Requirement already satisfied: packaging>=14.0 in /Users/vinaykakade/.pyenv/versions/3.10.11/lib/python3.10/site-packages (from docker->infinopy) (23.1)\n",
|
||
|
"Requirement already satisfied: urllib3>=1.26.0 in /Users/vinaykakade/.pyenv/versions/3.10.11/lib/python3.10/site-packages (from docker->infinopy) (2.0.2)\n",
|
||
|
"Requirement already satisfied: websocket-client>=0.32.0 in /Users/vinaykakade/.pyenv/versions/3.10.11/lib/python3.10/site-packages (from docker->infinopy) (1.5.2)\n",
|
||
|
"Requirement already satisfied: charset-normalizer<4,>=2 in /Users/vinaykakade/.pyenv/versions/3.10.11/lib/python3.10/site-packages (from requests->infinopy) (3.1.0)\n",
|
||
|
"Requirement already satisfied: idna<4,>=2.5 in /Users/vinaykakade/.pyenv/versions/3.10.11/lib/python3.10/site-packages (from requests->infinopy) (3.4)\n",
|
||
|
"Requirement already satisfied: certifi>=2017.4.17 in /Users/vinaykakade/.pyenv/versions/3.10.11/lib/python3.10/site-packages (from requests->infinopy) (2023.5.7)\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"# Install necessary dependencies.\n",
|
||
|
"!pip install infinopy\n",
|
||
|
"!pip install matplotlib\n",
|
||
|
"\n",
|
||
|
"# Remove the (1) import sys and sys.path.append(..) and (2) uncomment `!pip install langchain` after merging the PR for Infino/LangChain integration.\n",
|
||
|
"import sys\n",
|
||
1 year ago
|
"\n",
|
||
1 year ago
|
"sys.path.append(\"../../../../../langchain\")\n",
|
||
|
"#!pip install langchain\n",
|
||
|
"\n",
|
||
|
"\n",
|
||
|
"import datetime as dt\n",
|
||
|
"from infinopy import InfinoClient\n",
|
||
|
"import json\n",
|
||
|
"from langchain.llms import OpenAI\n",
|
||
|
"from langchain.callbacks import InfinoCallbackHandler\n",
|
||
|
"import matplotlib.pyplot as plt\n",
|
||
|
"import matplotlib.dates as md\n",
|
||
|
"import os\n",
|
||
|
"import time\n",
|
||
|
"import sys"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"attachments": {},
|
||
|
"cell_type": "markdown",
|
||
|
"id": "9f90210d-c805-4a0c-81e4-d5298942afc4",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## Start Infino server, initialize the Infino client\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 10,
|
||
|
"id": "748b9858-5145-4351-976a-ca2d54e836a6",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"497a621125800abdd19f57ce7e033349b3cf83ca8cea6a74e8e28433a42ecadd\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"# Start server using the Infino docker image.\n",
|
||
|
"!docker run --rm --detach --name infino-example -p 3000:3000 infinohq/infino:latest\n",
|
||
|
"\n",
|
||
|
"# Create Infino client.\n",
|
||
|
"client = InfinoClient()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"attachments": {},
|
||
|
"cell_type": "markdown",
|
||
|
"id": "b6b81cda-b841-43ee-8c5e-b1576555765f",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## Read the questions dataset"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 17,
|
||
|
"id": "b659fd0c-0d8c-470e-8b6c-867a117f2a27",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
1 year ago
|
"# These are a subset of questions from Stanford's QA dataset -\n",
|
||
1 year ago
|
"# https://rajpurkar.github.io/SQuAD-explorer/\n",
|
||
1 year ago
|
"data = \"\"\"In what country is Normandy located?\n",
|
||
1 year ago
|
"When were the Normans in Normandy?\n",
|
||
|
"From which countries did the Norse originate?\n",
|
||
|
"Who was the Norse leader?\n",
|
||
|
"What century did the Normans first gain their separate identity?\n",
|
||
|
"Who gave their name to Normandy in the 1000's and 1100's\n",
|
||
|
"What is France a region of?\n",
|
||
|
"Who did King Charles III swear fealty to?\n",
|
||
|
"When did the Frankish identity emerge?\n",
|
||
|
"Who was the duke in the battle of Hastings?\n",
|
||
|
"Who ruled the duchy of Normandy\n",
|
||
|
"What religion were the Normans\n",
|
||
|
"What type of major impact did the Norman dynasty have on modern Europe?\n",
|
||
|
"Who was famed for their Christian spirit?\n",
|
||
|
"Who assimilted the Roman language?\n",
|
||
|
"Who ruled the country of Normandy?\n",
|
||
|
"What principality did William the conquerer found?\n",
|
||
|
"What is the original meaning of the word Norman?\n",
|
||
|
"When was the Latin version of the word Norman first recorded?\n",
|
||
1 year ago
|
"What name comes from the English words Normans/Normanz?\"\"\"\n",
|
||
1 year ago
|
"\n",
|
||
1 year ago
|
"questions = data.split(\"\\n\")"
|
||
1 year ago
|
]
|
||
|
},
|
||
|
{
|
||
|
"attachments": {},
|
||
|
"cell_type": "markdown",
|
||
|
"id": "dce1b820-3f1a-4b94-b848-4c6032cadc18",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## LangChain OpenAI Q&A; Publish metrics and logs to Infino"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 18,
|
||
|
"id": "d5cebf35-2d10-48b8-ab11-c4a574c595d2",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"In what country is Normandy located?\n",
|
||
|
"generations=[[Generation(text='\\n\\nNormandy is located in France.', generation_info={'finish_reason': 'stop', 'logprobs': None})]] llm_output={'token_usage': {'total_tokens': 16, 'completion_tokens': 9, 'prompt_tokens': 7}, 'model_name': 'text-davinci-003'} run=RunInfo(run_id=UUID('8de21639-acec-4bd1-a12d-8124de1e20da'))\n",
|
||
|
"When were the Normans in Normandy?\n",
|
||
|
"generations=[[Generation(text='\\n\\nThe Normans first settled in Normandy in the late 9th century.', generation_info={'finish_reason': 'stop', 'logprobs': None})]] llm_output={'token_usage': {'total_tokens': 24, 'completion_tokens': 16, 'prompt_tokens': 8}, 'model_name': 'text-davinci-003'} run=RunInfo(run_id=UUID('cf81fc86-250b-4e6e-9d92-2df3bebb019a'))\n",
|
||
|
"From which countries did the Norse originate?\n",
|
||
|
"generations=[[Generation(text='\\n\\nThe Norse originated from Scandinavia, which includes modern-day Norway, Sweden, and Denmark.', generation_info={'finish_reason': 'stop', 'logprobs': None})]] llm_output={'token_usage': {'total_tokens': 29, 'completion_tokens': 21, 'prompt_tokens': 8}, 'model_name': 'text-davinci-003'} run=RunInfo(run_id=UUID('50f42f5e-b4a4-411a-a049-f92cb573a74f'))\n",
|
||
|
"Who was the Norse leader?\n",
|
||
|
"generations=[[Generation(text='\\n\\nThe most famous Norse leader was the legendary Viking king Ragnar Lodbrok. He is believed to have lived in the 9th century and is renowned for his exploits in England and France.', generation_info={'finish_reason': 'stop', 'logprobs': None})]] llm_output={'token_usage': {'total_tokens': 45, 'completion_tokens': 39, 'prompt_tokens': 6}, 'model_name': 'text-davinci-003'} run=RunInfo(run_id=UUID('e32f31cb-ddc9-4863-8e6e-cb7a281a0ada'))\n",
|
||
|
"What century did the Normans first gain their separate identity?\n",
|
||
|
"generations=[[Generation(text='\\n\\nThe Normans first gained their separate identity in the 11th century.', generation_info={'finish_reason': 'stop', 'logprobs': None})]] llm_output={'token_usage': {'total_tokens': 28, 'completion_tokens': 16, 'prompt_tokens': 12}, 'model_name': 'text-davinci-003'} run=RunInfo(run_id=UUID('da9d8f73-b3b3-4bc5-8495-da8b11462a51'))\n",
|
||
|
"Who gave their name to Normandy in the 1000's and 1100's\n",
|
||
|
"generations=[[Generation(text='\\n\\nThe Normans, a people from northern France, gave their name to Normandy in the 1000s and 1100s. The Normans were descended from Viking settlers who had come to the region in the late 800s.', generation_info={'finish_reason': 'stop', 'logprobs': None})]] llm_output={'token_usage': {'total_tokens': 58, 'completion_tokens': 45, 'prompt_tokens': 13}, 'model_name': 'text-davinci-003'} run=RunInfo(run_id=UUID('bb5829bf-b6a6-4429-adfa-414ac5be46e5'))\n",
|
||
|
"What is France a region of?\n",
|
||
|
"generations=[[Generation(text='\\n\\nFrance is a region of Europe.', generation_info={'finish_reason': 'stop', 'logprobs': None})]] llm_output={'token_usage': {'total_tokens': 16, 'completion_tokens': 9, 'prompt_tokens': 7}, 'model_name': 'text-davinci-003'} run=RunInfo(run_id=UUID('6943880b-b4e4-4c74-9ca1-8c03c10f7e9c'))\n",
|
||
|
"Who did King Charles III swear fealty to?\n",
|
||
|
"generations=[[Generation(text='\\n\\nKing Charles III swore fealty to Pope Innocent III.', generation_info={'finish_reason': 'stop', 'logprobs': None})]] llm_output={'token_usage': {'total_tokens': 23, 'completion_tokens': 13, 'prompt_tokens': 10}, 'model_name': 'text-davinci-003'} run=RunInfo(run_id=UUID('c91fd663-09e6-4d00-b746-4c7fd96f9ceb'))\n",
|
||
|
"When did the Frankish identity emerge?\n",
|
||
|
"generations=[[Generation(text='\\n\\nThe Frankish identity began to emerge in the late 5th century, when the Franks began to expand their power and influence in the region. The Franks were a Germanic tribe that had migrated to the area from the east and had established a kingdom in what is now modern-day France. The Franks were eventually able to establish a powerful kingdom that lasted until the 10th century.', generation_info={'finish_reason': 'stop', 'logprobs': None})]] llm_output={'token_usage': {'total_tokens': 86, 'completion_tokens': 78, 'prompt_tokens': 8}, 'model_name': 'text-davinci-003'} run=RunInfo(run_id=UUID('23f86775-e592-4cb8-baa3-46ebe74305b2'))\n",
|
||
|
"Who was the duke in the battle of Hastings?\n",
|
||
|
"generations=[[Generation(text='\\n\\nThe Duke of Normandy, William the Conqueror, was the leader of the Norman forces at the Battle of Hastings in 1066.', generation_info={'finish_reason': 'stop', 'logprobs': None})]] llm_output={'token_usage': {'total_tokens': 39, 'completion_tokens': 28, 'prompt_tokens': 11}, 'model_name': 'text-davinci-003'} run=RunInfo(run_id=UUID('ad5b7984-8758-4d95-a5eb-ee56e0218f6b'))\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"# Set your key here.\n",
|
||
1 year ago
|
"# os.environ[\"OPENAI_API_KEY\"] = \"YOUR_API_KEY\"\n",
|
||
1 year ago
|
"\n",
|
||
|
"# Create callback handler. This logs latency, errors, token usage, prompts as well as prompt responses to Infino.\n",
|
||
1 year ago
|
"handler = InfinoCallbackHandler(\n",
|
||
|
" model_id=\"test_openai\", model_version=\"0.1\", verbose=False\n",
|
||
|
")\n",
|
||
1 year ago
|
"\n",
|
||
|
"# Create LLM.\n",
|
||
|
"llm = OpenAI(temperature=0.1)\n",
|
||
|
"\n",
|
||
|
"# Number of questions to ask the OpenAI model. We limit to a short number here to save $$ while running this demo.\n",
|
||
|
"num_questions = 10\n",
|
||
|
"\n",
|
||
|
"questions = questions[0:num_questions]\n",
|
||
|
"for question in questions:\n",
|
||
|
" print(question)\n",
|
||
|
"\n",
|
||
|
" # We send the question to OpenAI API, with Infino callback.\n",
|
||
|
" llm_result = llm.generate([question], callbacks=[handler])\n",
|
||
|
" print(llm_result)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"attachments": {},
|
||
|
"cell_type": "markdown",
|
||
|
"id": "b68ec697-c922-4fd9-aad1-f49c6ac24e8a",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## Create Metric Charts\n",
|
||
|
"\n",
|
||
|
"We now use matplotlib to create graphs of latency, errors and tokens consumed."
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 19,
|
||
|
"id": "f078c612-89e0-4a1d-b1a8-bf36b664a10e",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAgsAAAGiCAYAAABppIV1AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/bCgiHAAAACXBIWXMAAA9hAAAPYQGoP6dpAABnYUlEQVR4nO3deXhTVfoH8O9Nuq/QvaUtpaVlXwpl37cCoiKIDoviCoqIC8qIM/MTdMZBdFBREBAUFFFRQUUUyr4Isu97W1poS+lK9yZNk/P7I02gLKUlaW+W7+d5eMamN8mbd26TN+ee8x5JCCFAREREdAcKuQMgIiIiy8ZigYiIiGrEYoGIiIhqxGKBiIiIasRigYiIiGrEYoGIiIhqxGKBiIiIasRigYiIiGrEYoGIiIhqxGKBiIiIasRigcjGrVixApIk4dChQyY9TllZGWbPno0dO3aYJzAishosFoioVsrKyvD222+zWCCyQ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V8jC7LPWUhMTERISAgiIyMxYcIEXL58+Y7HqtVqFBUVVftHRER0NzqdwP+q5io81SsCAZ4u9/xYN05ytBeyFgvdunXDihUrsHHjRixatAgpKSno06cPiouLb3v8nDlz4O3tbfwXFhbWwBETEZE1+u3EFZzPKoaXiwOe6xtl0mPZ4/JJSQhhMWs/CgoK0LRpU3z44Yd45plnbvm9Wq2GWq02/lxUVISwsDAUFhbCy8urIUMlIiIrodHqMPjDnbiUV4YZQ1tg6oB7vwQBAMUqDdrN3gQ
|
||
|
"text/plain": [
|
||
|
"<Figure size 600x400 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAiwAAAGiCAYAAADEJZ3cAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/bCgiHAAAACXBIWXMAAA9hAAAPYQGoP6dpAAA9oUlEQVR4nO3dd3gU9f728XtTKSEBEkgMBIOIAkqPQAAFpQQEFQQLYuMgWLGA/gT1AGJBPBZQUSwHsKEcRRE5CCKgcATpRVoEC9WEJgkBUkg+zx88WV0JkLAbdpK8X9eVS3d2ZvOd+5pl78xOcZmZCQAAwMEC/D0AAACA06GwAAAAx6OwAAAAx6OwAAAAx6OwAAAAx6OwAAAAx6OwAAAAx6OwAAAAx6OwAAAAx6OwAAAAx6OwAHCEyZMny+VynfTnhx9+8PcQAfhRkL8HAAB/NWrUKNWuXfuE6eeff74fRgPAKSgsAByla9euSkhIKPT8x44dU15enkJCQk547vDhw6pYseIZj8XMlJmZqfLly5/xawDwDb4SAlBi/Pbbb3K5XHrhhRc0duxY1alTR6Ghodq4caNGjhwpl8uljRs36qabblKVKlXUtm1bScdLzVNPPeWePz4+Xo899piysrI8Xj8+Pl7du3fXnDlzlJCQoPLly+vNN9+U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jMdOnRIsbGxp7w4JIXFB3bv3q24uDh/DwMAgBJrx44dqlmz5kmfp7D4QKVKlSQdDzs8PNzPowEAoORIT09XXFyc+7P0ZCgsPpD/NVB4eDiFBQCAM3C6Qyo46BYAADgehQUAADgehQUAADgehQUAADgehQUAADgehQUAADgehQUAADgehQUAADgehQUAADgehQUAADgehQUAADgehQUAADgehQUAADgehQUAADgehQUAADgehQUAADgehQUAADgehQUAADgehQUAADgehQUAADgehQUAADgehQUAADgehQUAADgehQUAADgehQUAADgehQUAADgehQUAADgehQUAADgehQUAADgehQUAADheiSss48ePV3x8vMqVK6eWLVtq2bJlp5z/k08+Ub169VSuXDk1bNhQs2bNOum8d911l1wul8aOHevjUQMAAG+UqMIydepUDR48WCNGjNCqVavUuHFjJSUlac+ePQXOv3jxYvXp00f9+/fX6tWr1aNHD/Xo0UPr168/Yd7PP/9cP/zwg2JjY4t7NQAAQBGVqMLy0ksvacCAAerXr58aNGigCRMmqEKFCpo4cWKB848bN05dunTRI488ovr16+upp55Ss2bN9Nprr3nMt2vXLg0aNEgffvihgoODz8aqAACAIigxhSU7O1srV65Ux44d3dMCAgLUsWNHLVmypMBllixZ4jG/JCUlJXnMn5eXp1tuuUWPPPKILrrookKNJSsrS+np6R4/AACg+JSYwrJv3z7l5uYqOjraY3p0dLRSUlIKXCYlJeW0848ZM0ZBQUG6//77Cz2W0aNHKyIiwv0TFxdXhDUBAABFVWIKS3FYuXKlxo0bp8mTJ8vlchV6uWHDhiktLc39s2PHjmIcJQAAKDGFJSoqSoGBgUpNTfWYnpqaqpiYmAKXiYmJOeX8ixYt0p49e1SrVi0FBQUpKChI27Zt05AhQxQfH3/SsYSGhio8PNzjBwAAFJ8SU1hCQkLUvHlzzZs3zz0tLy9P8+bNU2JiYoHLJCYmeswvSXPnznXPf8stt2jdunVas2aN+yc2NlaPPPKI5syZU3wrAwAAiiTI3wMoisGDB+u2225TQkKCWrRoobFjx+rw4cPq16+fJOnWW29VjRo1NHr0aEnSAw88oHbt2unFF19Ut27d9PHHH2vFihV66623JEmRkZGKjIz0+B3BwcGKiYnRhRdeeHZXDgAAnFSJKiw33HCD9u7dq+HDhyslJUVNmjTR7Nmz3QfWbt++XQEBf+40at26taZMmaInnnhCjz32mOrWravp06fr4osv9tcqAACAM+AyM/P3IEq69PR0RUREKC0tjeNZAAAogsJ+hpaYY1gAAEDZRWEBAACOR2EBAACOR2EBAACOR2EBAACOR2EBAACOR2EBAACOR2EBAACOR2EBAACOR2EBAACOR2EBAACOR2EBAACOR2EBAACOR2EBAACOR2EBAACOR2EBAACOR2EBAACOR2EBAACOR2EBAACOR2EBAACOR2EBAACOR2EBAACOR2EBAACOR2EBAACOR2EBAACOR2EBAACOR2EBAACOR2EBAACOR2EBAACOR2EBAACOR2EBAACOR2EBAACOR2EBAACOR2EBAACOR2EBAACOR2EBAACOR2EBAACOR2EBAACOV+IKy/jx4xUfH69y5cqpZcuWWrZs2Snn/+STT1SvXj2VK1dODRs21KxZs9zP5eTk6NFHH1XDhg1VsWJFxcbG6tZbb9Xu3buLezUAAEARlKjCMnXqVA0ePFgjRozQqlWr1LhxYyUlJWnPnj0Fzr948WL16dNH/fv31+rVq9WjRw/16NFD69evlyQdOXJEq1at0j//+U+tWrVKn332mZKTk3X11VefzdUCAACn4TIz8/cgCqtly5a65JJL9Nprr0mS8vLyFBcXp0GDBmno0KEnzH/DDTfo8OHDmjlzpntaq1at1KRJE02YMKHA37F8+XK1aNFC27ZtU61atQo1rvT0dEVERCgtLU3h4eFnsGYAAJRNhf0MLTF7WLKzs7Vy5Up17NjRPS0gIEAdO3bUkiVLClxmyZIlHvNLUlJS0knnl6S0tDS5XC5VrlzZJ+MGAADeC/L3AApr3759ys3NVXR0tMf06Ohobd68ucBlUlJSCpw/JSWlwPkzMzP16KOPqk+fPqdseVlZWcrKynI/Tk9PL+xqAACAM1Bi9rAUt5ycHF1//fUyM73xxhunnHf06NGKiIhw/8TFxZ2lUQIAUDaVmMISFRWlwMBApaamekxPTU1VTExMgcv
|
||
|
"text/plain": [
|
||
|
"<Figure size 600x400 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAhQAAAGiCAYAAAC/AV8QAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/bCgiHAAAACXBIWXMAAA9hAAAPYQGoP6dpAABo4UlEQVR4nO3dd1iT5/oH8G9C2HsrgqIo4kQU98I60arVqkdrW1cdra1a257qr8vaYe3pcFZt6+6y51itte6qddaNe4GoKCqyd4Dk+f2BCeAEXpI34/u5Lq5zEkJ4cjfgzfPez30rhBACRERERBIo5V4AERERmT8mFERERCQZEwoiIiKSjAkFERERScaEgoiIiCRjQkFERESSMaEgIiIiyZhQEBERkWRMKIiIiEgyJhREZNEUCgVeffVVuZdBZPGYUBCZoBUrVkChUOg/HBwcEBoaildffRV37tyRe3mVkpiYiBkzZiAmJuaJjy392h/3sXv3boOvm4jKRyX3Aojo0WbOnInatWsjPz8f+/btw6JFi7Bp0yacOXMGTk5Oci+vQhITE/Hhhx8iODgYzZo1e+xjV69eXeb2qlWrsH379gfub9CgQVUvk4gqiQkFkQmLjo5GZGQkAOCll16Ct7c3vvrqK/z+++8YNmzYQ78mJycHzs7OxlxmlXv++efL3P7nn3+wffv2B+4nItPBSx5EZuSpp54CAMTHxwMARo4cCRcXF8TFxaF3795wdXXF8OHDARQnFm+88QaCgoJgb2+P+vXr44svvsD9A4Z1NQb//e9/0bBhQzg6OqJt27Y4ffo0AGDJkiWoW7cuHBwcEBUVhatXr5b5+qioKDRu3BjHjh1Du3bt4OjoiNq1a2Px4sX6x+zevRstW7YEAIwaNUp/yWLFihWVjkV5X9/DfPzxx1AqlZg/f77+vs2bN6Njx45wdnaGq6sr+vTpg7Nnz5b5Ol28b968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IiIgkY0JBREREkjGhICIiIslYQ0FERESScYeCiIiIJGNCQURERJJZfGMrrVaLxMREuLq6VmnrXyIiIksnhEBWVhYCAgKe2EPF4hOKxMTEByYmEhERUfklJCQ8MNX4fhafUOjGGyckJDwwhpiIiIgeLTMzE0FBQfp/Sx/H4hMK3WUONzc3JhRERESVUJ6SARZlEhERkWRMKIiIiEgyJhREREQkGRMKIiIikowJBREREUkma0KxZ88e9O3bFwEBAVAoFFi/fn2Zz8+YMQNhYWFwdnaGp6cnunXrhkOHDsmzWCIiInokWROKnJwchIeHY+HChQ/9fGhoKBYsWIDTp09j3759CA4ORo8ePXD37l0jr5SIiIgex2SmjSoUCqxbtw7PPPPMIx+TmZkJd3d37NixA127di3X8+q+JiMjg30oiIiIKqAi/4aaTQ1FQUEBvv32W7i7uyM8PFzu5RCRBdBqBbacuYXt5+7IvRQis2fynTI3btyIoUOHIjc3F9WrV8f27dvh4+PzyMer1Wqo1Wr97czMTGMsk4jMzN7LdzFr0wWcu5UJpQI48V4PuDvZyr0sIrNl8jsUXbp0QUxMDA4cOIBevXphyJAhSEpKeuTjZ82aBXd3d/0HB4MRUWlnbmbghaWH8MLSwzh3q/gPDq0A7mbny7wyIvNm8gmFs7Mz6tatizZt2mDp0qVQqVRYunTpIx8/ffp0ZGRk6D8SEhKMuFoiMlUJqbmY/MsJPD1/H/ZeToatjQKj29dGgLsDACA1p1DmFRKZN5O/5HE/rVZb5pLG/ezt7WFvb2/EFRGRKUvLKcCCXbFYffAaCjRaAED/ZgF4s0d9BHk54URCGhIz8pGWWyDzSonMm6wJRXZ
|
||
|
"text/plain": [
|
||
|
"<Figure size 600x400 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAhMAAAGiCAYAAABd3URpAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcn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1IoHABYuXAiJRIJ+/fpV5+XopGfPnrCyssLixYu1RjiWLVuG/Pz8R+bf2dkZe/bsgbu7O3r16oX4+HgAgLu7O7p164Yff/wRaWlpD93vwSWf1ZGbm/vQyIumGRhf6mCGhkcmGNOjRo0aYe3atXjxxRcRGhqq1QHz2LFj2LBhA8aNGwcAaNWqFcaOHYuffvoJeXl56Nq1K06dOoVVq1ZhyJAhePbZZ/Uam42NDXbv3o2xY8ciMjISu3btwl9//YX3338fDRo0qPJ+8+fPx8GDBxEZGYlJkyahWbNmyMnJQWxsLPbt24ecnBzhtbu4uOCHH36Ao6Mj7O3tERkZiaCgoIcec+DAgXj22WfxwQcfICEhAa1atcLevXuxdetWTJs2TWuyZW1p0KABZs6ciTlz5qBv374YNGgQ4uLi8P3336Ndu3Z46aWXHnm/+vXr4++//0bnzp3Rs2dPHD16FD4+PliyZAk6d+6MsLAwTJo0CQ0bNkRGRgaOHz+O5ORknD9/vkbxrVq1Ct9//z2GDh2KRo0aobCwED///DOcnJyEQpQxgyHWMhLGTNn169dp0qRJFBgYSFZWVuTo6EidOnWib7/9VmvpoEKhoDlz5lBQUBBZWlqSn58fzZw5U+scIvXS0P79+z/0PABoypQpWsdu375NAOjLL78Ujo0dO5b
|
||
|
"text/plain": [
|
||
|
"<Figure size 600x400 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAhMAAAGiCAYAAABd3URpAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/bCgiHAAAACXBIWXMAAA9hAAAPYQGoP6dpAABvb0lEQVR4nO3dd3iTVfsH8G9GFx0p3XRRdoEWKLsUENlDZMrLUFmCCqKA45WfKIoK4vsqIiL6IpShOJAhIkNAQGRvKKNsWjqhpbtJ0+T8/igJVEBakvTJ+H6uq5f2SfLkzk3a3D3POfeRCSEEiIiIiB6RXOoAiIiIyLaxmCAiIiKTsJggIiIik7CYICIiIpOwmCAiIiKTsJggIiIik7CYICIiIpOwmCAiIiKTsJggIiIik7CYICKT7dy5EzKZDDt37qyS55PJZHjppZeq5LmI6OFYTBDZKJlMVqGvinzAz5o1C+vWrbOZeInIuiilDoCIHs2KFSvKfb98+XJs3br1nuMNGzZ86LlmzZqFwYMHo3///uYMsRxzxktE1oXFBJGNevrpp8t9v3//fmzduvWe49bC1uIloorjZQ4iO1ZYWIhXX30VYWFhcHFxQYMGDfDf//4Xd28WLJPJUFhYiGXLlhkvNYwaNQoAcO3aNUyYMAENGjSAm5sbfH198dRTT+Hq1auSxfsgH3zwAeRyOebPn288tmnTJnTo0AHu7u7w9PREnz59cPr06XKPGzVqFDw8PJCSkoL+/fvDw8MD/v7+eO2116DT6crd94cffkCLFi3g6ekJLy8vREdHY968eeZ58UQ2jCMTRHZKCIEnn3wSO3bswNixY9GsWTNs2bIFr7/+OlJSUjB37lwAZZcfnnvuObRu3Rrjx48HANSpUwcAcOjQIezduxdDhw5FaGgorl69ioULF6JTp044c+YMqlWrVuXx3s/06dMxa9YsfP311xg3bpzxdY0cORI9evTAnDlzUFRUhIULF6J9+/Y4duwYIiIijI/X6XTo0aMH2rRpg//+97/Ytm0bPvnkE9SpUwcvvvgiAGDr1q0YNmwYunTpgjlz5gAAzp49iz179uCVV14xWx6IbJIgIrswceJEcfeP9Lp16wQA8cEHH5S73+DBg4VMJhMXL140HnN3dxcjR46855xFRUX3HNu3b58AIJYvX248tmPHDgFA7Nixo0riBSAmTpwohBDi1VdfFXK5XCxdutR4e35+vvD29hbjxo0rd6709HShUqnKHR85cqQAIGbOnFnuvjExMaJFixbG71955RXh5eUlSktLK/waiRwFL3MQ2amNGzdCoVDg5ZdfLnf81VdfhRACmzZteug53NzcjP+v1WqRlZWFunXrwtvbG0ePHpU0XiEEXnrpJcybNw/ffvstRo4cab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yGEMN5HCIF33nkHNWrUgJubG7p27YoLFy5IGDURETma389kICWnGD7uzujXLOQf72vshOlAKzokLSbmzJmDhQsX4osvvsDZs2cxZ84cfPzxx5g/f77xPh9//DE+//xzfPXVVzhw4ADc3d3Ro0cPqNVqCSMnIiJHYlgOOqJNOFydFP94X8Py0NMOtKJDKeWT7927F/369UOfPn0AABEREfj+++9x8OBBAGWjEp999hmmT5+Ofv36AQCWL1+OwMBArFu3DkOHDpUsdiIicgwnknNw+NotOClkeKZtzYfeP+r2ZY4LmfkoLtHBzfmfiw97IOnIRLt27bB9+3acP38eAHDixAn89ddf6NWrFwDgypUrSE9PR9euXY2PUalUaNOmDfbt2ydJzERE5FgMrbP7NglGgJfrQ+8f6OUKf08X6AVwNt0xRickHZl48803kZeXh8jISCgUCuh0Onz44YcYMWIEACA9PR0
|
||
|
"text/plain": [
|
||
|
"<Figure size 600x400 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"# Helper function to create a graph using matplotlib.\n",
|
||
|
"def plot(data, title):\n",
|
||
1 year ago
|
" data = json.loads(data)\n",
|
||
|
"\n",
|
||
|
" # Extract x and y values from the data\n",
|
||
|
" timestamps = [item[\"time\"] for item in data]\n",
|
||
|
" dates = [dt.datetime.fromtimestamp(ts) for ts in timestamps]\n",
|
||
|
" y = [item[\"value\"] for item in data]\n",
|
||
|
"\n",
|
||
|
" plt.rcParams[\"figure.figsize\"] = [6, 4]\n",
|
||
|
" plt.subplots_adjust(bottom=0.2)\n",
|
||
|
" plt.xticks(rotation=25)\n",
|
||
|
" ax = plt.gca()\n",
|
||
|
" xfmt = md.DateFormatter(\"%Y-%m-%d %H:%M:%S\")\n",
|
||
|
" ax.xaxis.set_major_formatter(xfmt)\n",
|
||
1 year ago
|
"\n",
|
||
1 year ago
|
" # Create the plot\n",
|
||
|
" plt.plot(dates, y)\n",
|
||
1 year ago
|
"\n",
|
||
1 year ago
|
" # Set labels and title\n",
|
||
|
" plt.xlabel(\"Time\")\n",
|
||
|
" plt.ylabel(\"Value\")\n",
|
||
|
" plt.title(title)\n",
|
||
1 year ago
|
"\n",
|
||
1 year ago
|
" plt.show()\n",
|
||
1 year ago
|
"\n",
|
||
|
"\n",
|
||
|
"response = client.search_ts(\"__name__\", \"latency\", 0, int(time.time()))\n",
|
||
|
"plot(response.text, \"Latency\")\n",
|
||
|
"\n",
|
||
|
"response = client.search_ts(\"__name__\", \"error\", 0, int(time.time()))\n",
|
||
|
"plot(response.text, \"Errors\")\n",
|
||
|
"\n",
|
||
|
"response = client.search_ts(\"__name__\", \"prompt_tokens\", 0, int(time.time()))\n",
|
||
|
"plot(response.text, \"Prompt Tokens\")\n",
|
||
|
"\n",
|
||
|
"response = client.search_ts(\"__name__\", \"completion_tokens\", 0, int(time.time()))\n",
|
||
|
"plot(response.text, \"Completion Tokens\")\n",
|
||
|
"\n",
|
||
|
"response = client.search_ts(\"__name__\", \"total_tokens\", 0, int(time.time()))\n",
|
||
1 year ago
|
"plot(response.text, \"Total Tokens\")"
|
||
1 year ago
|
]
|
||
|
},
|
||
|
{
|
||
|
"attachments": {},
|
||
|
"cell_type": "markdown",
|
||
|
"id": "c3d61822-1781-4bc6-97a2-2abc5c2b2e75",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## Full text query on prompt or prompt outputs."
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 20,
|
||
|
"id": "a0f051f0-e2bc-44e7-8dfb-bfd5bbd0fc9f",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"Results for normandy : [{\"time\":1686821979,\"fields\":{\"prompt\":\"In what country is Normandy located?\"},\"text\":\"In what country is Normandy located?\"},{\"time\":1686821982,\"fields\":{\"prompt_response\":\"\\n\\nNormandy is located in France.\"},\"text\":\"\\n\\nNormandy is located in France.\"},{\"time\":1686821984,\"fields\":{\"prompt_response\":\"\\n\\nThe Normans first settled in Normandy in the late 9th century.\"},\"text\":\"\\n\\nThe Normans first settled in Normandy in the late 9th century.\"},{\"time\":1686821993,\"fields\":{\"prompt\":\"Who gave their name to Normandy in the 1000's and 1100's\"},\"text\":\"Who gave their name to Normandy in the 1000's and 1100's\"},{\"time\":1686821997,\"fields\":{\"prompt_response\":\"\\n\\nThe Normans, a people from northern France, gave their name to Normandy in the 1000s and 1100s. The Normans were descended from Viking settlers who had come to the region in the late 800s.\"},\"text\":\"\\n\\nThe Normans, a people from northern France, gave their name to Normandy in the 1000s and 1100s. The Normans were descended from Viking settlers who had come to the region in the late 800s.\"}]\n",
|
||
|
"===\n",
|
||
|
"Results for king charles III : [{\"time\":1686821998,\"fields\":{\"prompt\":\"Who did King Charles III swear fealty to?\"},\"text\":\"Who did King Charles III swear fealty to?\"},{\"time\":1686822000,\"fields\":{\"prompt_response\":\"\\n\\nKing Charles III swore fealty to Pope Innocent III.\"},\"text\":\"\\n\\nKing Charles III swore fealty to Pope Innocent III.\"}]\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"# Search for a particular prompt text.\n",
|
||
|
"query = \"normandy\"\n",
|
||
|
"response = client.search_log(query, 0, int(time.time()))\n",
|
||
|
"print(\"Results for\", query, \":\", response.text)\n",
|
||
|
"\n",
|
||
|
"print(\"===\")\n",
|
||
|
"\n",
|
||
|
"query = \"king charles III\"\n",
|
||
|
"response = client.search_log(\"king charles III\", 0, int(time.time()))\n",
|
||
1 year ago
|
"print(\"Results for\", query, \":\", response.text)"
|
||
1 year ago
|
]
|
||
|
},
|
||
|
{
|
||
|
"attachments": {},
|
||
|
"cell_type": "markdown",
|
||
|
"id": "4b171074-c775-48e0-a4b3-f550e2c8eccb",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## Step 5: Stop infino server"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 21,
|
||
|
"id": "147663cb-b88f-4cfb-9726-7231dbec7cc1",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"infino-example\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"!docker rm -f infino-example"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"id": "86f36c49-53a3-460d-b74b-995cda7726b3",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": []
|
||
|
}
|
||
|
],
|
||
|
"metadata": {
|
||
|
"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.4"
|
||
|
}
|
||
|
},
|
||
|
"nbformat": 4,
|
||
|
"nbformat_minor": 5
|
||
|
}
|