{ "cells": [ { "cell_type": "code", "execution_count": 28, "id": "f4650160", "metadata": {}, "outputs": [], "source": [ "from openai import OpenAI\n", "from dotenv import load_dotenv \n", "import os\n", "import glob\n", "import json\n", "import pandas as pd\n", "# print(\"✅ pandas 导入成功\")\n", "load_dotenv()\n", "\n", "client = OpenAI(base_url=os.getenv(\"BAILIAN_API_BASE_URL\"),\n", " api_key=os.getenv(\"BAILIAN_API_KEY\"))" ] }, { "cell_type": "code", "execution_count": 29, "id": "90e1e786", "metadata": {}, "outputs": [], "source": [ "from pandas.io.sql import com\n", "\n", "\n", "def generate_response(\n", " # user_input,\n", " model,\n", " messages,\n", " # tools,\n", " # system_prompt\n", "):\n", " try:\n", " completion = client.chat.completions.create(\n", " model=model, # 通过参数传递\n", " # model=\"qwen3-32b\",\n", " # messages=[\n", " # {\"role\": \"system\", \"content\": system_prompt},\n", " # {\"role\": \"user\", \"content\": user_input}\n", " # ]\n", " messages=messages,\n", " tools=[\n", " {\n", " \"type\": \"function\",\n", " \"function\": {\n", " \"name\": \"sentiment_analysis\",\n", " \"description\": \"判断文本情感(positive/negative)并给出原因\",\n", " \"parameters\": {\n", " \"type\": \"object\",\n", " \"properties\": {\n", " \"sentiment\": {\n", " \"type\": \"string\",\n", " \"enum\": [\"positive\", \"negative\"],\n", " },\n", " \"reason\": {\"type\": \"string\"},\n", " },\n", " \"required\": [\"sentiment\", \"reason\"],\n", " },\n", " },\n", " }\n", " ],\n", " tool_choice=\"auto\", \n", " # max_tokens=0, # 关键:禁止生成任何文本\n", " # tool_choice={\"type\": \"function\", \"function\": {\"name\": \"current_emotion_negative\"}}, # 关键参数:强制调用指定工具\n", " extra_body={\"enable_thinking\": False},\n", " temperature=0.1,\n", " )\n", " # print('completioncompletioncompletion', completion)\n", " # return completion.choices[0].message.content\n", " return completion\n", " except Exception as e:\n", " print(f\"最终失败: {str(e)}\"),\n", "\n", " return \"调用失败\"" ] }, { "cell_type": "code", "execution_count": 30, "id": "df68fdf2", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "文件总数: 121\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\0_2.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", "当前一共检验了1段文字,负面情绪1,正面情绪0: 内容拖沓,角色不吸引人\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\100_4.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", "当前一共检验了2段文字,负面情绪2,正面情绪0: 内容拖沓,角色不吸引人\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\101_3.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", "当前一共检验了3段文字,负面情绪3,正面情绪0: 内容拖沓,角色不吸引人\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\102_4.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", "当前一共检验了4段文字,负面情绪4,正面情绪0: 内容拖沓,角色不吸引人\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\103_3.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", "当前一共检验了5段文字,负面情绪5,正面情绪0: 内容拖沓,角色不吸引人\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\104_1.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", "当前一共检验了6段文字,负面情绪6,正面情绪0: 内容拖沓,角色不吸引人\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\105_3.txt\n", "content {\"sentiment\": \"positive\", \"reason\": \"The user provided a positive review of the movie, highlighting its affordability, slow story, humor, and poor gore, which are all favorable aspects.\"}\n", "当前一共检验了7段文字,负面情绪6,正面情绪1: The user provided a positive review of the movie, highlighting its affordability, slow story, humor, and poor gore, which are all favorable aspects.\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\106_3.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", "当前一共检验了8段文字,负面情绪7,正面情绪1: 内容拖沓,角色不吸引人\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\107_4.txt\n", "content {\"sentiment\": \"positive\", \"reason\": \"The user expressed positive sentiment about the movie, highlighting its good aspects like good acting, atmosphere, and gore, while acknowledging some flaws. They also mentioned a low-budget origin but still enjoyed it.\"}\n", "当前一共检验了9段文字,负面情绪7,正面情绪2: The user expressed positive sentiment about the movie, highlighting its good aspects like good acting, atmosphere, and gore, while acknowledging some flaws. They also mentioned a low-budget origin but still enjoyed it.\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\108_2.txt\n", "content {\"sentiment\": \"positive\", \"reason\": \"用户表达了对电影内容的赞赏,提到了角色和情节,并强调了对导演和演员的感激之情。\"}\n", "当前一共检验了10段文字,负面情绪7,正面情绪3: 用户表达了对电影内容的赞赏,提到了角色和情节,并强调了对导演和演员的感激之情。\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\109_4.txt\n", "content {\"sentiment\": \"positive\", \"reason\": \"The film is described as mildly enjoyable, with a focus on the emotional depth and character development of its main characters, even though it's considered somewhat predictable and corny.\"}\n", "当前一共检验了11段文字,负面情绪7,正面情绪4: The film is described as mildly enjoyable, with a focus on the emotional depth and character development of its main characters, even though it's considered somewhat predictable and corny.\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\10_3.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", "当前一共检验了12段文字,负面情绪8,正面情绪4: 内容拖沓,角色不吸引人\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\110_1.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", "当前一共检验了13段文字,负面情绪9,正面情绪4: 内容拖沓,角色不吸引人\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\111_3.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", "当前一共检验了14段文字,负面情绪10,正面情绪4: 内容拖沓,角色不吸引人\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\112_2.txt\n", "content {\"sentiment\": \"positive\", \"reason\": \"The user expresses positive sentiment about the Italian horror film, highlighting its cheesiness, amateur quality, and enjoyment of the content despite some negative aspects. The overall tone is appreciative and enthusiastic.\"}\n", "当前一共检验了15段文字,负面情绪10,正面情绪5: The user expresses positive sentiment about the Italian horror film, highlighting its cheesiness, amateur quality, and enjoyment of the content despite some negative aspects. The overall tone is appreciative and enthusiastic.\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\113_3.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", "当前一共检验了16段文字,负面情绪11,正面情绪5: 内容拖沓,角色不吸引人\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\114_2.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", "当前一共检验了17段文字,负面情绪12,正面情绪5: 内容拖沓,角色不吸引人\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\115_3.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", "当前一共检验了18段文字,负面情绪13,正面情绪5: 内容拖沓,角色不吸引人\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\116_4.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", "当前一共检验了19段文字,负面情绪14,正面情绪5: 内容拖沓,角色不吸引人\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\117_1.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", "当前一共检验了20段文字,负面情绪15,正面情绪5: 内容拖沓,角色不吸引人\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\118_1.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", "当前一共检验了21段文字,负面情绪16,正面情绪5: 内容拖沓,角色不吸引人\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\119_3.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", "当前一共检验了22段文字,负面情绪17,正面情绪5: 内容拖沓,角色不吸引人\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\11_3.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", "当前一共检验了23段文字,负面情绪18,正面情绪5: 内容拖沓,角色不吸引人\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\120_2.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", "当前一共检验了24段文字,负面情绪19,正面情绪5: 内容拖沓,角色不吸引人\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\12_4.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", "当前一共检验了25段文字,负面情绪20,正面情绪5: 内容拖沓,角色不吸引人\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\13_1.txt\n", "content {\"sentiment\": \"positive\", \"reason\": \"The text presents a compelling narrative with themes of love, redemption, and heroism, while highlighting the characters' motivations and emotional depth. It also includes specific examples that evoke strong emotional responses, making it likely a positive sentiment.\"}\n", "当前一共检验了26段文字,负面情绪20,正面情绪6: The text presents a compelling narrative with themes of love, redemption, and heroism, while highlighting the characters' motivations and emotional depth. It also includes specific examples that evoke strong emotional responses, making it likely a positive sentiment.\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\14_1.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", "当前一共检验了27段文字,负面情绪21,正面情绪6: 内容拖沓,角色不吸引人\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\15_2.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", "当前一共检验了28段文字,负面情绪22,正面情绪6: 内容拖沓,角色不吸引人\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\16_1.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", "当前一共检验了29段文字,负面情绪23,正面情绪6: 内容拖沓,角色不吸引人\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\17_3.txt\n", "content {\"sentiment\": \"positive\", \"reason\": \"The user expresses positive sentiment about the film, appreciating its content and comparisons to other works, while acknowledging the film's clichés and lack of fresh ground in the vampire genre.\"}\n", "当前一共检验了30段文字,负面情绪23,正面情绪7: The user expresses positive sentiment about the film, appreciating its content and comparisons to other works, while acknowledging the film's clichés and lack of fresh ground in the vampire genre.\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\18_1.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", "当前一共检验了31段文字,负面情绪24,正面情绪7: 内容拖沓,角色不吸引人\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\19_1.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", "当前一共检验了32段文字,负面情绪25,正面情绪7: 内容拖沓,角色不吸引人\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\1_3.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", "当前一共检验了33段文字,负面情绪26,正面情绪7: 内容拖沓,角色不吸引人\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\20_1.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", "当前一共检验了34段文字,负面情绪27,正面情绪7: 内容拖沓,角色不吸引人\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\21_1.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", "当前一共检验了35段文字,负面情绪28,正面情绪7: 内容拖沓,角色不吸引人\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\22_3.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", "当前一共检验了36段文字,负面情绪29,正面情绪7: 内容拖沓,角色不吸引人\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\23_4.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", "当前一共检验了37段文字,负面情绪30,正面情绪7: 内容拖沓,角色不吸引人\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\24_4.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", "当前一共检验了38段文字,负面情绪31,正面情绪7: 内容拖沓,角色不吸引人\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\25_3.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", "当前一共检验了39段文字,负面情绪32,正面情绪7: 内容拖沓,角色不吸引人\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\26_3.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", "当前一共检验了40段文字,负面情绪33,正面情绪7: 内容拖沓,角色不吸引人\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\27_4.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", "当前一共检验了41段文字,负面情绪34,正面情绪7: 内容拖沓,角色不吸引人\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\28_3.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", "当前一共检验了42段文字,负面情绪35,正面情绪7: 内容拖沓,角色不吸引人\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\29_3.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"The text discusses the mediocrity of 'Cover Girl', highlighting the lack of development in Gene Kelly's character and the exploitation of women in Hollywood, as well as the negative portrayal of Rita Hayworth.\"}\n", "当前一共检验了43段文字,负面情绪36,正面情绪7: The text discusses the mediocrity of 'Cover Girl', highlighting the lack of development in Gene Kelly's character and the exploitation of women in Hollywood, as well as the negative portrayal of Rita Hayworth.\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\2_3.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", "当前一共检验了44段文字,负面情绪37,正面情绪7: 内容拖沓,角色不吸引人\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\30_4.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", "当前一共检验了45段文字,负面情绪38,正面情绪7: 内容拖沓,角色不吸引人\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\31_4.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", "当前一共检验了46段文字,负面情绪39,正面情绪7: 内容拖沓,角色不吸引人\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\32_3.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", "当前一共检验了47段文字,负面情绪40,正面情绪7: 内容拖沓,角色不吸引人\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\33_3.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", "当前一共检验了48段文字,负面情绪41,正面情绪7: 内容拖沓,角色不吸引人\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\34_1.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", "当前一共检验了49段文字,负面情绪42,正面情绪7: 内容拖沓,角色不吸引人\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\35_1.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", "当前一共检验了50段文字,负面情绪43,正面情绪7: 内容拖沓,角色不吸引人\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\36_3.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", "当前一共检验了51段文字,负面情绪44,正面情绪7: 内容拖沓,角色不吸引人\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\37_1.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", "当前一共检验了52段文字,负面情绪45,正面情绪7: 内容拖沓,角色不吸引人\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\38_1.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", "当前一共检验了53段文字,负面情绪46,正面情绪7: 内容拖沓,角色不吸引人\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\39_3.txt\n", "content {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", "当前一共检验了54段文字,负面情绪47,正面情绪7: 内容拖沓,角色不吸引人\n", "找到文件: ../data/acllmdb_sentiment_small/negative\\3_4.txt\n" ] }, { "ename": "KeyboardInterrupt", "evalue": "", "output_type": "error", "traceback": [ "\u001b[31m---------------------------------------------------------------------------\u001b[39m", "\u001b[31mKeyboardInterrupt\u001b[39m Traceback (most recent call last)", "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[30]\u001b[39m\u001b[32m, line 115\u001b[39m\n\u001b[32m 110\u001b[39m \u001b[38;5;66;03m# except Exception as e:\u001b[39;00m\n\u001b[32m 111\u001b[39m \u001b[38;5;66;03m# print(f\"解析失败:{e}\")\u001b[39;00m\n\u001b[32m 112\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m\n\u001b[32m--> \u001b[39m\u001b[32m115\u001b[39m \u001b[43mfind_text_in_target\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n", "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[30]\u001b[39m\u001b[32m, line 58\u001b[39m, in \u001b[36mfind_text_in_target\u001b[39m\u001b[34m()\u001b[39m\n\u001b[32m 56\u001b[39m model = \u001b[33m\"\u001b[39m\u001b[33mqwen3-0.6b\u001b[39m\u001b[33m\"\u001b[39m\n\u001b[32m 57\u001b[39m \u001b[38;5;66;03m# 调用时传入全局变量\u001b[39;00m\n\u001b[32m---> \u001b[39m\u001b[32m58\u001b[39m response = \u001b[43mgenerate_response\u001b[49m\u001b[43m(\u001b[49m\n\u001b[32m 59\u001b[39m \u001b[43m \u001b[49m\u001b[38;5;66;43;03m# user_input=\"你好!\",\u001b[39;49;00m\n\u001b[32m 60\u001b[39m \u001b[43m \u001b[49m\u001b[43mmodel\u001b[49m\u001b[43m=\u001b[49m\u001b[43mmodel\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 61\u001b[39m \u001b[43m \u001b[49m\u001b[38;5;66;43;03m# model=\"qwen3-32b\",\u001b[39;49;00m\n\u001b[32m 62\u001b[39m \u001b[43m \u001b[49m\u001b[43mmessages\u001b[49m\u001b[43m=\u001b[49m\u001b[43mmessages_dict\u001b[49m\u001b[43m[\u001b[49m\u001b[43mmodel\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 63\u001b[39m \u001b[43m \u001b[49m\u001b[38;5;66;43;03m# system_prompt=GLOBAL_PROMPT\u001b[39;49;00m\n\u001b[32m 64\u001b[39m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 65\u001b[39m \u001b[38;5;66;03m# .choices[0].finish_reason\u001b[39;00m\n\u001b[32m 66\u001b[39m \u001b[38;5;66;03m# if response.conte\u001b[39;00m\n\u001b[32m 67\u001b[39m \u001b[38;5;66;03m# print(response)\u001b[39;00m\n\u001b[32m 68\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m response == \u001b[33m\"\u001b[39m\u001b[33m调用失败\u001b[39m\u001b[33m\"\u001b[39m:\n", "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[29]\u001b[39m\u001b[32m, line 12\u001b[39m, in \u001b[36mgenerate_response\u001b[39m\u001b[34m(model, messages)\u001b[39m\n\u001b[32m 4\u001b[39m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[34mgenerate_response\u001b[39m(\n\u001b[32m 5\u001b[39m \u001b[38;5;66;03m# user_input,\u001b[39;00m\n\u001b[32m 6\u001b[39m model,\n\u001b[32m (...)\u001b[39m\u001b[32m 9\u001b[39m \u001b[38;5;66;03m# system_prompt\u001b[39;00m\n\u001b[32m 10\u001b[39m ):\n\u001b[32m 11\u001b[39m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[32m---> \u001b[39m\u001b[32m12\u001b[39m completion = \u001b[43mclient\u001b[49m\u001b[43m.\u001b[49m\u001b[43mchat\u001b[49m\u001b[43m.\u001b[49m\u001b[43mcompletions\u001b[49m\u001b[43m.\u001b[49m\u001b[43mcreate\u001b[49m\u001b[43m(\u001b[49m\n\u001b[32m 13\u001b[39m \u001b[43m \u001b[49m\u001b[43mmodel\u001b[49m\u001b[43m=\u001b[49m\u001b[43mmodel\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;66;43;03m# 通过参数传递\u001b[39;49;00m\n\u001b[32m 14\u001b[39m \u001b[43m \u001b[49m\u001b[38;5;66;43;03m# model=\"qwen3-32b\",\u001b[39;49;00m\n\u001b[32m 15\u001b[39m \u001b[43m \u001b[49m\u001b[38;5;66;43;03m# messages=[\u001b[39;49;00m\n\u001b[32m 16\u001b[39m \u001b[43m \u001b[49m\u001b[38;5;66;43;03m# {\"role\": \"system\", \"content\": system_prompt},\u001b[39;49;00m\n\u001b[32m 17\u001b[39m \u001b[43m \u001b[49m\u001b[38;5;66;43;03m# {\"role\": \"user\", \"content\": user_input}\u001b[39;49;00m\n\u001b[32m 18\u001b[39m \u001b[43m \u001b[49m\u001b[38;5;66;43;03m# ]\u001b[39;49;00m\n\u001b[32m 19\u001b[39m \u001b[43m \u001b[49m\u001b[43mmessages\u001b[49m\u001b[43m=\u001b[49m\u001b[43mmessages\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 20\u001b[39m \u001b[43m \u001b[49m\u001b[43mtools\u001b[49m\u001b[43m=\u001b[49m\u001b[43m[\u001b[49m\n\u001b[32m 21\u001b[39m \u001b[43m \u001b[49m\u001b[43m{\u001b[49m\n\u001b[32m 22\u001b[39m \u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mtype\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mfunction\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[32m 23\u001b[39m \u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mfunction\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43m{\u001b[49m\n\u001b[32m 24\u001b[39m \u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mname\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43msentiment_analysis\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[32m 25\u001b[39m \u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mdescription\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43m判断文本情感(positive/negative)并给出原因\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[32m 26\u001b[39m \u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mparameters\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43m{\u001b[49m\n\u001b[32m 27\u001b[39m \u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mtype\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mobject\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[32m 28\u001b[39m \u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mproperties\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43m{\u001b[49m\n\u001b[32m 29\u001b[39m \u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43msentiment\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43m{\u001b[49m\n\u001b[32m 30\u001b[39m \u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mtype\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mstring\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[32m 31\u001b[39m \u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43menum\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43m[\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mpositive\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mnegative\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 32\u001b[39m \u001b[43m \u001b[49m\u001b[43m}\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 33\u001b[39m \u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mreason\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43m{\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mtype\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mstring\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m}\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 34\u001b[39m \u001b[43m \u001b[49m\u001b[43m}\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 35\u001b[39m \u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mrequired\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43m[\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43msentiment\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mreason\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 36\u001b[39m \u001b[43m \u001b[49m\u001b[43m}\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 37\u001b[39m \u001b[43m \u001b[49m\u001b[43m}\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 38\u001b[39m \u001b[43m \u001b[49m\u001b[43m}\u001b[49m\n\u001b[32m 39\u001b[39m \u001b[43m \u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 40\u001b[39m \u001b[43m \u001b[49m\u001b[43mtool_choice\u001b[49m\u001b[43m=\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mauto\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\n\u001b[32m 41\u001b[39m \u001b[43m \u001b[49m\u001b[38;5;66;43;03m# max_tokens=0, # 关键:禁止生成任何文本\u001b[39;49;00m\n\u001b[32m 42\u001b[39m \u001b[43m \u001b[49m\u001b[38;5;66;43;03m# tool_choice={\"type\": \"function\", \"function\": {\"name\": \"current_emotion_negative\"}}, # 关键参数:强制调用指定工具\u001b[39;49;00m\n\u001b[32m 43\u001b[39m \u001b[43m \u001b[49m\u001b[43mextra_body\u001b[49m\u001b[43m=\u001b[49m\u001b[43m{\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43menable_thinking\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m}\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 44\u001b[39m \u001b[43m \u001b[49m\u001b[43mtemperature\u001b[49m\u001b[43m=\u001b[49m\u001b[32;43m0.1\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[32m 45\u001b[39m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 46\u001b[39m \u001b[38;5;66;03m# print('completioncompletioncompletion', completion)\u001b[39;00m\n\u001b[32m 47\u001b[39m \u001b[38;5;66;03m# return completion.choices[0].message.content\u001b[39;00m\n\u001b[32m 48\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m completion\n", "\u001b[36mFile \u001b[39m\u001b[32md:\\pythonai\\ai_learning\\.venv\\Lib\\site-packages\\openai\\_utils\\_utils.py:287\u001b[39m, in \u001b[36mrequired_args..inner..wrapper\u001b[39m\u001b[34m(*args, **kwargs)\u001b[39m\n\u001b[32m 285\u001b[39m msg = \u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[33mMissing required argument: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mquote(missing[\u001b[32m0\u001b[39m])\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m\"\u001b[39m\n\u001b[32m 286\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mTypeError\u001b[39;00m(msg)\n\u001b[32m--> \u001b[39m\u001b[32m287\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfunc\u001b[49m\u001b[43m(\u001b[49m\u001b[43m*\u001b[49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m*\u001b[49m\u001b[43m*\u001b[49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", "\u001b[36mFile \u001b[39m\u001b[32md:\\pythonai\\ai_learning\\.venv\\Lib\\site-packages\\openai\\resources\\chat\\completions\\completions.py:1087\u001b[39m, in \u001b[36mCompletions.create\u001b[39m\u001b[34m(self, messages, model, audio, frequency_penalty, function_call, functions, logit_bias, logprobs, max_completion_tokens, max_tokens, metadata, modalities, n, parallel_tool_calls, prediction, presence_penalty, reasoning_effort, response_format, seed, service_tier, stop, store, stream, stream_options, temperature, tool_choice, tools, top_logprobs, top_p, user, web_search_options, extra_headers, extra_query, extra_body, timeout)\u001b[39m\n\u001b[32m 1044\u001b[39m \u001b[38;5;129m@required_args\u001b[39m([\u001b[33m\"\u001b[39m\u001b[33mmessages\u001b[39m\u001b[33m\"\u001b[39m, \u001b[33m\"\u001b[39m\u001b[33mmodel\u001b[39m\u001b[33m\"\u001b[39m], [\u001b[33m\"\u001b[39m\u001b[33mmessages\u001b[39m\u001b[33m\"\u001b[39m, \u001b[33m\"\u001b[39m\u001b[33mmodel\u001b[39m\u001b[33m\"\u001b[39m, \u001b[33m\"\u001b[39m\u001b[33mstream\u001b[39m\u001b[33m\"\u001b[39m])\n\u001b[32m 1045\u001b[39m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[34mcreate\u001b[39m(\n\u001b[32m 1046\u001b[39m \u001b[38;5;28mself\u001b[39m,\n\u001b[32m (...)\u001b[39m\u001b[32m 1084\u001b[39m timeout: \u001b[38;5;28mfloat\u001b[39m | httpx.Timeout | \u001b[38;5;28;01mNone\u001b[39;00m | NotGiven = NOT_GIVEN,\n\u001b[32m 1085\u001b[39m ) -> ChatCompletion | Stream[ChatCompletionChunk]:\n\u001b[32m 1086\u001b[39m validate_response_format(response_format)\n\u001b[32m-> \u001b[39m\u001b[32m1087\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_post\u001b[49m\u001b[43m(\u001b[49m\n\u001b[32m 1088\u001b[39m \u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43m/chat/completions\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[32m 1089\u001b[39m \u001b[43m \u001b[49m\u001b[43mbody\u001b[49m\u001b[43m=\u001b[49m\u001b[43mmaybe_transform\u001b[49m\u001b[43m(\u001b[49m\n\u001b[32m 1090\u001b[39m \u001b[43m \u001b[49m\u001b[43m{\u001b[49m\n\u001b[32m 1091\u001b[39m \u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mmessages\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mmessages\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1092\u001b[39m \u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mmodel\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mmodel\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1093\u001b[39m \u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43maudio\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43maudio\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1094\u001b[39m \u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mfrequency_penalty\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mfrequency_penalty\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1095\u001b[39m \u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mfunction_call\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mfunction_call\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1096\u001b[39m \u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mfunctions\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mfunctions\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1097\u001b[39m \u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mlogit_bias\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mlogit_bias\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1098\u001b[39m \u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mlogprobs\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mlogprobs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1099\u001b[39m \u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mmax_completion_tokens\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mmax_completion_tokens\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1100\u001b[39m \u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mmax_tokens\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mmax_tokens\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1101\u001b[39m \u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mmetadata\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mmetadata\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1102\u001b[39m \u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mmodalities\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mmodalities\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1103\u001b[39m \u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mn\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mn\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1104\u001b[39m \u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mparallel_tool_calls\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mparallel_tool_calls\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1105\u001b[39m \u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mprediction\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mprediction\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1106\u001b[39m \u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mpresence_penalty\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mpresence_penalty\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1107\u001b[39m \u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mreasoning_effort\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mreasoning_effort\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1108\u001b[39m \u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mresponse_format\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mresponse_format\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1109\u001b[39m \u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mseed\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mseed\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1110\u001b[39m \u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mservice_tier\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mservice_tier\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1111\u001b[39m \u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mstop\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mstop\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1112\u001b[39m \u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mstore\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mstore\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1113\u001b[39m \u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mstream\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mstream\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1114\u001b[39m \u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mstream_options\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mstream_options\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1115\u001b[39m \u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mtemperature\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mtemperature\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1116\u001b[39m \u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mtool_choice\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mtool_choice\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1117\u001b[39m \u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mtools\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mtools\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1118\u001b[39m \u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mtop_logprobs\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mtop_logprobs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1119\u001b[39m \u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mtop_p\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mtop_p\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1120\u001b[39m \u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43muser\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43muser\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1121\u001b[39m \u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mweb_search_options\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mweb_search_options\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1122\u001b[39m \u001b[43m \u001b[49m\u001b[43m}\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1123\u001b[39m \u001b[43m \u001b[49m\u001b[43mcompletion_create_params\u001b[49m\u001b[43m.\u001b[49m\u001b[43mCompletionCreateParamsStreaming\u001b[49m\n\u001b[32m 1124\u001b[39m \u001b[43m \u001b[49m\u001b[38;5;28;43;01mif\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mstream\u001b[49m\n\u001b[32m 1125\u001b[39m \u001b[43m \u001b[49m\u001b[38;5;28;43;01melse\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mcompletion_create_params\u001b[49m\u001b[43m.\u001b[49m\u001b[43mCompletionCreateParamsNonStreaming\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1126\u001b[39m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1127\u001b[39m \u001b[43m \u001b[49m\u001b[43moptions\u001b[49m\u001b[43m=\u001b[49m\u001b[43mmake_request_options\u001b[49m\u001b[43m(\u001b[49m\n\u001b[32m 1128\u001b[39m \u001b[43m \u001b[49m\u001b[43mextra_headers\u001b[49m\u001b[43m=\u001b[49m\u001b[43mextra_headers\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mextra_query\u001b[49m\u001b[43m=\u001b[49m\u001b[43mextra_query\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mextra_body\u001b[49m\u001b[43m=\u001b[49m\u001b[43mextra_body\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtimeout\u001b[49m\u001b[43m=\u001b[49m\u001b[43mtimeout\u001b[49m\n\u001b[32m 1129\u001b[39m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1130\u001b[39m \u001b[43m \u001b[49m\u001b[43mcast_to\u001b[49m\u001b[43m=\u001b[49m\u001b[43mChatCompletion\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1131\u001b[39m \u001b[43m \u001b[49m\u001b[43mstream\u001b[49m\u001b[43m=\u001b[49m\u001b[43mstream\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;129;43;01mor\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[32m 1132\u001b[39m \u001b[43m \u001b[49m\u001b[43mstream_cls\u001b[49m\u001b[43m=\u001b[49m\u001b[43mStream\u001b[49m\u001b[43m[\u001b[49m\u001b[43mChatCompletionChunk\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 1133\u001b[39m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", "\u001b[36mFile \u001b[39m\u001b[32md:\\pythonai\\ai_learning\\.venv\\Lib\\site-packages\\openai\\_base_client.py:1249\u001b[39m, in \u001b[36mSyncAPIClient.post\u001b[39m\u001b[34m(self, path, cast_to, body, options, files, stream, stream_cls)\u001b[39m\n\u001b[32m 1235\u001b[39m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[34mpost\u001b[39m(\n\u001b[32m 1236\u001b[39m \u001b[38;5;28mself\u001b[39m,\n\u001b[32m 1237\u001b[39m path: \u001b[38;5;28mstr\u001b[39m,\n\u001b[32m (...)\u001b[39m\u001b[32m 1244\u001b[39m stream_cls: \u001b[38;5;28mtype\u001b[39m[_StreamT] | \u001b[38;5;28;01mNone\u001b[39;00m = \u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[32m 1245\u001b[39m ) -> ResponseT | _StreamT:\n\u001b[32m 1246\u001b[39m opts = FinalRequestOptions.construct(\n\u001b[32m 1247\u001b[39m method=\u001b[33m\"\u001b[39m\u001b[33mpost\u001b[39m\u001b[33m\"\u001b[39m, url=path, json_data=body, files=to_httpx_files(files), **options\n\u001b[32m 1248\u001b[39m )\n\u001b[32m-> \u001b[39m\u001b[32m1249\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m cast(ResponseT, \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m(\u001b[49m\u001b[43mcast_to\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mopts\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstream\u001b[49m\u001b[43m=\u001b[49m\u001b[43mstream\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstream_cls\u001b[49m\u001b[43m=\u001b[49m\u001b[43mstream_cls\u001b[49m\u001b[43m)\u001b[49m)\n", "\u001b[36mFile \u001b[39m\u001b[32md:\\pythonai\\ai_learning\\.venv\\Lib\\site-packages\\openai\\_base_client.py:972\u001b[39m, in \u001b[36mSyncAPIClient.request\u001b[39m\u001b[34m(self, cast_to, options, stream, stream_cls)\u001b[39m\n\u001b[32m 970\u001b[39m response = \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[32m 971\u001b[39m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[32m--> \u001b[39m\u001b[32m972\u001b[39m response = \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_client\u001b[49m\u001b[43m.\u001b[49m\u001b[43msend\u001b[49m\u001b[43m(\u001b[49m\n\u001b[32m 973\u001b[39m \u001b[43m \u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 974\u001b[39m \u001b[43m \u001b[49m\u001b[43mstream\u001b[49m\u001b[43m=\u001b[49m\u001b[43mstream\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;129;43;01mor\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_should_stream_response_body\u001b[49m\u001b[43m(\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m=\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 975\u001b[39m \u001b[43m \u001b[49m\u001b[43m*\u001b[49m\u001b[43m*\u001b[49m\u001b[43mkwargs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 976\u001b[39m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 977\u001b[39m \u001b[38;5;28;01mexcept\u001b[39;00m httpx.TimeoutException \u001b[38;5;28;01mas\u001b[39;00m err:\n\u001b[32m 978\u001b[39m log.debug(\u001b[33m\"\u001b[39m\u001b[33mEncountered httpx.TimeoutException\u001b[39m\u001b[33m\"\u001b[39m, exc_info=\u001b[38;5;28;01mTrue\u001b[39;00m)\n", "\u001b[36mFile \u001b[39m\u001b[32md:\\pythonai\\ai_learning\\.venv\\Lib\\site-packages\\httpx\\_client.py:914\u001b[39m, in \u001b[36mClient.send\u001b[39m\u001b[34m(self, request, stream, auth, follow_redirects)\u001b[39m\n\u001b[32m 910\u001b[39m \u001b[38;5;28mself\u001b[39m._set_timeout(request)\n\u001b[32m 912\u001b[39m auth = \u001b[38;5;28mself\u001b[39m._build_request_auth(request, auth)\n\u001b[32m--> \u001b[39m\u001b[32m914\u001b[39m response = \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_send_handling_auth\u001b[49m\u001b[43m(\u001b[49m\n\u001b[32m 915\u001b[39m \u001b[43m \u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 916\u001b[39m \u001b[43m \u001b[49m\u001b[43mauth\u001b[49m\u001b[43m=\u001b[49m\u001b[43mauth\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 917\u001b[39m \u001b[43m \u001b[49m\u001b[43mfollow_redirects\u001b[49m\u001b[43m=\u001b[49m\u001b[43mfollow_redirects\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 918\u001b[39m \u001b[43m \u001b[49m\u001b[43mhistory\u001b[49m\u001b[43m=\u001b[49m\u001b[43m[\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 919\u001b[39m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 920\u001b[39m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[32m 921\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m stream:\n", "\u001b[36mFile \u001b[39m\u001b[32md:\\pythonai\\ai_learning\\.venv\\Lib\\site-packages\\httpx\\_client.py:942\u001b[39m, in \u001b[36mClient._send_handling_auth\u001b[39m\u001b[34m(self, request, auth, follow_redirects, history)\u001b[39m\n\u001b[32m 939\u001b[39m request = \u001b[38;5;28mnext\u001b[39m(auth_flow)\n\u001b[32m 941\u001b[39m \u001b[38;5;28;01mwhile\u001b[39;00m \u001b[38;5;28;01mTrue\u001b[39;00m:\n\u001b[32m--> \u001b[39m\u001b[32m942\u001b[39m response = \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_send_handling_redirects\u001b[49m\u001b[43m(\u001b[49m\n\u001b[32m 943\u001b[39m \u001b[43m \u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 944\u001b[39m \u001b[43m \u001b[49m\u001b[43mfollow_redirects\u001b[49m\u001b[43m=\u001b[49m\u001b[43mfollow_redirects\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 945\u001b[39m \u001b[43m \u001b[49m\u001b[43mhistory\u001b[49m\u001b[43m=\u001b[49m\u001b[43mhistory\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 946\u001b[39m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 947\u001b[39m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[32m 948\u001b[39m \u001b[38;5;28;01mtry\u001b[39;00m:\n", "\u001b[36mFile \u001b[39m\u001b[32md:\\pythonai\\ai_learning\\.venv\\Lib\\site-packages\\httpx\\_client.py:979\u001b[39m, in \u001b[36mClient._send_handling_redirects\u001b[39m\u001b[34m(self, request, follow_redirects, history)\u001b[39m\n\u001b[32m 976\u001b[39m \u001b[38;5;28;01mfor\u001b[39;00m hook \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m._event_hooks[\u001b[33m\"\u001b[39m\u001b[33mrequest\u001b[39m\u001b[33m\"\u001b[39m]:\n\u001b[32m 977\u001b[39m hook(request)\n\u001b[32m--> \u001b[39m\u001b[32m979\u001b[39m response = \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_send_single_request\u001b[49m\u001b[43m(\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 980\u001b[39m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[32m 981\u001b[39m \u001b[38;5;28;01mfor\u001b[39;00m hook \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m._event_hooks[\u001b[33m\"\u001b[39m\u001b[33mresponse\u001b[39m\u001b[33m\"\u001b[39m]:\n", "\u001b[36mFile \u001b[39m\u001b[32md:\\pythonai\\ai_learning\\.venv\\Lib\\site-packages\\httpx\\_client.py:1014\u001b[39m, in \u001b[36mClient._send_single_request\u001b[39m\u001b[34m(self, request)\u001b[39m\n\u001b[32m 1009\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mRuntimeError\u001b[39;00m(\n\u001b[32m 1010\u001b[39m \u001b[33m\"\u001b[39m\u001b[33mAttempted to send an async request with a sync Client instance.\u001b[39m\u001b[33m\"\u001b[39m\n\u001b[32m 1011\u001b[39m )\n\u001b[32m 1013\u001b[39m \u001b[38;5;28;01mwith\u001b[39;00m request_context(request=request):\n\u001b[32m-> \u001b[39m\u001b[32m1014\u001b[39m response = \u001b[43mtransport\u001b[49m\u001b[43m.\u001b[49m\u001b[43mhandle_request\u001b[49m\u001b[43m(\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 1016\u001b[39m \u001b[38;5;28;01massert\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(response.stream, SyncByteStream)\n\u001b[32m 1018\u001b[39m response.request = request\n", "\u001b[36mFile \u001b[39m\u001b[32md:\\pythonai\\ai_learning\\.venv\\Lib\\site-packages\\httpx\\_transports\\default.py:250\u001b[39m, in \u001b[36mHTTPTransport.handle_request\u001b[39m\u001b[34m(self, request)\u001b[39m\n\u001b[32m 237\u001b[39m req = httpcore.Request(\n\u001b[32m 238\u001b[39m method=request.method,\n\u001b[32m 239\u001b[39m url=httpcore.URL(\n\u001b[32m (...)\u001b[39m\u001b[32m 247\u001b[39m extensions=request.extensions,\n\u001b[32m 248\u001b[39m )\n\u001b[32m 249\u001b[39m \u001b[38;5;28;01mwith\u001b[39;00m map_httpcore_exceptions():\n\u001b[32m--> \u001b[39m\u001b[32m250\u001b[39m resp = \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_pool\u001b[49m\u001b[43m.\u001b[49m\u001b[43mhandle_request\u001b[49m\u001b[43m(\u001b[49m\u001b[43mreq\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 252\u001b[39m \u001b[38;5;28;01massert\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(resp.stream, typing.Iterable)\n\u001b[32m 254\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m Response(\n\u001b[32m 255\u001b[39m status_code=resp.status,\n\u001b[32m 256\u001b[39m headers=resp.headers,\n\u001b[32m 257\u001b[39m stream=ResponseStream(resp.stream),\n\u001b[32m 258\u001b[39m extensions=resp.extensions,\n\u001b[32m 259\u001b[39m )\n", "\u001b[36mFile \u001b[39m\u001b[32md:\\pythonai\\ai_learning\\.venv\\Lib\\site-packages\\httpcore\\_sync\\connection_pool.py:256\u001b[39m, in \u001b[36mConnectionPool.handle_request\u001b[39m\u001b[34m(self, request)\u001b[39m\n\u001b[32m 253\u001b[39m closing = \u001b[38;5;28mself\u001b[39m._assign_requests_to_connections()\n\u001b[32m 255\u001b[39m \u001b[38;5;28mself\u001b[39m._close_connections(closing)\n\u001b[32m--> \u001b[39m\u001b[32m256\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m exc \u001b[38;5;28;01mfrom\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[32m 258\u001b[39m \u001b[38;5;66;03m# Return the response. Note that in this case we still have to manage\u001b[39;00m\n\u001b[32m 259\u001b[39m \u001b[38;5;66;03m# the point at which the response is closed.\u001b[39;00m\n\u001b[32m 260\u001b[39m \u001b[38;5;28;01massert\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(response.stream, typing.Iterable)\n", "\u001b[36mFile \u001b[39m\u001b[32md:\\pythonai\\ai_learning\\.venv\\Lib\\site-packages\\httpcore\\_sync\\connection_pool.py:236\u001b[39m, in \u001b[36mConnectionPool.handle_request\u001b[39m\u001b[34m(self, request)\u001b[39m\n\u001b[32m 232\u001b[39m connection = pool_request.wait_for_connection(timeout=timeout)\n\u001b[32m 234\u001b[39m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[32m 235\u001b[39m \u001b[38;5;66;03m# Send the request on the assigned connection.\u001b[39;00m\n\u001b[32m--> \u001b[39m\u001b[32m236\u001b[39m response = \u001b[43mconnection\u001b[49m\u001b[43m.\u001b[49m\u001b[43mhandle_request\u001b[49m\u001b[43m(\u001b[49m\n\u001b[32m 237\u001b[39m \u001b[43m \u001b[49m\u001b[43mpool_request\u001b[49m\u001b[43m.\u001b[49m\u001b[43mrequest\u001b[49m\n\u001b[32m 238\u001b[39m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 239\u001b[39m \u001b[38;5;28;01mexcept\u001b[39;00m ConnectionNotAvailable:\n\u001b[32m 240\u001b[39m \u001b[38;5;66;03m# In some cases a connection may initially be available to\u001b[39;00m\n\u001b[32m 241\u001b[39m \u001b[38;5;66;03m# handle a request, but then become unavailable.\u001b[39;00m\n\u001b[32m 242\u001b[39m \u001b[38;5;66;03m#\u001b[39;00m\n\u001b[32m 243\u001b[39m \u001b[38;5;66;03m# In this case we clear the connection and try again.\u001b[39;00m\n\u001b[32m 244\u001b[39m pool_request.clear_connection()\n", "\u001b[36mFile \u001b[39m\u001b[32md:\\pythonai\\ai_learning\\.venv\\Lib\\site-packages\\httpcore\\_sync\\connection.py:103\u001b[39m, in \u001b[36mHTTPConnection.handle_request\u001b[39m\u001b[34m(self, request)\u001b[39m\n\u001b[32m 100\u001b[39m \u001b[38;5;28mself\u001b[39m._connect_failed = \u001b[38;5;28;01mTrue\u001b[39;00m\n\u001b[32m 101\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m exc\n\u001b[32m--> \u001b[39m\u001b[32m103\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_connection\u001b[49m\u001b[43m.\u001b[49m\u001b[43mhandle_request\u001b[49m\u001b[43m(\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m)\u001b[49m\n", "\u001b[36mFile \u001b[39m\u001b[32md:\\pythonai\\ai_learning\\.venv\\Lib\\site-packages\\httpcore\\_sync\\http11.py:136\u001b[39m, in \u001b[36mHTTP11Connection.handle_request\u001b[39m\u001b[34m(self, request)\u001b[39m\n\u001b[32m 134\u001b[39m \u001b[38;5;28;01mwith\u001b[39;00m Trace(\u001b[33m\"\u001b[39m\u001b[33mresponse_closed\u001b[39m\u001b[33m\"\u001b[39m, logger, request) \u001b[38;5;28;01mas\u001b[39;00m trace:\n\u001b[32m 135\u001b[39m \u001b[38;5;28mself\u001b[39m._response_closed()\n\u001b[32m--> \u001b[39m\u001b[32m136\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m exc\n", "\u001b[36mFile \u001b[39m\u001b[32md:\\pythonai\\ai_learning\\.venv\\Lib\\site-packages\\httpcore\\_sync\\http11.py:106\u001b[39m, in \u001b[36mHTTP11Connection.handle_request\u001b[39m\u001b[34m(self, request)\u001b[39m\n\u001b[32m 95\u001b[39m \u001b[38;5;28;01mpass\u001b[39;00m\n\u001b[32m 97\u001b[39m \u001b[38;5;28;01mwith\u001b[39;00m Trace(\n\u001b[32m 98\u001b[39m \u001b[33m\"\u001b[39m\u001b[33mreceive_response_headers\u001b[39m\u001b[33m\"\u001b[39m, logger, request, kwargs\n\u001b[32m 99\u001b[39m ) \u001b[38;5;28;01mas\u001b[39;00m trace:\n\u001b[32m 100\u001b[39m (\n\u001b[32m 101\u001b[39m http_version,\n\u001b[32m 102\u001b[39m status,\n\u001b[32m 103\u001b[39m reason_phrase,\n\u001b[32m 104\u001b[39m headers,\n\u001b[32m 105\u001b[39m trailing_data,\n\u001b[32m--> \u001b[39m\u001b[32m106\u001b[39m ) = \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_receive_response_headers\u001b[49m\u001b[43m(\u001b[49m\u001b[43m*\u001b[49m\u001b[43m*\u001b[49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 107\u001b[39m trace.return_value = (\n\u001b[32m 108\u001b[39m http_version,\n\u001b[32m 109\u001b[39m status,\n\u001b[32m 110\u001b[39m reason_phrase,\n\u001b[32m 111\u001b[39m headers,\n\u001b[32m 112\u001b[39m )\n\u001b[32m 114\u001b[39m network_stream = \u001b[38;5;28mself\u001b[39m._network_stream\n", "\u001b[36mFile \u001b[39m\u001b[32md:\\pythonai\\ai_learning\\.venv\\Lib\\site-packages\\httpcore\\_sync\\http11.py:177\u001b[39m, in \u001b[36mHTTP11Connection._receive_response_headers\u001b[39m\u001b[34m(self, request)\u001b[39m\n\u001b[32m 174\u001b[39m timeout = timeouts.get(\u001b[33m\"\u001b[39m\u001b[33mread\u001b[39m\u001b[33m\"\u001b[39m, \u001b[38;5;28;01mNone\u001b[39;00m)\n\u001b[32m 176\u001b[39m \u001b[38;5;28;01mwhile\u001b[39;00m \u001b[38;5;28;01mTrue\u001b[39;00m:\n\u001b[32m--> \u001b[39m\u001b[32m177\u001b[39m event = \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_receive_event\u001b[49m\u001b[43m(\u001b[49m\u001b[43mtimeout\u001b[49m\u001b[43m=\u001b[49m\u001b[43mtimeout\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 178\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(event, h11.Response):\n\u001b[32m 179\u001b[39m \u001b[38;5;28;01mbreak\u001b[39;00m\n", "\u001b[36mFile \u001b[39m\u001b[32md:\\pythonai\\ai_learning\\.venv\\Lib\\site-packages\\httpcore\\_sync\\http11.py:217\u001b[39m, in \u001b[36mHTTP11Connection._receive_event\u001b[39m\u001b[34m(self, timeout)\u001b[39m\n\u001b[32m 214\u001b[39m event = \u001b[38;5;28mself\u001b[39m._h11_state.next_event()\n\u001b[32m 216\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m event \u001b[38;5;129;01mis\u001b[39;00m h11.NEED_DATA:\n\u001b[32m--> \u001b[39m\u001b[32m217\u001b[39m data = \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_network_stream\u001b[49m\u001b[43m.\u001b[49m\u001b[43mread\u001b[49m\u001b[43m(\u001b[49m\n\u001b[32m 218\u001b[39m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43mREAD_NUM_BYTES\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtimeout\u001b[49m\u001b[43m=\u001b[49m\u001b[43mtimeout\u001b[49m\n\u001b[32m 219\u001b[39m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 221\u001b[39m \u001b[38;5;66;03m# If we feed this case through h11 we'll raise an exception like:\u001b[39;00m\n\u001b[32m 222\u001b[39m \u001b[38;5;66;03m#\u001b[39;00m\n\u001b[32m 223\u001b[39m \u001b[38;5;66;03m# httpcore.RemoteProtocolError: can't handle event type\u001b[39;00m\n\u001b[32m (...)\u001b[39m\u001b[32m 227\u001b[39m \u001b[38;5;66;03m# perspective. Instead we handle this case distinctly and treat\u001b[39;00m\n\u001b[32m 228\u001b[39m \u001b[38;5;66;03m# it as a ConnectError.\u001b[39;00m\n\u001b[32m 229\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m data == \u001b[33mb\u001b[39m\u001b[33m\"\u001b[39m\u001b[33m\"\u001b[39m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m._h11_state.their_state == h11.SEND_RESPONSE:\n", "\u001b[36mFile \u001b[39m\u001b[32md:\\pythonai\\ai_learning\\.venv\\Lib\\site-packages\\httpcore\\_backends\\sync.py:128\u001b[39m, in \u001b[36mSyncStream.read\u001b[39m\u001b[34m(self, max_bytes, timeout)\u001b[39m\n\u001b[32m 126\u001b[39m \u001b[38;5;28;01mwith\u001b[39;00m map_exceptions(exc_map):\n\u001b[32m 127\u001b[39m \u001b[38;5;28mself\u001b[39m._sock.settimeout(timeout)\n\u001b[32m--> \u001b[39m\u001b[32m128\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_sock\u001b[49m\u001b[43m.\u001b[49m\u001b[43mrecv\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmax_bytes\u001b[49m\u001b[43m)\u001b[49m\n", "\u001b[31mKeyboardInterrupt\u001b[39m: " ] } ], "source": [ "txt_files = glob.glob(\"../data/acllmdb_sentiment_small/negative/*.txt\", recursive=True)\n", "\n", "# 存储所有结果的列表\n", "emotion_results = []\n", "\n", "json_schema = {\n", " \"type\": \"object\",\n", " \"properties\": {\n", " \"sentiment\": {\"type\": \"string\", \"enum\": [\"positive\", \"negative\"]},\n", " \"reason\": {\"type\": \"string\", \"maxLength\": 50},\n", " },\n", " \"required\": [\"sentiment\", \"reason\"],\n", "}\n", "\n", "print(\"文件总数:\", len(txt_files))\n", "\n", "magic_num_n = 0\n", "magic_num_p = 0\n", "\n", "\n", "def find_text_in_target():\n", " for index, file_path in enumerate(txt_files, start=0):\n", " print(f\"找到文件: {file_path}\")\n", " with open(file_path, \"r\", encoding=\"utf-8\") as f:\n", " # print(f\"内容片段:\\n{f.read(1000)}...\\n\")\n", " content = f.read(3000) # 读取前3000个字符\n", " # print('txt_filestxt_filestxt_files', txt_files[index])\n", "\n", " messages_qwen3_32b = [\n", " {\n", " \"role\": \"system\",\n", " \"content\": \"\"\"\n", " 你是一个很有帮助的助手。根据用户的输入内容,判断用户情绪是正面还是负面,并给出理由并且翻译为中文。\n", " 优先使用工具tools,按照工具格式输出 \n", " \"\"\",\n", " },\n", " {\"role\": \"user\", \"content\": f\"{content}\"}\n", " ]\n", " messages_qwen3_0_6b = [\n", " {\n", " \"role\": \"system\",\n", " \"content\": \"\"\"\n", " 你是一个很有帮助的助手。根据用户的输入内容,判断用户情绪是正面还是负面,并给出理由并且翻译为中文。\n", " 请严格按照如下 JSON 格式输出,不要输出任何多余的文字,所有属性名和字符串值都必须用英文双引号括起来。例如:\n", " {\"sentiment\": \"negative\", \"reason\": \"内容拖沓,角色不吸引人\"}\n", " \"\"\",\n", " },\n", " {\"role\": \"user\", \"content\": f\"{content}\"}\n", " ]\n", "\n", " messages_dict = {\n", " \"qwen3-32b\": messages_qwen3_32b,\n", " \"qwen3-0.6b\": messages_qwen3_0_6b\n", " }\n", " \n", " model = \"qwen3-0.6b\"\n", " # 调用时传入全局变量\n", " response = generate_response(\n", " # user_input=\"你好!\",\n", " model=model,\n", " # model=\"qwen3-32b\",\n", " messages=messages_dict[model],\n", " # system_prompt=GLOBAL_PROMPT\n", " )\n", " # .choices[0].finish_reason\n", " # if response.conte\n", " # print(response)\n", " if response == \"调用失败\":\n", " print(\"调用失败\")\n", " else:\n", " # try:\n", " if response.choices[0].finish_reason == \"tool_calls\":\n", " print(\"使用工具\")\n", " tool_call = response.choices[0].message.tool_calls[0]\n", " arguments = tool_call.function.arguments\n", " data = json.loads(arguments)\n", " sentiment = data[\"sentiment\"]\n", " reason = data[\"reason\"]\n", " else:\n", " content = response.choices[0].message.content\n", " print(\"content\", content)\n", " data = json.loads(content)\n", "\n", " # 兼容0.6b偶尔会自动使用工具,导致data为嵌套结构\n", " if \"arguments\" in data:\n", " data = data[\"arguments\"]\n", "\n", " sentiment = data[\"sentiment\"]\n", " reason = data[\"reason\"]\n", "\n", " emotion_results.append(\n", " {\n", " \"index\": index,\n", " \"file_path\": file_path,\n", " \"sentiment\": sentiment,\n", " \"reason\": reason,\n", " }\n", " )\n", "\n", " global magic_num_n\n", " global magic_num_p\n", "\n", " if sentiment == \"negative\":\n", " magic_num_n += 1\n", " elif sentiment == \"positive\":\n", " magic_num_p += 1\n", " print(\n", " f\"当前一共检验了{index+1}段文字,负面情绪{magic_num_n},正面情绪{magic_num_p}: {data['reason']}\"\n", " )\n", " # except Exception as e:\n", " # print(f\"解析失败:{e}\")\n", " return\n", "\n", "\n", "find_text_in_target()" ] }, { "cell_type": "code", "execution_count": null, "id": "0011355a", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "emotion_results [{'index': 0, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\0_2.txt', 'sentiment': 'negative', 'reason': '用户表达了对电影的不满,提到了电影拖沓、角色不吸引人以及缺乏悬念和情感投入。'}, {'index': 1, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\100_4.txt', 'sentiment': 'negative', 'reason': '用户表达了对电影的失望,特别是最后10分钟的情节和导演未能提供预期的深度。尽管提到了一些积极的方面,如演员和氛围,但整体情绪是负面的。'}, {'index': 2, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\101_3.txt', 'sentiment': 'negative', 'reason': '用户对电影的评价非常负面,提到了多个令人不愉快的元素,如角色行为不当、剧情缺乏解释以及整体体验不佳。'}, {'index': 3, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\102_4.txt', 'sentiment': 'negative', 'reason': '用户对电影的评价总体上是负面的,尽管一开始觉得预告片吸引人,但实际观看后感到困惑和沮丧。用户提到剧情复杂、角色介绍不足,并且在看完后感觉浪费了时间。'}, {'index': 4, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\103_3.txt', 'sentiment': 'negative', 'reason': '用户对电影《Nemesis Game》表达了强烈的不满,指出了多个不合理的情节和制作上的疏忽,如角色行为不合逻辑、情节设计牵强以及技术细节错误。这些负面评价表明用户的情绪是负面的。'}, {'index': 5, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\104_1.txt', 'sentiment': 'negative', 'reason': '用户对电影的评价非常负面,使用了诸如\"REALLY sucks\", \"utter pretentious cr4p\", \"horrible\", \"HORRIBLE\"等强烈负面词汇,并详细描述了他对电影情节、表演和氛围的不满。'}, {'index': 6, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\105_3.txt', 'sentiment': 'negative', 'reason': \"The text expresses dissatisfaction with the movie's quality, slow story, and poor gore effects. However, it ends with a slightly positive note suggesting it might be worth watching if one has time and doesn't expect a great horror film.\"}, {'index': 7, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\106_3.txt', 'sentiment': 'negative', 'reason': \"The text provides a detailed review of a film, highlighting both its strengths and weaknesses. The reviewer acknowledges the film's central idea and twist ending as positive aspects but criticizes it for being slow-paced, low-budget, and having long stretches of uneventful dialogue. The overall tone is mixed, leaning slightly negative due to the emphasis on the film's shortcomings.\"}, {'index': 8, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\107_4.txt', 'sentiment': 'negative', 'reason': '评论中提到了一些正面的元素,如享受Bill McGhee的表演和电影的开头和结尾不错。同时,也提到了一些负面因素,如中间部分拖沓、情节不紧凑以及角色做出愚蠢的决定。总体来看,评论者对这部电影有一定程度的欣赏,但也指出了明显的缺点。'}, {'index': 9, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\108_2.txt', 'sentiment': 'negative', 'reason': \"用户表达了对电影的极度不满和失望,使用了多个负面词汇如'blown chunks', 'raving Old Bag', 'insufferable Medusa'等,并多次提到后悔观看这些电影。\"}, {'index': 10, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\109_4.txt', 'sentiment': 'negative', 'reason': '评论中提到了电影的多个负面方面,如角色设定单一、剧情老套和表演平淡。尽管有轻微的享受感,但整体评价偏向负面。'}, {'index': 11, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\10_3.txt', 'sentiment': 'negative', 'reason': \"The text expresses strong dissatisfaction with the film 'Darling Lili,' describing it as 'terrible' and highlighting its flaws on multiple levels. The author criticizes the plot, character development, and overall effectiveness of the movie, indicating a negative sentiment.\"}, {'index': 12, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\110_1.txt', 'sentiment': 'negative', 'reason': '用户表达了对电影的失望,认为电影节奏缓慢且无趣,并对剧情和角色设定表示不满。'}, {'index': 13, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\111_3.txt', 'sentiment': 'negative', 'reason': '用户对这部电影的评价非常负面,认为它廉价、无聊且情节混乱。用户提到电影没有真正吓人之处,并表示观众不会错过什么,因为电影整体质量很差。'}, {'index': 14, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\112_2.txt', 'sentiment': 'negative', 'reason': '用户对意大利恐怖电影的评价非常负面,提到了许多负面因素,如质量差、效果不佳、配音糟糕等。'}, {'index': 15, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\113_3.txt', 'sentiment': 'negative', 'reason': '用户对电影的评价是负面的,提到了电影预算低、节奏慢、没有真正的惊喜,并且评分只有3分。'}, {'index': 16, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\114_2.txt', 'sentiment': 'negative', 'reason': \"The user expresses dissatisfaction with the movie, calling it 'pretty poor' and 'unfortunately boring.' They also criticize the plot, ending, and the misleading cover art of the video box.\"}, {'index': 17, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\115_3.txt', 'sentiment': 'negative', 'reason': \"The text expresses strong negative opinions about the movie, describing it as 'beyond lame' and highlighting its poor quality with examples of over-acted dialogue. The author also mentions renting the movie again for a party to laugh at how bad it was, further indicating a negative sentiment.\"}, {'index': 18, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\116_4.txt', 'sentiment': 'negative', 'reason': '用户对电影《Blind Date》的评价是负面的,因为用户指出了剧本的问题,并认为角色塑造不够深入。尽管用户认可演员的表现和制作价值,但整体上表达了不满。'}, {'index': 19, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\117_1.txt', 'sentiment': 'negative', 'reason': \"用户对电影的多个方面表达了强烈的不满,包括动作场面、演员表现、剧本和对话等。使用了如'awful', 'disaster', 'cheap low type of action cinema'等负面词汇,整体情绪明显是负面的。\"}, {'index': 20, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\118_1.txt', 'sentiment': 'negative', 'reason': \"用户使用了多个负面词汇如 'awful', 'bad', 'dire', 'terrible' 等,并表达了对电影的强烈不满,认为其灯光、剧本、剪辑等方面都非常糟糕。\"}, {'index': 21, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\119_3.txt', 'sentiment': 'negative', 'reason': '用户表达了对电影的强烈不满,认为电影质量差,浪费时间,并建议其他人不要观看。'}, {'index': 22, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\11_3.txt', 'sentiment': 'negative', 'reason': '评论中提到了电影的过度制作、不明确的基调以及演员表现不佳,整体评价较为负面。'}, {'index': 23, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\120_2.txt', 'sentiment': 'negative', 'reason': '用户表达了对电影的强烈不满,认为电影在各个方面都很糟糕,包括剧情、对话、剪辑和整体表演。用户还提到电影令人无聊且不合逻辑,并建议避免观看。'}, {'index': 24, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\12_4.txt', 'sentiment': 'negative', 'reason': '用户对这部电影的评价总体上是负面的,提到了许多问题,如角色化学反应不足、剧情混乱和幽默元素不恰当。然而,用户也提到了一些正面的方面,比如朱莉·安德鲁斯的美丽和她的歌声。但整体来看,负面因素更多。'}, {'index': 25, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\13_1.txt', 'sentiment': 'negative', 'reason': \"评论中使用了负面词汇和讽刺语气,如'obvious vanity press', 'can't even be described', 'I don't know and you won't either'等,表达了对电影内容和质量的不满。\"}, {'index': 26, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\14_1.txt', 'sentiment': 'negative', 'reason': '用户对电影的评价非常负面,提到了很多问题和不满,如角色选择不当、剧情令人厌烦,并建议观众避开这部电影。'}, {'index': 27, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\15_2.txt', 'sentiment': 'negative', 'reason': \"The text expresses strong dissatisfaction and disappointment with the movie 'Fire'. The user uses negative words like 'pretentious garbage', 'poor quality of film making', 'jarring', 'voyeuristic', and 'wooden' to describe various aspects of the movie. They also mention being upset and distressed, which indicates a negative sentiment.\"}, {'index': 28, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\16_1.txt', 'sentiment': 'negative', 'reason': '用户表达了对电影的极度失望,认为它不是一部好的恐怖片,缺乏悬念,并且觉得部分内容很无聊。同时提到这部电影让他的偶像形象受损,并建议喜欢导演其他作品的人不要浪费时间。'}, {'index': 29, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\17_3.txt', 'sentiment': 'negative', 'reason': '用户表达了对电影的失望,认为其陈词滥调且没有为吸血鬼题材带来新意。同时提到其他作品更为优秀,显示出负面情绪。'}, {'index': 30, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\18_1.txt', 'sentiment': 'negative', 'reason': '用户表达了对电影《Bloody Birthday》的强烈不满,认为其毫无可取之处,情节无聊、可预测,并且包含许多不合理和荒谬的情节。这表明用户的情绪是负面的。'}, {'index': 31, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\19_1.txt', 'sentiment': 'negative', 'reason': '用户对电影的多个方面表达了强烈的不满,包括角色设计、演员表现、剧情逻辑和配乐等。使用了如“cannot be serious”、“hate so much”、“slow, boring and a waste of time”等负面词汇,整体情绪明显为负面。'}, {'index': 32, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\1_3.txt', 'sentiment': 'negative', 'reason': '用户对电影的多个方面表达了不满,如角色之间的化学反应不足、对话生硬、情节陈腐等。虽然提到了一些正面元素(如对美国海岸警卫队的赞赏和动作场面的精彩),但整体上情绪是负面的。'}, {'index': 33, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\20_1.txt', 'sentiment': 'negative', 'reason': \"文本中使用了负面词汇如'mean spirited', 'repulsive', 'wasted'和'avoid',表达了对电影的不满和不推荐。\"}, {'index': 34, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\21_1.txt', 'sentiment': 'negative', 'reason': '用户对电影《Bloody Birthday》的评价非常负面,认为这是一部从头到尾都很糟糕的恐怖片。尽管提到了一些正面的元素(如演员表现和制片人的采访),但整体上用户表达了强烈的不满和失望。'}, {'index': 35, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\22_3.txt', 'sentiment': 'negative', 'reason': \"The text expresses dissatisfaction with the film 'Bloody Birthday', describing it as offensive, stupid, and poorly made. The author criticizes the lack of effective approach in making the film and mentions only a slight redemption through good performances from the kids.\"}, {'index': 36, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\23_4.txt', 'sentiment': 'negative', 'reason': '用户表达了对电影中孩子的强烈不满和愤怒,使用了负面词汇如\"annoying\", \"bratty\", \"slut\", \"evil bratty smile\"等,并且提到这部电影让他感到愤怒。'}, {'index': 37, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\24_4.txt', 'sentiment': 'positive', 'reason': 'The review mentions that the movie is \"odd and, at times, humorous\", \"mediocre as a horror flick\", and has \"few scares and little blood\". However, it also notes the movie\\'s uniqueness due to its concept of having kids as killers and suggests it is worth watching if there\\'s nothing else on. The overall tone is mixed but leans slightly towards a neutral or mildly positive sentiment.'}, {'index': 38, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\25_3.txt', 'sentiment': 'negative', 'reason': '文本中虽然提到了电影的多个负面评价,如情节老套、缺乏悬念和令人失望的结局,但同时也指出了一些正面因素,比如足够的裸露内容以保持观众注意力以及一些有趣的时刻。整体来看,作者对这部电影的态度偏向负面,因为主要强调的是其缺点,并且给出了较低的评分。'}, {'index': 39, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\26_3.txt', 'sentiment': 'negative', 'reason': \"评论中提到了一些正面元素,如'一点点血腥和一个不错的裸露场景可能会让该类型的铁杆粉丝觉得值得',但整体语气较为冷淡,并且评分较低(*1/2 out of ****),表明总体情绪偏向负面。\"}, {'index': 40, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\27_4.txt', 'sentiment': 'negative', 'reason': '评论中提到了电影缺乏吸引力,演员表现不佳,整体评价为C-,显示出负面情绪。'}, {'index': 41, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\28_3.txt', 'sentiment': 'negative', 'reason': \"评论中提到了很多负面元素,如'terribly tired piece of Technicolor cotton candy', 'unmemorable musical sketches', 'Kelly, as always, dances well but acts with false sincerity', 'The script is a lead weight'等,这些都表明了作者对这部电影的不满和批评。\"}, {'index': 42, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\29_3.txt', 'sentiment': 'negative', 'reason': \"The text expresses disappointment with the movie 'Cover Girl', describing it as 'mediocrity incarnate' and criticizing its plot, songs, and portrayal of Rita Hayworth. The author also highlights negative aspects of Hollywood's treatment of women, indicating an overall negative sentiment.\"}, {'index': 43, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\2_3.txt', 'sentiment': 'negative', 'reason': '用户对电影的评价非常负面,提到了电影的可预测性、糟糕的选角和缺乏深度的角色。'}, {'index': 44, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\30_4.txt', 'sentiment': 'negative', 'reason': '评论中提到了电影中的视觉效果和丽塔·海华丝的美貌,但同时也批评了其他演员的表现和剧情的不足。整体上,评论者对电影的整体评价不高,认为它除了展示丽塔·海华丝的美丽外,没有太多值得记忆的地方。'}, {'index': 45, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\31_4.txt', 'sentiment': 'negative', 'reason': '用户表达了对电影的不满,提到了拍摄预算低、演技和剪辑差、结尾拖沓等问题。'}, {'index': 46, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\32_3.txt', 'sentiment': 'negative', 'reason': \"The text expresses concern and criticism about the film's disturbing content and character behavior, indicating a negative sentiment.\"}, {'index': 47, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\33_3.txt', 'sentiment': 'negative', 'reason': \"文本中使用了负面词汇如'worst acting', 'first-grader with undiagnosed learning disabilities', 'fails to register any feeling or emotion', 'wasted time'等,表达了对电影及其演员和剧本的不满。\"}, {'index': 48, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\34_1.txt', 'sentiment': 'negative', 'reason': 'The text expresses strong dissatisfaction with the movie \\'Jacqueline Hyde,\\' calling it \"complete total & utter crap from start to finish\" and criticizing its plot, quality, and execution. The author also compares it unfavorably to other works and finds it dull and unenjoyable.'}, {'index': 49, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\35_1.txt', 'sentiment': 'negative', 'reason': '用户表达了对Maniratnam电影的不满,指出其缺乏创新和深度,并建议观众观看其他更好的电影。这表明了用户的负面情绪。'}, {'index': 50, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\36_3.txt', 'sentiment': 'negative', 'reason': '用户对电影的评价非常负面,提到了电影很无聊、缓慢,并且结尾令人难以置信。用户明确建议避免观看这部电影。'}, {'index': 51, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\37_1.txt', 'sentiment': 'negative', 'reason': 'The text expresses strong dissatisfaction with the film, describing it as \"probably the worst film I\\'ve ever seen\" and criticizing various aspects such as acting, script, effects, and the overall quality. The author also mentions being unable to believe the lack of pride in showing the film, indicating a negative sentiment.'}, {'index': 52, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\38_1.txt', 'sentiment': 'negative', 'reason': 'The text expresses strong dissatisfaction with the movie, describing it as \"trash\" and criticizing its acting, effects, and overall quality. The tone is negative throughout.'}, {'index': 53, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\39_3.txt', 'sentiment': 'negative', 'reason': \"The text expresses disappointment and criticism towards the film, highlighting its flaws and poor quality despite acknowledging it as better than most of Adamson's work. The overall tone is negative.\"}, {'index': 54, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\3_4.txt', 'sentiment': 'negative', 'reason': '用户对Kevin Costner的电影表达了不满,认为他的角色和剧情缺乏新意,且与其他电影雷同。这表明用户的情绪是负面的。'}, {'index': 55, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\40_4.txt', 'sentiment': 'positive', 'reason': '用户表达了对电影的复杂情感,既有对其创新和多样性的赞赏,也有对其低质量的批评。但总体上,用户似乎对这部电影持有一种欣赏的态度,认为它在低质量作品中属于较高水平。'}, {'index': 56, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\41_4.txt', 'sentiment': 'negative', 'reason': \"The user's review of the film is predominantly negative, highlighting issues such as poor animation, a weak storyline, and an overall lack of thrills. The user also mentions that the film looks cheap and has tedious scenes which do little for the story.\"}, {'index': 57, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\42_4.txt', 'sentiment': 'negative', 'reason': '用户对电影的评价非常负面,认为其内容低俗、情节牵强,并批评了相关制作和资助方。'}, {'index': 58, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\43_1.txt', 'sentiment': 'negative', 'reason': '用户表达了对电影的不满,认为其情节无聊、夸张且缺乏逻辑,同时批评了电影制作人对恐怖片的误解。这些负面评价表明用户的情绪是负面的。'}, {'index': 59, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\44_4.txt', 'sentiment': 'negative', 'reason': \"评论中使用了多个负面词汇,如'lame'、'profoundly lame'、'absurdly wooden'等,并表达了对电影的不满和建议避免观看。\"}, {'index': 60, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\45_2.txt', 'sentiment': 'negative', 'reason': '评论中提到了电影的前半部分有紧张感和不错的铺垫,但后半部分变得荒谬且难以令人信服,导致观众在不恰当的时候发笑,并认为电影构思很好但写作糟糕。'}, {'index': 61, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\46_2.txt', 'sentiment': 'negative', 'reason': 'The text acknowledges some positive aspects of the film, such as its originality and themes, but overall expresses disappointment with the technical execution, plot issues, and overuse of clichés. The conclusion that the film receives only two stars indicates a negative sentiment.'}, {'index': 62, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\47_2.txt', 'sentiment': 'negative', 'reason': '评论中表达了对电影的不满,认为其风格重于内容,缺乏原创性,并将其与Harmony Korine的作品相比较但持负面看法。'}, {'index': 63, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\48_4.txt', 'sentiment': 'negative', 'reason': \"The user's review highlights several negative aspects of the movie, such as abrupt storytelling, lack of character development, and a feeling that watching it is not time well spent. These criticisms indicate an overall negative sentiment towards the film.\"}, {'index': 64, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\49_4.txt', 'sentiment': 'negative', 'reason': 'The review expresses disappointment with the film, highlighting confusing deaths, a dragging middle section, and false advertising. The reviewer also suggests better alternatives for horror movie marathons, indicating dissatisfaction with the overall quality of the film.'}, {'index': 65, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\4_4.txt', 'sentiment': 'negative', 'reason': '用户对电影的评价非常负面,提到了电影过长、剧本无处可去、情节发展缓慢、角色发展不自然以及多个结尾的问题。这些都表明用户对电影不满意。'}, {'index': 66, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\50_3.txt', 'sentiment': 'negative', 'reason': 'The text expresses disappointment with the movie, mentioning that it had a good premise but failed to deliver, and that the murders were not special. The overall tone is negative.'}, {'index': 67, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\51_4.txt', 'sentiment': 'neutral', 'reason': \"The text provides a detailed review of the movie 'Frightmare', highlighting both its flaws and redeeming qualities. While the reviewer acknowledges that the film is cheap, has poor special effects, and subpar acting, they also praise Ferdy Mayne's performance as a standout element. The overall tone is balanced, with a mix of criticism and appreciation, suggesting a generally neutral to slightly positive sentiment.\"}, {'index': 68, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\52_4.txt', 'sentiment': 'negative', 'reason': 'The text describes a movie with ghoulish activities and violent acts, but also mentions that the film is limited by a low budget, slow pace, and that the violence is not very visible due to the darkness. The overall tone seems to be more critical than positive.'}, {'index': 69, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\53_4.txt', 'sentiment': 'negative', 'reason': 'The user expresses frustration and disappointment with the movie \\'Horror Star,\\' criticizing its plot, acting, and overall quality. They also mention that it is a \"lame 80\\'s horror flick\" and \"can hardly be called a must-see or even a good film.\" These negative descriptions indicate a negative sentiment.'}, {'index': 70, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\54_3.txt', 'sentiment': 'negative', 'reason': \"The text describes the movie as having obvious budgetary restraints and a less-than-professional cast, which indicates negative aspects. Additionally, it mentions that the movie 'falls apart' and contains endless scenes of teens wandering around, suggesting dissatisfaction with the film's quality and pacing.\"}, {'index': 71, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\55_4.txt', 'sentiment': 'negative', 'reason': '用户表达了对电影的失望和不满,认为电影无聊、缺乏娱乐价值,并且只推荐在没有其他选择的情况下观看。'}, {'index': 72, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\56_3.txt', 'sentiment': 'negative', 'reason': '用户表达了对节目质量的不满,批评了剧本、节奏和角色设定,并指出这些因素影响了观看体验。'}, {'index': 73, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\57_4.txt', 'sentiment': 'negative', 'reason': '用户对演员的表现和剧本的质量表达了不满,认为对话生硬、情节设计不佳,并且在提到电影制作人时也表现出一定的失望。然而,用户最后也表示了对电影制作人的鼓励和支持,这表明情绪中有一些积极的成分。但整体上,负面评价占主导地位。'}, {'index': 74, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\58_3.txt', 'sentiment': 'negative', 'reason': \"The text expresses dissatisfaction with the movie 'Blade,' criticizing its plot, characters, and overall execution. The author finds it unoriginal, simplistic, and dull, indicating a negative sentiment.\"}, {'index': 75, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\59_3.txt', 'sentiment': 'negative', 'reason': '用户表达了对电影的强烈不满,提到了糟糕的表演、缺乏角色塑造、几乎没有情节,并建议观看其他电影。这些负面评价表明情绪是负面的。'}, {'index': 76, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\5_4.txt', 'sentiment': 'negative', 'reason': 'The text expresses disappointment and criticism towards the movie, highlighting its lack of originality, overuse of stereotypes, and failure to deliver meaningful content or insight about the U.S. Coast Guard.'}, {'index': 77, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\60_1.txt', 'sentiment': 'negative', 'reason': \"The text expresses strong dissatisfaction with the movie 'Witchery', describing it as unentertaining, cliché-ridden, and filled with cringe-worthy scenes. The author criticizes the cast for not giving their best performance and advises others not to waste their time watching it.\"}, {'index': 78, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\61_1.txt', 'sentiment': 'negative', 'reason': '用户和朋友都认为电影的配乐和制作技术落后,剧情拖沓且结局缺乏惊喜,并认为电影可以缩短以增加悬念和推动情节。这些评论表明了对电影的不满。'}, {'index': 79, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\62_2.txt', 'sentiment': 'negative', 'reason': '用户对电影的评价总体上是负面的,提到了情节混乱、无趣,特效糟糕,并表示希望观看导演的另一部作品以期待更好的体验。'}, {'index': 80, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\63_1.txt', 'sentiment': 'negative', 'reason': '用户对电影的多个方面表达了强烈的不满,包括难以观看、演技差、剧情糟糕和无聊。这些负面评价表明情绪是负面的。'}, {'index': 81, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\64_3.txt', 'sentiment': 'negative', 'reason': '评论中包含了对电影的批评和负面评价,如“3/10”评分、提到演员表现不佳以及一些令人不适的情节描述。'}, {'index': 82, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\65_2.txt', 'sentiment': 'negative', 'reason': '用户对电影的剧情、表演和恐怖元素表示不满,认为这些方面表现平庸或不佳。然而,用户提到了电影的拍摄地点和环境的美丽,并建议观众可以快进到展示美景的部分。这表明用户对电影的整体体验是负面的,但对某些特定元素(如环境)有正面的看法。'}, {'index': 83, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\66_3.txt', 'sentiment': 'positive', 'reason': '尽管用户提到了一些负面因素(如效果可笑、故事混乱),但整体上表达了对电影的积极感受,特别是提到观看Hasselhoff和喜欢的老酒店增加了乐趣。'}, {'index': 84, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\67_3.txt', 'sentiment': 'negative', 'reason': 'The text expresses dissatisfaction with the movie, highlighting its poor quality, confusing plot, and unimpressive horror elements. The author also criticizes the casting choices and the misleading marketing as a sequel to other films.'}, {'index': 85, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\68_1.txt', 'sentiment': 'negative', 'reason': '用户对电影《巫术》的大部分内容感到不适和厌恶,但提到了喜欢结局。整体情绪偏向负面。'}, {'index': 86, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\69_4.txt', 'sentiment': 'negative', 'reason': 'The text provides a detailed and somewhat critical review of the movie \"Witchery,\" pointing out its incoherent script and lamentable qualities. However, it also highlights some positive aspects like fantastic gore effects, an exhilarating musical score, and terrific casting choices. The overall tone is mixed but leans slightly negative due to the emphasis on the film\\'s flaws.'}, {'index': 87, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\6_3.txt', 'sentiment': 'negative', 'reason': \"The review highlights several negative aspects of the film, such as Albert Finney's portrayal of the actor being inconsistent and not fitting the character well. It also mentions that the relationship between the two main characters lacks depth and fails to provide much to behold beyond the deterioration of narcissism. These criticisms indicate a generally negative sentiment towards the film.\"}, {'index': 88, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\70_1.txt', 'sentiment': 'negative', 'reason': 'The text describes a horror movie with graphic and disturbing content, including cruel and torturous methods of killing, which indicates a negative tone.'}, {'index': 89, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\71_4.txt', 'sentiment': 'negative', 'reason': 'The text expresses confusion and frustration about the various versions of the film, mentions that it is a \"hit-or-miss horror effort\" and criticizes the ending as a \"senseless mess.\" These negative descriptions indicate an overall negative sentiment.'}, {'index': 90, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\72_4.txt', 'sentiment': 'negative', 'reason': \"The text expresses a mix of negative and positive sentiments. The negative aspects include criticism of the movie's bad clothing, worse synth music, poor acting, and clichéd elements. However, there are also positive mentions such as the effective gore scenes and some suspenseful moments. Overall, the sentiment leans slightly negative due to the more frequent and stronger negative comments.\"}, {'index': 91, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\73_4.txt', 'sentiment': 'negative', 'reason': \"The text is a movie review that starts with a negative tone, describing the film as 'uneventful', 'tedious', and 'nonsensical'. However, it acknowledges some entertaining elements like inventive death scenes and gore. The overall sentiment is mixed but leans slightly negative due to the strong criticism of the first half of the film.\"}, {'index': 92, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\74_4.txt', 'sentiment': 'negative', 'reason': '评论中提到了电影的多个负面方面,如角色不合适、某些场景令人不适,并且认为这并不是一部值得拥抱或重要的电影。尽管有几段不错的情节,但整体评价偏向负面。'}, {'index': 93, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\75_1.txt', 'sentiment': 'negative', 'reason': '用户对电影的评价非常负面,提到了许多不愉快的情节和角色,如威胁、死亡和无聊的结局,并用“Lame”来形容这部电影。'}, {'index': 94, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\76_4.txt', 'sentiment': 'negative', 'reason': '文本描述了一部恐怖片,其中包含令人不安的元素和神秘的角色,这通常与负面情绪相关。'}, {'index': 95, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\77_2.txt', 'sentiment': 'negative', 'reason': 'The text expresses dissatisfaction with the movie, highlighting its clichéd plot, poor acting, and absurdly high praise. The author criticizes various aspects of the film and gives it a very low rating (2/10), indicating a strong negative sentiment.'}, {'index': 96, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\78_1.txt', 'sentiment': 'negative', 'reason': '用户表达了对电影的不满,认为难以集中注意力,并称其为最差的浪漫电影之一,建议不要观看。'}, {'index': 97, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\79_2.txt', 'sentiment': 'negative', 'reason': '用户对电影的多个方面表达了强烈的不满,包括舞蹈、剧情、爱情故事、音乐剧元素、戏剧和喜剧效果。用户认为这部电影在各个方面都失败了,并且演员表现糟糕,剧本未能传达其意图。这些负面评价表明用户的情绪是负面的。'}, {'index': 98, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\7_1.txt', 'sentiment': 'negative', 'reason': 'The text expresses strong negative opinions about the movie \\'Darling Lili\\', describing it as a \"disaster\", \"awful\", and criticizing various aspects such as the acting, tone, and overall execution. The reviewer also mentions that audiences stayed away in droves, further indicating a negative sentiment.'}, {'index': 99, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\80_4.txt', 'sentiment': 'negative', 'reason': '评论中提到电影是“overambitious, plotless”,并且“dramatic center”缺失,笑点稀少,整体评价较低。尽管结尾有趣,但整体情绪偏向负面。'}, {'index': 100, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\81_3.txt', 'sentiment': 'negative', 'reason': \"The text expresses disappointment with the film, noting that it failed to be funny and has aged poorly. The author also mentions there's almost no plot and it's too obvious to be witty, indicating a negative sentiment.\"}, {'index': 101, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\82_3.txt', 'sentiment': 'negative', 'reason': '评论中提到了电影的许多负面方面,如糟糕的照明、缺乏想象力和幽默感,以及不推荐观看。'}, {'index': 102, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\83_1.txt', 'sentiment': 'negative', 'reason': \"用户表达了对电影的极度不满,使用了如'sucked so bad', 'horrible writing, acting and direction', 'travesty'等负面词汇,并建议观众准备好枪以防需要使用,显示出强烈的负面情绪。\"}, {'index': 103, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\84_3.txt', 'sentiment': 'negative', 'reason': '用户对电影的评价非常负面,提到了多个缺点,如电影制作粗糙、演员表现不佳、剧情不吸引人等,并给出了3分(满分10分)的低评分。'}, {'index': 104, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\85_2.txt', 'sentiment': 'negative', 'reason': 'The user expresses dissatisfaction with the movie, particularly criticizing the sound editing and how it affected their viewing experience. They mention having to constantly adjust the volume and that this made it difficult to enjoy the movie.'}, {'index': 105, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\86_3.txt', 'sentiment': 'negative', 'reason': '评论中提到电影情节松散,未能充分利用其紧张的设定,并给出了较低的评分(3/10),这表明了负面情绪。'}, {'index': 106, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\87_1.txt', 'sentiment': 'negative', 'reason': \"用户对电影的多个方面表达了强烈的不满,包括剧本、表演和情节。使用了诸如'bad', 'horribly written', 'almost comically acted'等负面词汇,并警告其他人不要观看这部电影。\"}, {'index': 107, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\88_3.txt', 'sentiment': 'negative', 'reason': \"用户对电影的评价非常负面,使用了诸如'overrated', 'would put today's audiences asleep', 'turned boring', 'this sucks'等词汇,表达了强烈的不满和失望。\"}, {'index': 108, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\89_3.txt', 'sentiment': 'negative', 'reason': '评论中使用了多个负面词汇,如\"tedious\",\"visually dull\",\"hokey\",\"humorless\",\"stilted\"等,并且对电影的整体表现和导演提出了批评。此外,评分*1/2 from ****也表明了较低的评价。'}, {'index': 109, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\8_2.txt', 'sentiment': 'negative', 'reason': 'The user expresses dissatisfaction with the movie, mentioning it was \"mediocre at best\" and advises others not to waste their time. They also describe losing focus during the film and having difficulty engaging with the characters.'}, {'index': 110, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\90_2.txt', 'sentiment': 'negative', 'reason': '评论中提到了电影中的表演非常出色,但同时也指出了许多不合理和令人困惑的元素,如房屋设计、服装和道具的时代错位等。这些负面评价可能会影响观众的整体观影体验。'}, {'index': 111, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\91_4.txt', 'sentiment': 'negative', 'reason': \"The text expresses dissatisfaction with the film's plot, character development, and ending. It points out implausibilities in the story, criticizes the acting, and calls the resolution of the conflict disappointing. These negative assessments indicate an overall negative sentiment.\"}, {'index': 112, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\92_1.txt', 'sentiment': 'negative', 'reason': '用户对电影的各个方面都表达了强烈的不满,包括剧情、表演、音乐重复等问题,并且认为这部电影是浪费时间和金钱。这些负面评价表明用户的情绪是负面的。'}, {'index': 113, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\93_1.txt', 'sentiment': 'negative', 'reason': '用户对电影《The Wrecking Crew》和相关演员的评价总体上是负面的,提到了很多不好的表演和制作问题。'}, {'index': 114, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\94_2.txt', 'sentiment': 'negative', 'reason': '评论中提到了一些正面元素,如片尾字幕和Ice-T的某些表演时刻。然而,整体上评论者对电影的情节、布景和灯光表示不满,并认为电影令人失望。'}, {'index': 115, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\95_3.txt', 'sentiment': 'neutral', 'reason': '用户对电影的评价总体上是中性的,但提到了一些正面和负面的方面。他提到电影有些部分很享受,但也指出了很多奇怪和不合理的地方,如演员表现不佳、情节不连贯等。尽管如此,他对贫民区题材的电影有特别的喜爱,这使得他能够继续观看并给予一定的肯定。'}, {'index': 116, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\96_1.txt', 'sentiment': 'negative', 'reason': '用户对电影的各个方面(如对话、情节、摄影、表演和导演)都表达了强烈的不满和批评,使用了诸如\"bad\", \"atrocious\", \"awful\", \"terribly unfunny\"等负面词汇。'}, {'index': 117, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\97_1.txt', 'sentiment': 'negative', 'reason': '用户对电影的评价非常负面,提到了许多不满意的地方,如警察无能、法官愚蠢、辩护律师表现不佳,并且表示电影无聊到无法入睡,只给了1颗星。'}, {'index': 118, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\98_1.txt', 'sentiment': 'negative', 'reason': '文本中表达了对电影的不满和批评,如“suffers the same imperfections you see in B-films”和“listed on top of the garbage list”,这些都表明了负面情绪。'}, {'index': 119, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\99_3.txt', 'sentiment': 'negative', 'reason': '用户表达了对电影的失望,认为剧情荒谬复杂且缺乏解决,并建议不要观看除非非常想看。'}, {'index': 120, 'file_path': '../data/acllmdb_sentiment_small/negative\\\\9_4.txt', 'sentiment': 'negative', 'reason': \"The text expresses disappointment and criticism towards the film 'DARLING LILI,' describing it as overproduced, boring, and financially irresponsible. The author also mentions its failure in certain markets and contrasts it with other films that were more successful.\"}]\n", "✅ 结果已保存到 emotion_results.csv\n" ] } ], "source": [ "df = pd.DataFrame(emotion_results)\n", "print('emotion_results ',emotion_results)\n", "df.to_csv('emotion_results.csv', index=False)\n", "print(\"✅ 结果已保存到 emotion_results.csv\")" ] } ], "metadata": { "kernelspec": { "display_name": ".venv", "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 }