Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.env
22 changes: 17 additions & 5 deletions tool_calling.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,24 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 2,
"id": "b4e899c4-f512-4ec9-a941-cef28bbef237",
"metadata": {},
"outputs": [],
"source": [
"from openai import OpenAI\n",
"import json\n",
"\n",
"client = OpenAI()\n",
"from dotenv import load_dotenv\n",
"import os\n",
"\n",
"# Load environment variables from .env file\n",
"load_dotenv()\n",
"\n",
"# Read the API key from the .env file\n",
"api_key = os.getenv('OPENAI_API_KEY')\n",
"\n",
"client = OpenAI(api_key=api_key)\n",
"\n",
"messages = [{\"role\": \"user\", \n",
" \"content\": \"How much is a dollar worth in Japan? How about poland? Whats the current news in Argentina?\"}]\n",
Expand All @@ -140,7 +149,8 @@
" messages=messages,\n",
" tools=first_tools,\n",
" tool_choice=\"auto\", # auto is default, but we'll be explicit\n",
" )"
" )\n",
"\t"
]
},
{
Expand Down Expand Up @@ -229,6 +239,8 @@
"metadata": {},
"outputs": [],
"source": [
"# Please note below API sometime doesn't work due to Company firewall, please switch to personal mobile data or \n",
"# Broadband and try\n",
"from duckduckgo_search import DDGS\n",
"import requests\n",
"\n",
Expand Down Expand Up @@ -1235,7 +1247,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
Expand All @@ -1249,7 +1261,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.1"
"version": "3.12.6"
}
},
"nbformat": 4,
Expand Down