Abs6187 commited on
Commit
4d32b7c
·
verified ·
1 Parent(s): 2ac4ccc

Delete notebook.ipynb

Browse files
Files changed (1) hide show
  1. notebook.ipynb +0 -111
notebook.ipynb DELETED
@@ -1,111 +0,0 @@
1
- {
2
- "cells": [
3
- {
4
- "cell_type": "code",
5
- "execution_count": null,
6
- "metadata": {},
7
- "outputs": [
8
- {
9
- "name": "stderr",
10
- "output_type": "stream",
11
- "text": [
12
- "/Users/soumyadip/Library/Python/3.9/lib/python/site-packages/urllib3/__init__.py:35: NotOpenSSLWarning: urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'. See: https://github.com/urllib3/urllib3/issues/3020\n",
13
- " warnings.warn(\n"
14
- ]
15
- },
16
- {
17
- "data": {
18
- "text/plain": [
19
- "True"
20
- ]
21
- },
22
- "execution_count": 2,
23
- "metadata": {},
24
- "output_type": "execute_result"
25
- }
26
- ],
27
- "source": [
28
- "from llama_index.core.agent import ReActAgent\n",
29
- "from llama_index.llms.groq import Groq\n",
30
- "from llama_index.core.llms import ChatMessage\n",
31
- "from llama_index.core.tools import BaseTool, FunctionTool\n",
32
- "from llama_index.tools.tavily_research.base import TavilyToolSpec\n",
33
- "import os\n",
34
- "from dotenv import load_dotenv\n",
35
- "load_dotenv()"
36
- ]
37
- },
38
- {
39
- "cell_type": "code",
40
- "execution_count": 3,
41
- "metadata": {},
42
- "outputs": [],
43
- "source": [
44
- "search = TavilyToolSpec(api_key=os.getenv('TAVILY_API_KEY'))\n",
45
- "def search_tool(prompt:str)->list:\n",
46
- " \"return only search result from the web\"\n",
47
- " results = search.search(prompt)\n",
48
- " return [result.text for result in results]\n",
49
- "search_toolkit = FunctionTool.from_defaults(fn=search_tool)"
50
- ]
51
- },
52
- {
53
- "cell_type": "code",
54
- "execution_count": 4,
55
- "metadata": {},
56
- "outputs": [],
57
- "source": [
58
- "llm = Groq(model = \"gemma2-9b-it\")\n",
59
- "agent = ReActAgent.from_tools([search_toolkit],llm=llm,verbose=True)"
60
- ]
61
- },
62
- {
63
- "cell_type": "code",
64
- "execution_count": null,
65
- "metadata": {},
66
- "outputs": [
67
- {
68
- "name": "stdout",
69
- "output_type": "stream",
70
- "text": [
71
- "> Running step 72522799-577e-4630-afd1-3f7637988a23. Step input: what is the addition of 25 and 26?\n",
72
- "\u001b[1;3;38;5;200mThought: I can answer without using any more tools. I'll use the user's language to answer\n",
73
- "Answer: 51\n",
74
- "\u001b[0m"
75
- ]
76
- }
77
- ],
78
- "source": [
79
- "response = agent.chat(\"what is the instagram link of Soumyadip Changder?\")"
80
- ]
81
- },
82
- {
83
- "cell_type": "code",
84
- "execution_count": null,
85
- "metadata": {},
86
- "outputs": [],
87
- "source": []
88
- }
89
- ],
90
- "metadata": {
91
- "kernelspec": {
92
- "display_name": "Python 3",
93
- "language": "python",
94
- "name": "python3"
95
- },
96
- "language_info": {
97
- "codemirror_mode": {
98
- "name": "ipython",
99
- "version": 3
100
- },
101
- "file_extension": ".py",
102
- "mimetype": "text/x-python",
103
- "name": "python",
104
- "nbconvert_exporter": "python",
105
- "pygments_lexer": "ipython3",
106
- "version": "3.9.6"
107
- }
108
- },
109
- "nbformat": 4,
110
- "nbformat_minor": 2
111
- }