Skip to content

Commit

Permalink
Update github workflow and langgraph cookbook
Browse files Browse the repository at this point in the history
  • Loading branch information
synacktraa committed Sep 23, 2024
1 parent 267eb40 commit 7ed0648
Show file tree
Hide file tree
Showing 3 changed files with 124 additions and 12 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ name: CI

on:
push:
paths-ignore:
- "cookbooks/**"
branches:
- master
pull_request:
paths-ignore:
- "cookbooks/**"
types: [opened, synchronize, reopened, ready_for_review]

jobs:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/validate-codecov-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@ name: validate-codecov-config

on:
pull_request:
paths-ignore:
- "cookbooks/**"
paths: [codecov.yaml]
push:
paths-ignore:
- "cookbooks/**"
branches: [master]

jobs:
Expand Down
128 changes: 116 additions & 12 deletions cookbooks/langgraph-ollama-example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,51 @@
"cells": [
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n",
"autoform 0.1.0 requires langchain-core<0.3.0,>=0.2.1, but you have langchain-core 0.3.5 which is incompatible.\n",
"autoform 0.1.0 requires pydantic==2.6.4, but you have pydantic 2.9.2 which is incompatible.\n",
"chromadb 0.4.7 requires fastapi<0.100.0,>=0.95.2, but you have fastapi 0.110.1 which is incompatible.\n",
"chromadb 0.4.7 requires pydantic<2.0,>=1.9, but you have pydantic 2.9.2 which is incompatible.\n",
"instructor 0.6.2 requires docstring-parser<0.16,>=0.15, but you have docstring-parser 0.16 which is incompatible.\n",
"instructor 0.6.2 requires typer<0.10.0,>=0.9.0, but you have typer 0.12.3 which is incompatible.\n",
"langchain-anthropic 0.1.11 requires langchain-core<0.2.0,>=0.1.43, but you have langchain-core 0.3.5 which is incompatible.\n",
"langchain-aws 0.1.3 requires langchain-core<0.2.0,>=0.1.45, but you have langchain-core 0.3.5 which is incompatible.\n",
"langchain-community 0.2.17 requires langchain<0.3.0,>=0.2.16, but you have langchain 0.3.0 which is incompatible.\n",
"langchain-community 0.2.17 requires langchain-core<0.3.0,>=0.2.39, but you have langchain-core 0.3.5 which is incompatible.\n",
"langchain-experimental 0.0.53 requires langchain<0.2.0,>=0.1.8, but you have langchain 0.3.0 which is incompatible.\n",
"langchain-experimental 0.0.53 requires langchain-core<0.2.0,>=0.1.27, but you have langchain-core 0.3.5 which is incompatible.\n",
"langchain-google-genai 1.0.3 requires langchain-core<0.2,>=0.1.45, but you have langchain-core 0.3.5 which is incompatible.\n",
"langchain-groq 0.1.3 requires langchain-core<0.2.0,>=0.1.45, but you have langchain-core 0.3.5 which is incompatible.\n",
"langchain-openai 0.1.6 requires langchain-core<0.2.0,>=0.1.46, but you have langchain-core 0.3.5 which is incompatible.\n",
"llama-index 0.8.5.post2 requires langchain<=0.0.266,>=0.0.262, but you have langchain 0.3.0 which is incompatible.\n",
"scrapegraphai 0.10.0 requires langchain==0.1.15, but you have langchain 0.3.0 which is incompatible.\n",
"scrapegraphai 0.10.0 requires tiktoken<0.7.0,>=0.6.0, but you have tiktoken 0.7.0 which is incompatible.\n",
"scrapegraphai 0.10.0 requires tqdm<5.0.0,>=4.66.4, but you have tqdm 4.66.1 which is incompatible.\n",
"spacy 3.7.4 requires typer<0.10.0,>=0.3.0, but you have typer 0.12.3 which is incompatible.\n",
"swiftrank 1.3.0 requires orjson==3.9.10, but you have orjson 3.10.5 which is incompatible.\n",
"swiftrank 1.3.0 requires pydantic==2.6.4, but you have pydantic 2.9.2 which is incompatible.\n",
"swiftrank 1.3.0 requires uvicorn==0.29.0, but you have uvicorn 0.25.0 which is incompatible.\n",
"weasel 0.3.4 requires typer<0.10.0,>=0.3.0, but you have typer 0.12.3 which is incompatible.\n",
"\n",
"[notice] A new release of pip is available: 24.1.1 -> 24.2\n",
"[notice] To update, run: python.exe -m pip install --upgrade pip\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Note: you may need to restart the kernel to use updated packages.\n"
]
}
],
"source": [
"#@title Install and import necessary libraries\n",
"%pip install -qU tool-parse[langchain] langchain-ollama langgraph duckduckgo-search\n",
Expand All @@ -28,9 +70,21 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"[ExtendedStructuredTool(name='search_text', description='Search for text in the web.', func=<function search_text at 0x000001840CC5F910>),\n",
" ExtendedStructuredTool(name='product_info', description='Information about the product.', func=<class '__main__.ProductInfo'>)]"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"async def search_text(\n",
" text: str,\n",
Expand Down Expand Up @@ -69,7 +123,8 @@
" ExtendedStructuredTool(func=search_text),\n",
" ExtendedStructuredTool(func=ProductInfo, name=\"product_info\"),\n",
"]\n",
"# OR # tools = ExtendedStructuredTool.from_objects(search_text, ProductInfo)"
"# OR # tools = ExtendedStructuredTool.from_objects(search_text, ProductInfo)\n",
"tools"
]
},
{
Expand All @@ -81,7 +136,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -99,7 +154,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -127,20 +182,61 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 12,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[AGENT]\n",
"Calling tool:\n",
"name='search_text'\n",
"arguments={'backend': 'lite', 'max_results': 5, 'text': 'langraph docs'}\n",
"------------------------------------------------------------\n",
"['search_text' TOOL OUTPUT]\n",
"[{\"title\": \"LangGraph - LangChain\", \"href\": \"https://www.langchain.com/langgraph\", \"body\": \"LangGraph is a framework for building stateful, multi-actor agents with LLMs that can handle complex scenarios and collaborate with humans. LangGraph Cloud is a service for deploying and scaling LangGraph applications, with a built-in Studio for prototyping, debugging, and sharing.\"}, {\"title\": \"️LangGraph - GitHub Pages\", \"href\": \"https://langchain-ai.github.io/langgraph/\", \"body\": \"LangGraph is a framework for creating stateful, multi-actor applications with LLMs, inspired by Pregel and Apache Beam. It offers cycles, controllability, persistence, human-in-the-loop, and streaming features, and integrates with LangChain and LangSmith.\"}, {\"title\": \"langgraph/README.md at main · langchain-ai/langgraph - GitHub\", \"href\": \"https://github.com/langchain-ai/langgraph/blob/main/README.md\", \"body\": \"LangGraph is a Python framework that allows you to create stateful, multi-actor applications with LLMs, using cycles, controllability, and persistence. Learn how to use LangGraph with LangChain, LangSmith, and Anthropic tools to build agent and multi-agent workflows.\"}, {\"title\": \"️LangGraph.js - GitHub Pages\", \"href\": \"https://langchain-ai.github.io/langgraphjs/\", \"body\": \"LangGraph.js is a low-level framework that allows you to create stateful, multi-actor applications with LLMs, using cycles, controllability, and persistence. Learn how to define graph states, tools, and workflows with examples and integration with LangChain.\"}, {\"title\": \"Tutorials - GitHub Pages\", \"href\": \"https://langchain-ai.github.io/langgraph/tutorials/\", \"body\": \"Learn how to use LangGraph, a framework for building language agents as graphs, through various examples and scenarios. Explore chatbots, code assistants, multi-agent systems, planning agents, reflection agents, and more.\"}]\n",
"------------------------------------------------------------\n",
"[AGENT]\n",
"I found 5 sources related to langraph docs:\n",
"1. [LangGraph - LangChain](https://www.langchain.com/langgraph)\n",
"2. [️LangGraph - GitHub Pages](https://langchain-ai.github.io/langgraph/)\n",
"3. [langgraph/README.md at main · langchain-ai/langgraph - GitHub](https://github.com/langchain-ai/langgraph/blob/main/README.md)\n",
"4. [️LangGraph.js - GitHub Pages](https://langchain-ai.github.io/langgraphjs/)\n",
"5. [Tutorials - GitHub Pages](https://langchain-ai.github.io/langgraph/tutorials/)\n",
"------------------------------------------------------------\n"
]
}
],
"source": [
"query_agent(\"Search 5 sources for langgraph docs using lite backend\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 14,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[AGENT]\n",
"Calling tool:\n",
"name='product_info'\n",
"arguments={'in_stock': True, 'name': 'RTX 4900', 'price': 3500}\n",
"------------------------------------------------------------\n",
"['product_info' TOOL OUTPUT]\n",
"[\"RTX 4900\", 3500.0, true]\n",
"------------------------------------------------------------\n",
"[AGENT]\n",
"The product RTX 4900 is priced at $3,500 and is currently in stock.\n",
"------------------------------------------------------------\n"
]
}
],
"source": [
"query_agent(\"Parse: Product RTX 4900, priced at $3.5k, is in stock.\")"
"query_agent(\"Parse the product: RTX 4900, priced at $3.5k, is in stock.\")"
]
}
],
Expand All @@ -151,7 +247,15 @@
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.11"
}
},
Expand Down

0 comments on commit 7ed0648

Please sign in to comment.