{ "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 }