File size: 2,796 Bytes
0b48c77
 
 
 
 
 
 
 
 
 
 
62aa559
0b48c77
 
 
 
 
 
 
 
 
 
 
 
 
62aa559
0b48c77
 
 
 
 
 
 
 
 
 
62aa559
0b48c77
 
 
62aa559
 
 
0b48c77
 
62aa559
0b48c77
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62aa559
0b48c77
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "                                     "
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Results saved to data/en_qa_output.xlsx\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "\r"
     ]
    }
   ],
   "source": [
    "from autotab import AutoTab\n",
    "\n",
    "\n",
    "autotab = AutoTab(\n",
    "    in_file_path=\"data/en_qa_input.xlsx\",\n",
    "    out_file_path=\"data/en_qa_output.xlsx\",\n",
    "    instruction=\"You should help me classify the questions and answer them.\",\n",
    "    max_examples=5,\n",
    "    model_name=\"Qwen/Qwen2-7B-Instruct\",\n",
    "    generation_config={\"temperature\": 0, \"max_tokens\": 128},\n",
    "    request_interval=0.01,\n",
    "    api_keys=[\"sk-exhahhjfqyanmwewndukcqtrpegfdbwszkjucvcpajdufiah\"],\n",
    "    base_url=\"https://public-beta-api.siliconflow.cn/v1\",\n",
    "    save_every=10,\n",
    ")\n",
    "autotab.run()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "You should help me classify the questions and answer them.\n",
      "\n",
      "<Question>What is the capital of France?</Question>\n",
      "<Category>Geography</Category>\n",
      "<Answer>Paris</Answer>\n",
      "\n",
      "<Question>Who wrote '1984'?</Question>\n",
      "<Category>Literature</Category>\n",
      "<Answer>George Orwell</Answer>\n",
      "\n",
      "<Question>What is the largest planet in the solar system?</Question>\n",
      "<Category>Astronomy</Category>\n",
      "<Answer>Jupiter</Answer>\n",
      "\n",
      "<Question>Who painted the Mona Lisa?</Question>\n",
      "<Category>Art</Category>\n",
      "<Answer>Leonardo da Vinci</Answer>\n",
      "\n",
      "<Question>What is the currency of Japan?</Question>\n",
      "<Category>Economics</Category>\n",
      "<Answer>Yen</Answer>\n",
      "\n",
      "<Question>Who is the first president of the United States?</Question>\n",
      "\n"
     ]
    }
   ],
   "source": [
    "print(autotab.query_example)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "common",
   "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.12.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}