{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "93b6fd90",
   "metadata": {},
   "outputs": [],
   "source": [
    "from pprint import pprint\n",
    "import json\n",
    "\n",
    "from src.config import settings"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "b7799967",
   "metadata": {},
   "outputs": [],
   "source": [
    "with open(settings.external_path / \"total_data_cleaned_python.json\", 'r') as f:\n",
    "    api_pack_dataset = json.load(f)\n",
    "\n",
    "with open(settings.external_path / \"huggingface_train.json\", \"r\", encoding=\"utf-8\") as f:\n",
    "    api_bench_dataset = [json.loads(line) for line in f if line.strip()]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "7c625700",
   "metadata": {},
   "outputs": [],
   "source": [
    "api_bench_dataset"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "842a09dc",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "('import http.client\\n'\n",
      " '\\n'\n",
      " 'conn = http.client.HTTPConnection(\"undefinedhttps\")\\n'\n",
      " '\\n'\n",
      " 'headers = {\\n'\n",
      " '    \\'X-RapidAPI-Key\\': \"SOME_STRING_VALUE\",\\n'\n",
      " '    \\'X-RapidAPI-Host\\': \"SOME_STRING_VALUE\"\\n'\n",
      " '    }\\n'\n",
      " '\\n'\n",
      " 'conn.request(\"GET\", '\n",
      " '\"//climatechange1.p.rapidapi.com/news/%7Bnewspapercode%7D?newspapercode=SOME_STRING_VALUE\", '\n",
      " 'headers=headers)\\n'\n",
      " '\\n'\n",
      " 'res = conn.getresponse()\\n'\n",
      " 'data = res.read()\\n'\n",
      " '\\n'\n",
      " 'print(data.decode(\"utf-8\"))')\n"
     ]
    }
   ],
   "source": [
    "pprint(api_pack_dataset[3111][\"api_call_data\"][\"api_call\"])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "1638cb7c",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(\"**domain**:['Shipment']\\n\"\n",
      " '**api_call**:import http.client\\n'\n",
      " '\\n'\n",
      " 'conn = http.client.HTTPSConnection(\"null\")\\n'\n",
      " '\\n'\n",
      " 'headers = { \\'Authorization\\': \"REPLACE_KEY_VALUE\" }\\n'\n",
      " '\\n'\n",
      " 'conn.request(\"GET\", '\n",
      " '\"/business.hema.digital/fulfillment/v2/salesorders/975680088608/consignments/19a5095f-4c99-4ed6-bc35-1e358b127ad4/shipments/378020893722472149\", '\n",
      " 'headers=headers)\\n'\n",
      " '\\n'\n",
      " 'res = conn.getresponse()\\n'\n",
      " 'data = res.read()\\n'\n",
      " '\\n'\n",
      " 'print(data.decode(\"utf-8\"))\\n'\n",
      " '**api_provider**:\\n'\n",
      " '**lang**:Python')\n"
     ]
    }
   ],
   "source": [
    "pprint(api_pack_dataset[7][\"output\"])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "1979cadb",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "assistance-engine",
   "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.11.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
