Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/ translate tool #7

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 13 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
74 changes: 66 additions & 8 deletions cookbook/advanced_rag_eval.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,82 @@
},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like some unintended files and changes got added to this PR.

{
"cell_type": "code",
"execution_count": null,
"id": "0d8415ee-709c-407f-9ac2-f03a9d697aaf",
"metadata": {},
"outputs": [],
"metadata": {
"ExecuteTime": {
"end_time": "2024-08-19T00:48:36.455811Z",
"start_time": "2024-08-19T00:48:35.474731Z"
}
},
"source": [
"! pip install -U langchain openai langchain_chroma langchain-experimental # (newest versions required for multi-modal)"
]
],
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"ERROR: Invalid requirement: '#'\n",
"\n",
"[notice] A new release of pip is available: 23.2.1 -> 24.2\n",
"[notice] To update, run: python.exe -m pip install --upgrade pip\n"
]
}
],
"execution_count": 1
},
{
"cell_type": "code",
"execution_count": null,
"id": "191f8465-fd6b-4017-8f0e-d284971b45ae",
"metadata": {},
"outputs": [],
"metadata": {
"ExecuteTime": {
"end_time": "2024-08-19T00:48:51.520482Z",
"start_time": "2024-08-19T00:48:48.186609Z"
}
},
"source": [
"# lock to 0.10.19 due to a persistent bug in more recent versions\n",
"! pip install \"unstructured[all-docs]==0.10.19\" pillow pydantic lxml pillow matplotlib tiktoken open_clip_torch torch"
]
],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Collecting unstructured[all-docs]==0.10.19\n",
" Obtaining dependency information for unstructured[all-docs]==0.10.19 from https://files.pythonhosted.org/packages/40/07/5acccc63e96a2ddf6040b9b3c2a8b258abc4fad5671364917b01301cd2be/unstructured-0.10.19-py3-none-any.whl.metadata\n",
" Downloading unstructured-0.10.19-py3-none-any.whl.metadata (24 kB)\n",
"Collecting pillow\n",
" Obtaining dependency information for pillow from https://files.pythonhosted.org/packages/69/66/03002cb5b2c27bb519cba63b9f9aa3709c6f7a5d3b285406c01f03fb77e5/pillow-10.4.0-cp38-cp38-win32.whl.metadata\n",
" Downloading pillow-10.4.0-cp38-cp38-win32.whl.metadata (9.3 kB)\n",
"Requirement already satisfied: pydantic in f:\\pycharm\\langchain\\.venv\\lib\\site-packages (2.8.2)\n",
"Collecting lxml\n",
" Obtaining dependency information for lxml from https://files.pythonhosted.org/packages/9c/5f/3139693a0687ee5ec2d8b6b925eb4b7b9d4c28873d4e7d1e55f686ad7026/lxml-5.3.0-cp38-cp38-win32.whl.metadata\n",
" Downloading lxml-5.3.0-cp38-cp38-win32.whl.metadata (3.9 kB)\n",
"Collecting matplotlib\n",
" Obtaining dependency information for matplotlib from https://files.pythonhosted.org/packages/c0/1e/b24a07a849c8d458f1b3724f49029f0dedf748bdedb4d5f69491314838b6/matplotlib-3.7.5-cp38-cp38-win32.whl.metadata\n",
" Downloading matplotlib-3.7.5-cp38-cp38-win32.whl.metadata (5.8 kB)\n",
"Collecting tiktoken\n",
" Using cached tiktoken-0.7.0-cp38-cp38-win32.whl\n",
"Collecting open_clip_torch\n",
" Obtaining dependency information for open_clip_torch from https://files.pythonhosted.org/packages/9c/b7/aca0649087854dde2f490696359a918274cb5b9c04e624b22849c66e9f09/open_clip_torch-2.26.1-py3-none-any.whl.metadata\n",
" Downloading open_clip_torch-2.26.1-py3-none-any.whl.metadata (31 kB)\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"ERROR: Ignored the following versions that require a different python version: 0.1.1 Requires-Python >=3.9; 0.12.0 Requires-Python >=3.9.0,<3.12; 0.12.2 Requires-Python >=3.9.0,<3.12; 0.12.3 Requires-Python >=3.9.0,<3.12; 0.12.4 Requires-Python >=3.9.0,<3.12; 0.12.5 Requires-Python >=3.9.0,<3.12; 0.12.6 Requires-Python >=3.9.0,<3.12; 0.13.0 Requires-Python <3.12,>=3.9.0; 0.13.1 Requires-Python <3.12,>=3.9.0; 0.13.2 Requires-Python <3.12,>=3.9.0; 0.13.3 Requires-Python <3.12,>=3.9.0; 0.13.4 Requires-Python <3.12,>=3.9.0; 0.13.5 Requires-Python <3.12,>=3.9.0; 0.13.6 Requires-Python <3.12,>=3.9.0; 0.13.7 Requires-Python <3.12,>=3.9.0; 0.14.0 Requires-Python <3.12,>=3.9.0; 0.14.10 Requires-Python <3.13,>=3.9.0; 0.14.2 Requires-Python <3.13,>=3.9.0; 0.14.2.dev1 Requires-Python <3.13,>=3.9.0; 0.14.3 Requires-Python <3.13,>=3.9.0; 0.14.4 Requires-Python <3.13,>=3.9.0; 0.14.5 Requires-Python <3.13,>=3.9.0; 0.14.6 Requires-Python <3.13,>=3.9.0; 0.14.7 Requires-Python <3.13,>=3.9.0; 0.14.8 Requires-Python <3.13,>=3.9.0; 0.14.9 Requires-Python <3.13,>=3.9.0; 0.15.0 Requires-Python <3.13,>=3.9.0; 0.15.1 Requires-Python <3.13,>=3.9.0; 0.15.3 Requires-Python <3.13,>=3.9.0; 0.15.5 Requires-Python <3.13,>=3.9.0; 3.8.0 Requires-Python >=3.9; 3.8.0rc1 Requires-Python >=3.9; 3.8.1 Requires-Python >=3.9; 3.8.2 Requires-Python >=3.9; 3.8.3 Requires-Python >=3.9; 3.8.4 Requires-Python >=3.9; 3.9.0 Requires-Python >=3.9; 3.9.0rc2 Requires-Python >=3.9; 3.9.1 Requires-Python >=3.9; 3.9.1.post1 Requires-Python >=3.9; 3.9.2 Requires-Python >=3.9\n",
"ERROR: Could not find a version that satisfies the requirement torch (from versions: none)\n",
"ERROR: No matching distribution found for torch\n",
"\n",
"[notice] A new release of pip is available: 23.2.1 -> 24.2\n",
"[notice] To update, run: python.exe -m pip install --upgrade pip\n"
]
}
],
"execution_count": 2
},
{
"cell_type": "markdown",
Expand Down
110 changes: 102 additions & 8 deletions cookbook/amazon_personalize_how_to.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,91 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": true
"scrolled": true,
"ExecuteTime": {
"end_time": "2024-08-19T01:33:09.439066Z",
"start_time": "2024-08-19T01:32:58.497402Z"
}
},
"outputs": [],
"source": [
"!pip install boto3"
]
],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Collecting boto3\n",
" Obtaining dependency information for boto3 from https://files.pythonhosted.org/packages/0e/da/d7d3a9ad530b6c05548bfabe6e163687a5039fbdfecbf07f7b5532fd077b/boto3-1.35.0-py3-none-any.whl.metadata\n",
" Downloading boto3-1.35.0-py3-none-any.whl.metadata (6.6 kB)\n",
"Collecting botocore<1.36.0,>=1.35.0 (from boto3)\n",
" Obtaining dependency information for botocore<1.36.0,>=1.35.0 from https://files.pythonhosted.org/packages/10/02/c9dd0c025333137e98ff219dd106f367f241cdba869f79053fb2fa0f11a3/botocore-1.35.0-py3-none-any.whl.metadata\n",
" Downloading botocore-1.35.0-py3-none-any.whl.metadata (5.7 kB)\n",
"Collecting jmespath<2.0.0,>=0.7.1 (from boto3)\n",
" Obtaining dependency information for jmespath<2.0.0,>=0.7.1 from https://files.pythonhosted.org/packages/31/b4/b9b800c45527aadd64d5b442f9b932b00648617eb5d63d2c7a6587b7cafc/jmespath-1.0.1-py3-none-any.whl.metadata\n",
" Downloading jmespath-1.0.1-py3-none-any.whl.metadata (7.6 kB)\n",
"Collecting s3transfer<0.11.0,>=0.10.0 (from boto3)\n",
" Obtaining dependency information for s3transfer<0.11.0,>=0.10.0 from https://files.pythonhosted.org/packages/3c/4a/b221409913760d26cf4498b7b1741d510c82d3ad38381984a3ddc135ec66/s3transfer-0.10.2-py3-none-any.whl.metadata\n",
" Downloading s3transfer-0.10.2-py3-none-any.whl.metadata (1.7 kB)\n",
"Requirement already satisfied: python-dateutil<3.0.0,>=2.1 in f:\\pycharm\\langchain\\.venv\\lib\\site-packages (from botocore<1.36.0,>=1.35.0->boto3) (2.9.0.post0)\n",
"Collecting urllib3<1.27,>=1.25.4 (from botocore<1.36.0,>=1.35.0->boto3)\n",
" Obtaining dependency information for urllib3<1.27,>=1.25.4 from https://files.pythonhosted.org/packages/ae/6a/99eaaeae8becaa17a29aeb334a18e5d582d873b6f084c11f02581b8d7f7f/urllib3-1.26.19-py2.py3-none-any.whl.metadata\n",
" Downloading urllib3-1.26.19-py2.py3-none-any.whl.metadata (49 kB)\n",
" ---------------------------------------- 0.0/49.3 kB ? eta -:--:--\n",
" ---------------------------------------- 49.3/49.3 kB 1.3 MB/s eta 0:00:00\n",
"Requirement already satisfied: six>=1.5 in f:\\pycharm\\langchain\\.venv\\lib\\site-packages (from python-dateutil<3.0.0,>=2.1->botocore<1.36.0,>=1.35.0->boto3) (1.16.0)\n",
"Downloading boto3-1.35.0-py3-none-any.whl (139 kB)\n",
" ---------------------------------------- 0.0/139.1 kB ? eta -:--:--\n",
" ---------------------------------------- 139.1/139.1 kB 4.2 MB/s eta 0:00:00\n",
"Downloading botocore-1.35.0-py3-none-any.whl (12.5 MB)\n",
" ---------------------------------------- 0.0/12.5 MB ? eta -:--:--\n",
" -- ------------------------------------- 0.7/12.5 MB 14.6 MB/s eta 0:00:01\n",
" ------ --------------------------------- 2.0/12.5 MB 21.3 MB/s eta 0:00:01\n",
" ------------ --------------------------- 3.8/12.5 MB 26.8 MB/s eta 0:00:01\n",
" ---------------- ----------------------- 5.1/12.5 MB 29.8 MB/s eta 0:00:01\n",
" ---------------- ----------------------- 5.1/12.5 MB 29.8 MB/s eta 0:00:01\n",
" ---------------- ----------------------- 5.2/12.5 MB 20.6 MB/s eta 0:00:01\n",
" ------------------ --------------------- 5.8/12.5 MB 18.4 MB/s eta 0:00:01\n",
" ------------------ --------------------- 5.9/12.5 MB 16.4 MB/s eta 0:00:01\n",
" -------------------- ------------------- 6.3/12.5 MB 14.9 MB/s eta 0:00:01\n",
" --------------------- ------------------ 6.6/12.5 MB 14.6 MB/s eta 0:00:01\n",
" ---------------------- ----------------- 7.1/12.5 MB 13.8 MB/s eta 0:00:01\n",
" ------------------------ --------------- 7.5/12.5 MB 13.7 MB/s eta 0:00:01\n",
" ------------------------- -------------- 7.9/12.5 MB 13.0 MB/s eta 0:00:01\n",
" -------------------------- ------------- 8.4/12.5 MB 12.8 MB/s eta 0:00:01\n",
" ---------------------------- ----------- 8.9/12.5 MB 12.7 MB/s eta 0:00:01\n",
" ----------------------------- ---------- 9.2/12.5 MB 12.3 MB/s eta 0:00:01\n",
" ---------------------------------- ----- 10.9/12.5 MB 13.6 MB/s eta 0:00:01\n",
" --------------------------------------- 12.5/12.5 MB 13.9 MB/s eta 0:00:01\n",
" ---------------------------------------- 12.5/12.5 MB 12.8 MB/s eta 0:00:00\n",
"Downloading jmespath-1.0.1-py3-none-any.whl (20 kB)\n",
"Downloading s3transfer-0.10.2-py3-none-any.whl (82 kB)\n",
" ---------------------------------------- 0.0/82.7 kB ? eta -:--:--\n",
" ---------------------------------------- 82.7/82.7 kB 4.5 MB/s eta 0:00:00\n",
"Downloading urllib3-1.26.19-py2.py3-none-any.whl (143 kB)\n",
" ---------------------------------------- 0.0/143.9 kB ? eta -:--:--\n",
" --------------------------------------- 143.4/143.9 kB 8.3 MB/s eta 0:00:01\n",
" ---------------------------------------- 143.9/143.9 kB 2.1 MB/s eta 0:00:00\n",
"Installing collected packages: urllib3, jmespath, botocore, s3transfer, boto3\n",
" Attempting uninstall: urllib3\n",
" Found existing installation: urllib3 2.2.2\n",
" Uninstalling urllib3-2.2.2:\n",
" Successfully uninstalled urllib3-2.2.2\n",
"Successfully installed boto3-1.35.0 botocore-1.35.0 jmespath-1.0.1 s3transfer-0.10.2 urllib3-1.26.19\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n",
"[notice] A new release of pip is available: 23.2.1 -> 24.2\n",
"[notice] To update, run: python.exe -m pip install --upgrade pip\n"
]
}
],
"execution_count": 2
},
{
"cell_type": "markdown",
Expand All @@ -47,9 +124,12 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"metadata": {
"ExecuteTime": {
"end_time": "2024-08-19T01:33:23.365722Z",
"start_time": "2024-08-19T01:33:23.328815Z"
}
},
"source": [
"from langchain_experimental.recommenders import AmazonPersonalize\n",
"\n",
Expand All @@ -61,7 +141,21 @@
" recommender_arn=recommender_arn,\n",
")\n",
"client.get_recommendations(user_id=\"1\")"
]
],
"outputs": [
{
"ename": "ModuleNotFoundError",
"evalue": "No module named 'langchain_experimental'",
"output_type": "error",
"traceback": [
"\u001B[1;31m---------------------------------------------------------------------------\u001B[0m",
"\u001B[1;31mModuleNotFoundError\u001B[0m Traceback (most recent call last)",
"Cell \u001B[1;32mIn[3], line 1\u001B[0m\n\u001B[1;32m----> 1\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01mlangchain_experimental\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mrecommenders\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m AmazonPersonalize\n\u001B[0;32m 3\u001B[0m recommender_arn \u001B[38;5;241m=\u001B[39m \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124m<insert_arn>\u001B[39m\u001B[38;5;124m\"\u001B[39m\n\u001B[0;32m 5\u001B[0m client \u001B[38;5;241m=\u001B[39m AmazonPersonalize(\n\u001B[0;32m 6\u001B[0m credentials_profile_name\u001B[38;5;241m=\u001B[39m\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mdefault\u001B[39m\u001B[38;5;124m\"\u001B[39m,\n\u001B[0;32m 7\u001B[0m region_name\u001B[38;5;241m=\u001B[39m\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mus-west-2\u001B[39m\u001B[38;5;124m\"\u001B[39m,\n\u001B[0;32m 8\u001B[0m recommender_arn\u001B[38;5;241m=\u001B[39mrecommender_arn,\n\u001B[0;32m 9\u001B[0m )\n",
"\u001B[1;31mModuleNotFoundError\u001B[0m: No module named 'langchain_experimental'"
]
}
],
"execution_count": 3
},
{
"cell_type": "markdown",
Expand Down
25 changes: 21 additions & 4 deletions cookbook/autogpt/autogpt.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@
},
{
"cell_type": "code",
"execution_count": 2,
"id": "7c2c9b54",
"metadata": {},
"outputs": [],
"metadata": {
"ExecuteTime": {
"end_time": "2024-08-18T23:40:53.451646Z",
"start_time": "2024-08-18T23:40:53.010817Z"
}
},
"source": [
"from langchain.agents import Tool\n",
"from langchain_community.tools.file_management.read import ReadFileTool\n",
Expand All @@ -42,7 +45,21 @@
" WriteFileTool(),\n",
" ReadFileTool(),\n",
"]"
]
],
"outputs": [
{
"ename": "ModuleNotFoundError",
"evalue": "No module named 'langchain'",
"output_type": "error",
"traceback": [
"\u001B[1;31m---------------------------------------------------------------------------\u001B[0m",
"\u001B[1;31mModuleNotFoundError\u001B[0m Traceback (most recent call last)",
"Cell \u001B[1;32mIn[1], line 1\u001B[0m\n\u001B[1;32m----> 1\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01mlangchain\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01magents\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m Tool\n\u001B[0;32m 2\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01mlangchain_community\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mtools\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mfile_management\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mread\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m ReadFileTool\n\u001B[0;32m 3\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01mlangchain_community\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mtools\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mfile_management\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mwrite\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m WriteFileTool\n",
"\u001B[1;31mModuleNotFoundError\u001B[0m: No module named 'langchain'"
]
}
],
"execution_count": 1
},
{
"cell_type": "markdown",
Expand Down
Loading
Loading