mirror of
https://github.com/hwchase17/langchain
synced 2024-11-18 09:25:54 +00:00
docs: update slack toolkit ipynb in integration (#19219)
Thank you for contributing to LangChain! - [x] **PR title**: "package: description" - Where "package" is whichever of langchain, community, core, experimental, etc. is being modified. Use "docs: ..." for purely docs changes, "templates: ..." for template changes, "infra: ..." for CI changes. - Example: "community: add foobar LLM" - **PR message**: - **Description:** Update the slack toolkit doc to use an agent that support multiple inputs. Using ReAct agent will cause a ValidationError when invoking the slack tools. This is because the agent return a string like `'{"channel": "C05LDF54S21", "message": "Hello, world!"}'` but the ReAct agent does not support multiple inputs. - **Issue:** This is related to this [Discussion#18083](https://github.com/langchain-ai/langchain/discussions/18083) - **Dependencies:** No dependencies required Additional guidelines: - Make sure optional dependencies are imported within a function. - Please do not add dependencies to pyproject.toml files (even optional ones) unless they are required for unit tests. - Most PRs should not touch more than one package. - Changes should be backwards compatible. - If you are adding something to community, do not re-import it in langchain. If no one reviews your PR within a few days, please @-mention one of baskaryan, efriis, eyurtsev, hwchase17. --------- Co-authored-by: Chester Curme <chester.curme@gmail.com>
This commit is contained in:
parent
ff31cc1648
commit
4761c09e94
@ -124,7 +124,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"from langchain import hub\n",
|
"from langchain import hub\n",
|
||||||
"from langchain.agents import AgentExecutor, create_react_agent\n",
|
"from langchain.agents import AgentExecutor, create_openai_tools_agent\n",
|
||||||
"from langchain_openai import ChatOpenAI"
|
"from langchain_openai import ChatOpenAI"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -135,8 +135,8 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"llm = ChatOpenAI(temperature=0, model=\"gpt-4\")\n",
|
"llm = ChatOpenAI(temperature=0, model=\"gpt-4\")\n",
|
||||||
"prompt = hub.pull(\"hwchase17/react\")\n",
|
"prompt = hub.pull(\"hwchase17/openai-tools-agent\")\n",
|
||||||
"agent = create_react_agent(\n",
|
"agent = create_openai_tools_agent(\n",
|
||||||
" tools=toolkit.get_tools(),\n",
|
" tools=toolkit.get_tools(),\n",
|
||||||
" llm=llm,\n",
|
" llm=llm,\n",
|
||||||
" prompt=prompt,\n",
|
" prompt=prompt,\n",
|
||||||
@ -151,7 +151,9 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"agent_executor.invoke(\n",
|
"agent_executor.invoke(\n",
|
||||||
" {\"input\": \"Send a greeting to my coworkers in the #general channel.\"}\n",
|
" {\n",
|
||||||
|
" \"input\": \"Send a greeting to my coworkers in the #general channel. Note use `channel` as key of channel id, and `message` as key of content to sent in the channel.\"\n",
|
||||||
|
" }\n",
|
||||||
")"
|
")"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user