Skip to content

Commit

Permalink
Update ChatGPT_sentiment_analysis_benchmark.ipynb
Browse files Browse the repository at this point in the history
  • Loading branch information
BruceYanghy committed Jun 19, 2023
1 parent 0f19b0e commit 6c6c8a8
Showing 1 changed file with 27 additions and 8 deletions.
35 changes: 27 additions & 8 deletions fingpt/FinGPT_sentiment/ChatGPT_sentiment_analysis_benchmark.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"cell_type": "code",
"execution_count": 4,
"id": "734ab037",
"id": "b9b73f4a",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -22,7 +22,7 @@
{
"cell_type": "code",
"execution_count": 5,
"id": "85fc3896",
"id": "eda9905a",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -33,7 +33,7 @@
{
"cell_type": "code",
"execution_count": 6,
"id": "d6f2f32e",
"id": "39b452e1",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -46,7 +46,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "9c3cadd0",
"id": "dca22c73",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -56,16 +56,16 @@
},
{
"cell_type": "code",
"execution_count": 7,
"id": "057d076a",
"execution_count": 9,
"id": "6c3427fd",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 8,
"id": "fa210088",
"id": "566e9dca",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -83,10 +83,29 @@
" return process_inputs, labels "
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "4c0f2fc6",
"metadata": {},
"outputs": [],
"source": [
"#ChatGPT API\n",
"def chat_with_gpt(prompt):\n",
" response=openai.ChatCompletion.create(\n",
" model='gpt-3.5-turbo',\n",
" messages=[\n",
" {\"role\":\"system\", \"content\":\"Hello\"},\n",
" {\"role\": \"user\",\"content\":prompt}\n",
" ]\n",
" )\n",
" return response.choices[0].message.content.strip()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "75b6e93f",
"id": "4726f043",
"metadata": {},
"outputs": [],
"source": []
Expand Down

0 comments on commit 6c6c8a8

Please sign in to comment.