File size: 4,757 Bytes
ac0db5b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
{
 "cells": [
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-04-26T16:18:43.794743Z",
     "start_time": "2025-04-26T16:18:43.451406Z"
    }
   },
   "cell_type": "code",
   "source": [
    "from dotenv import load_dotenv\n",
    "\n",
    "\n",
    "load_dotenv()\n",
    "\n",
    "from langchain.chat_models import init_chat_model\n",
    "\n",
    "model = init_chat_model(\"llama-3.3-70b-versatile\", model_provider=\"groq\")\n",
    "\n",
    "\n"
   ],
   "id": "8650e18ecedee76b",
   "outputs": [],
   "execution_count": 1
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-04-26T16:47:43.167391Z",
     "start_time": "2025-04-26T16:47:42.533561Z"
    }
   },
   "cell_type": "code",
   "source": [
    "\n",
    "\n",
    "\n",
    "response = model.invoke([(\"system\", \"You are a general AI assistant. I will ask you a question. Report your thoughts, and finish your answer with the following template: FINAL ANSWER: [YOUR FINAL ANSWER]. YOUR FINAL ANSWER should be a number OR as few words as possible OR a comma separated list of numbers and/or strings. If you are asked for a number, don't use comma to write your number neither use units such as $ or percent sign unless specified otherwise. If you are asked for a string, don't use articles, neither abbreviations (e.g. for cities), and write the digits in plain text unless specified otherwise. If you are asked for a comma separated list, apply the above rules depending of whether the element to be put in the list is a number or a string.\"), (\"user\", \"How many studio albums were published by Mercedes Sosa between 2000 and 2009 (included)? You can use the latest 2022 version of english wikipedia.\")])"
   ],
   "id": "2cf579b261985300",
   "outputs": [],
   "execution_count": 7
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-04-26T16:44:53.835775Z",
     "start_time": "2025-04-26T16:44:53.788795Z"
    }
   },
   "cell_type": "code",
   "source": "response",
   "id": "6f8ec7273ff2b9c9",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "AIMessage(content=\"According to the 2022 English Wikipedia, Mercedes Sosa published the following studio albums between 2000 and 2009:\\n\\n1. Acústico (2002) - Although described as 'acústico', some sources consider this as a live album.\\n2. Argentina Que Tal (2001) - This is considered a 'live with guests' album but some sources consider this as a studio album.\\n3. Corazón Libre (2005) - This is considered a studio album.\\n4. Cantora (2009) - This is considered a studio album.\\n\\nTherefore, the number of studio albums published by Mercedes Sosa between 2000 and 2009 (included) can be considered as 3 or 4, depending on how 'Acústico' and 'Argentina Que Tal' are classified.\", additional_kwargs={}, response_metadata={'token_usage': {'completion_tokens': 171, 'prompt_tokens': 69, 'total_tokens': 240, 'completion_time': 0.621818182, 'prompt_time': 0.004940866, 'queue_time': 0.093644521, 'total_time': 0.626759048}, 'model_name': 'llama-3.3-70b-versatile', 'system_fingerprint': 'fp_9a8b91ba77', 'finish_reason': 'stop', 'logprobs': None}, id='run-151ecdee-f777-4723-98bc-0b5e0243300a-0', usage_metadata={'input_tokens': 69, 'output_tokens': 171, 'total_tokens': 240})"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 5
  },
  {
   "metadata": {
    "ExecuteTime": {
     "end_time": "2025-04-26T16:47:46.695284Z",
     "start_time": "2025-04-26T16:47:46.684725Z"
    }
   },
   "cell_type": "code",
   "source": "response.content",
   "id": "ee0f4c8b47699033",
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'To find out how many studio albums were published by Mercedes Sosa between 2000 and 2009, I need to look at her discography. According to the Wikipedia page on Mercedes Sosa, her studio albums between 2000 and 2009 are: \\n- Acústico (2002) \\n- Corazón libre (2005) \\n- Cantora (2009).\\n\\nFINAL ANSWER: 3'"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "execution_count": 8
  },
  {
   "metadata": {},
   "cell_type": "code",
   "outputs": [],
   "execution_count": null,
   "source": "",
   "id": "1fa2a5fe69809336"
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}