Chong-U Lim
commited on
Commit
•
0f8ae1b
0
Parent(s):
Crash Course 8:51
Browse files- .gitignore +3 -0
- README.md +13 -0
- keys.example.py +1 -0
- notebook.ipynb +125 -0
.gitignore
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
__pycache__
|
2 |
+
.ipynb_checkpoints
|
3 |
+
keys.py
|
README.md
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
```
|
2 |
+
|
3 |
+
# In (base)
|
4 |
+
conda install -c conda-forge notebook
|
5 |
+
conda install -c conda-forge nb_conda_kernels
|
6 |
+
|
7 |
+
conda create -n "codebasics-langchain-crash-course" python=3.10
|
8 |
+
conda use codebasics-langchain-crash-course
|
9 |
+
|
10 |
+
# In (codebasics-langchain-crash-course)
|
11 |
+
|
12 |
+
|
13 |
+
```
|
keys.example.py
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
openapi_key = "PLACE_YOUR_OPEN_AI_KEY_HERE"
|
notebook.ipynb
ADDED
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [
|
3 |
+
{
|
4 |
+
"cell_type": "code",
|
5 |
+
"execution_count": 9,
|
6 |
+
"metadata": {},
|
7 |
+
"outputs": [
|
8 |
+
{
|
9 |
+
"name": "stdout",
|
10 |
+
"output_type": "stream",
|
11 |
+
"text": [
|
12 |
+
"Requirement already satisfied: langchain in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (0.1.9)\n",
|
13 |
+
"Requirement already satisfied: PyYAML>=5.3 in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from langchain) (6.0.1)\n",
|
14 |
+
"Requirement already satisfied: SQLAlchemy<3,>=1.4 in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from langchain) (2.0.27)\n",
|
15 |
+
"Requirement already satisfied: aiohttp<4.0.0,>=3.8.3 in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from langchain) (3.9.3)\n",
|
16 |
+
"Requirement already satisfied: async-timeout<5.0.0,>=4.0.0 in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from langchain) (4.0.3)\n",
|
17 |
+
"Requirement already satisfied: dataclasses-json<0.7,>=0.5.7 in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from langchain) (0.6.4)\n",
|
18 |
+
"Requirement already satisfied: jsonpatch<2.0,>=1.33 in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from langchain) (1.33)\n",
|
19 |
+
"Requirement already satisfied: langchain-community<0.1,>=0.0.21 in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from langchain) (0.0.24)\n",
|
20 |
+
"Requirement already satisfied: langchain-core<0.2,>=0.1.26 in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from langchain) (0.1.27)\n",
|
21 |
+
"Requirement already satisfied: langsmith<0.2.0,>=0.1.0 in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from langchain) (0.1.10)\n",
|
22 |
+
"Requirement already satisfied: numpy<2,>=1 in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from langchain) (1.26.4)\n",
|
23 |
+
"Requirement already satisfied: pydantic<3,>=1 in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from langchain) (2.6.3)\n",
|
24 |
+
"Requirement already satisfied: requests<3,>=2 in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from langchain) (2.31.0)\n",
|
25 |
+
"Requirement already satisfied: tenacity<9.0.0,>=8.1.0 in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from langchain) (8.2.3)\n",
|
26 |
+
"Requirement already satisfied: aiosignal>=1.1.2 in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain) (1.3.1)\n",
|
27 |
+
"Requirement already satisfied: attrs>=17.3.0 in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain) (23.2.0)\n",
|
28 |
+
"Requirement already satisfied: frozenlist>=1.1.1 in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain) (1.4.1)\n",
|
29 |
+
"Requirement already satisfied: multidict<7.0,>=4.5 in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain) (6.0.5)\n",
|
30 |
+
"Requirement already satisfied: yarl<2.0,>=1.0 in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain) (1.9.4)\n",
|
31 |
+
"Requirement already satisfied: marshmallow<4.0.0,>=3.18.0 in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from dataclasses-json<0.7,>=0.5.7->langchain) (3.21.0)\n",
|
32 |
+
"Requirement already satisfied: typing-inspect<1,>=0.4.0 in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from dataclasses-json<0.7,>=0.5.7->langchain) (0.9.0)\n",
|
33 |
+
"Requirement already satisfied: jsonpointer>=1.9 in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from jsonpatch<2.0,>=1.33->langchain) (2.4)\n",
|
34 |
+
"Requirement already satisfied: anyio<5,>=3 in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from langchain-core<0.2,>=0.1.26->langchain) (4.3.0)\n",
|
35 |
+
"Requirement already satisfied: packaging<24.0,>=23.2 in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from langchain-core<0.2,>=0.1.26->langchain) (23.2)\n",
|
36 |
+
"Requirement already satisfied: orjson<4.0.0,>=3.9.14 in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from langsmith<0.2.0,>=0.1.0->langchain) (3.9.15)\n",
|
37 |
+
"Requirement already satisfied: annotated-types>=0.4.0 in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from pydantic<3,>=1->langchain) (0.6.0)\n",
|
38 |
+
"Requirement already satisfied: pydantic-core==2.16.3 in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from pydantic<3,>=1->langchain) (2.16.3)\n",
|
39 |
+
"Requirement already satisfied: typing-extensions>=4.6.1 in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from pydantic<3,>=1->langchain) (4.10.0)\n",
|
40 |
+
"Requirement already satisfied: charset-normalizer<4,>=2 in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from requests<3,>=2->langchain) (3.3.2)\n",
|
41 |
+
"Requirement already satisfied: idna<4,>=2.5 in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from requests<3,>=2->langchain) (3.6)\n",
|
42 |
+
"Requirement already satisfied: urllib3<3,>=1.21.1 in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from requests<3,>=2->langchain) (2.2.1)\n",
|
43 |
+
"Requirement already satisfied: certifi>=2017.4.17 in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from requests<3,>=2->langchain) (2024.2.2)\n",
|
44 |
+
"Requirement already satisfied: greenlet!=0.4.17 in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from SQLAlchemy<3,>=1.4->langchain) (3.0.3)\n",
|
45 |
+
"Requirement already satisfied: sniffio>=1.1 in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from anyio<5,>=3->langchain-core<0.2,>=0.1.26->langchain) (1.3.1)\n",
|
46 |
+
"Requirement already satisfied: exceptiongroup>=1.0.2 in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from anyio<5,>=3->langchain-core<0.2,>=0.1.26->langchain) (1.2.0)\n",
|
47 |
+
"Requirement already satisfied: mypy-extensions>=0.3.0 in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from typing-inspect<1,>=0.4.0->dataclasses-json<0.7,>=0.5.7->langchain) (1.0.0)\n",
|
48 |
+
"Requirement already satisfied: openai in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (1.13.3)\n",
|
49 |
+
"Requirement already satisfied: anyio<5,>=3.5.0 in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from openai) (4.3.0)\n",
|
50 |
+
"Requirement already satisfied: distro<2,>=1.7.0 in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from openai) (1.9.0)\n",
|
51 |
+
"Requirement already satisfied: httpx<1,>=0.23.0 in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from openai) (0.27.0)\n",
|
52 |
+
"Requirement already satisfied: pydantic<3,>=1.9.0 in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from openai) (2.6.3)\n",
|
53 |
+
"Requirement already satisfied: sniffio in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from openai) (1.3.1)\n",
|
54 |
+
"Requirement already satisfied: tqdm>4 in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from openai) (4.66.2)\n",
|
55 |
+
"Requirement already satisfied: typing-extensions<5,>=4.7 in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from openai) (4.10.0)\n",
|
56 |
+
"Requirement already satisfied: idna>=2.8 in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from anyio<5,>=3.5.0->openai) (3.6)\n",
|
57 |
+
"Requirement already satisfied: exceptiongroup>=1.0.2 in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from anyio<5,>=3.5.0->openai) (1.2.0)\n",
|
58 |
+
"Requirement already satisfied: certifi in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from httpx<1,>=0.23.0->openai) (2024.2.2)\n",
|
59 |
+
"Requirement already satisfied: httpcore==1.* in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from httpx<1,>=0.23.0->openai) (1.0.4)\n",
|
60 |
+
"Requirement already satisfied: h11<0.15,>=0.13 in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from httpcore==1.*->httpx<1,>=0.23.0->openai) (0.14.0)\n",
|
61 |
+
"Requirement already satisfied: annotated-types>=0.4.0 in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from pydantic<3,>=1.9.0->openai) (0.6.0)\n",
|
62 |
+
"Requirement already satisfied: pydantic-core==2.16.3 in /home/chong-u/mambaforge/envs/codebasics-langchain-crash-course/lib/python3.10/site-packages (from pydantic<3,>=1.9.0->openai) (2.16.3)\n"
|
63 |
+
]
|
64 |
+
}
|
65 |
+
],
|
66 |
+
"source": [
|
67 |
+
"!pip install langchain\n",
|
68 |
+
"!pip install openai"
|
69 |
+
]
|
70 |
+
},
|
71 |
+
{
|
72 |
+
"cell_type": "code",
|
73 |
+
"execution_count": 1,
|
74 |
+
"metadata": {
|
75 |
+
"notebookRunGroups": {
|
76 |
+
"groupValue": ""
|
77 |
+
}
|
78 |
+
},
|
79 |
+
"outputs": [],
|
80 |
+
"source": [
|
81 |
+
"from keys import openapi_key\n",
|
82 |
+
"import os\n",
|
83 |
+
"\n",
|
84 |
+
"os.environ['OPENAI_API_KEY'] = openapi_key\n"
|
85 |
+
]
|
86 |
+
},
|
87 |
+
{
|
88 |
+
"cell_type": "code",
|
89 |
+
"execution_count": 2,
|
90 |
+
"metadata": {},
|
91 |
+
"outputs": [],
|
92 |
+
"source": [
|
93 |
+
"from langchain.llms import OpenAI"
|
94 |
+
]
|
95 |
+
},
|
96 |
+
{
|
97 |
+
"cell_type": "code",
|
98 |
+
"execution_count": null,
|
99 |
+
"metadata": {},
|
100 |
+
"outputs": [],
|
101 |
+
"source": []
|
102 |
+
}
|
103 |
+
],
|
104 |
+
"metadata": {
|
105 |
+
"kernelspec": {
|
106 |
+
"display_name": "codebasics-langchain-crash-course",
|
107 |
+
"language": "python",
|
108 |
+
"name": "python3"
|
109 |
+
},
|
110 |
+
"language_info": {
|
111 |
+
"codemirror_mode": {
|
112 |
+
"name": "ipython",
|
113 |
+
"version": 3
|
114 |
+
},
|
115 |
+
"file_extension": ".py",
|
116 |
+
"mimetype": "text/x-python",
|
117 |
+
"name": "python",
|
118 |
+
"nbconvert_exporter": "python",
|
119 |
+
"pygments_lexer": "ipython3",
|
120 |
+
"version": "3.10.13"
|
121 |
+
}
|
122 |
+
},
|
123 |
+
"nbformat": 4,
|
124 |
+
"nbformat_minor": 2
|
125 |
+
}
|