{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "initial_id", "metadata": { "collapsed": true, "ExecuteTime": { "end_time": "2024-07-19T18:01:57.555057Z", "start_time": "2024-07-19T18:01:56.787958Z" } }, "outputs": [], "source": [ "import os\n", "from openai import OpenAI\n", "import json\n", "from tqdm.notebook import tqdm\n", "import time\n" ] }, { "cell_type": "code", "outputs": [], "source": [ "client = OpenAI(api_key=\"\")\n" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2024-07-19T18:01:57.631011Z", "start_time": "2024-07-19T18:01:57.555134Z" } }, "id": "1e970ed2a0baa46", "execution_count": 2 }, { "cell_type": "code", "outputs": [ { "data": { "text/plain": "74" }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data = []\n", "with open(\"./data.json\", \"r\") as f:\n", " for line in f:\n", " data.append(eval(line))\n", " \n", "len(data)" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2024-07-19T18:02:36.093888Z", "start_time": "2024-07-19T18:02:36.053872Z" } }, "id": "84e9bb7a73b6963d", "execution_count": 4 }, { "cell_type": "code", "outputs": [], "source": [ "MODEL_LIMITS = {\n", " \"gpt-3.5-turbo-0125\": 16_385,\n", " \"gpt-4-turbo-2024-04-09\": 128_000,\n", " \"gpt-4o-2024-05-13\": 128_000\n", "}\n", "\n", "# The cost per token for each model input.\n", "MODEL_COST_PER_INPUT = {\n", " \"gpt-3.5-turbo-0125\": 0.0000005,\n", " \"gpt-4-turbo-2024-04-09\": 0.00001,\n", " \"gpt-4o-2024-05-13\": 0.000005\n", "}\n", "\n", "# The cost per token for each model output.\n", "MODEL_COST_PER_OUTPUT = {\n", " \"gpt-3.5-turbo-0125\": 0.0000015,\n", " \"gpt-4-turbo-2024-04-09\": 0.00003,\n", " \"gpt-4o-2024-05-13\": 0.000015\n", "}\n", "\n" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2024-07-19T18:14:43.897176Z", "start_time": "2024-07-19T18:14:43.861428Z" } }, "id": "60f0e21cfbcb050f", "execution_count": 26 }, { "cell_type": "code", "outputs": [ { "data": { "text/plain": " 0%| | 0/32 [00:00