Skip to main contentü¶úÔ∏èüîó LangChainDocsUse casesIntegrationsAPICommunityChat our docsLangSmithJS/TS DocsSearchCTRLKGet startedIntroductionInstallationQuickstartLangChain Expression LanguageInterfaceHow toCookbookLangChain Expression Language (LCEL)Why use LCEL?ModulesModel I/‚ÄãORetrievalChainsMemoryAgentsAgent TypesHow-toAdd Memory to OpenAI Functions AgentRunning Agent as an IteratorReturning Structured OutputCombine agents and vector storesAsync APICreate ChatGPT cloneCustom functions with OpenAI Functions AgentCustom agentCustom agent with tool retrievalCustom LLM agentCustom LLM Agent (with a ChatModel)Custom MRKL agentCustom multi-action agentHandle parsing errorsAccess intermediate stepsCap the max number of iterationsTimeouts for agentsReplicating MRKLShared memory across agents and toolsStreaming final agent outputUse ToolKits with OpenAI FunctionsToolsToolkitsCallbacksModulesSecurityGuidesMoreModulesAgentsHow-toUse ToolKits with OpenAI FunctionsUse ToolKits with OpenAI FunctionsThis notebook shows how to use the OpenAI functions agent with arbitrary toolkits.from langchain.chains import LLMMathChainfrom langchain.llms import OpenAIfrom langchain.utilities import SerpAPIWrapperfrom langchain.utilities import SQLDatabasefrom langchain_experimental.sql import SQLDatabaseChainfrom langchain.agents import initialize_agent, Toolfrom langchain.agents import AgentTypefrom langchain.chat_models import ChatOpenAIfrom langchain.agents.agent_toolkits import SQLDatabaseToolkitfrom langchain.schema import SystemMessageLoad the toolkit:db = SQLDatabase.from_uri("sqlite:///../../../../../notebooks/Chinook.db")toolkit = SQLDatabaseToolkit(llm=ChatOpenAI(), db=db)Set a system message specific to that toolkit:agent_kwargs = {    "system_message": SystemMessage(content="You are an expert SQL data analyst.")}llm = ChatOpenAI(temperature=0, model="gpt-3.5-turbo-0613")agent = initialize_agent(    toolkit.get_tools(),    llm,    agent=AgentType.OPENAI_FUNCTIONS,
This notebook shows how to use the OpenAI functions agent with arbitrary toolkits.
This notebook shows how to use the OpenAI functions agent with arbitrary toolkits. ->: Skip to main contentü¶úÔ∏èüîó LangChainDocsUse casesIntegrationsAPICommunityChat our docsLangSmithJS/TS DocsSearchCTRLKGet startedIntroductionInstallationQuickstartLangChain Expression LanguageInterfaceHow toCookbookLangChain Expression Language (LCEL)Why use LCEL?ModulesModel I/‚ÄãORetrievalChainsMemoryAgentsAgent TypesHow-toAdd Memory to OpenAI Functions AgentRunning Agent as an IteratorReturning Structured OutputCombine agents and vector storesAsync APICreate ChatGPT cloneCustom functions with OpenAI Functions AgentCustom agentCustom agent with tool retrievalCustom LLM agentCustom LLM Agent (with a ChatModel)Custom MRKL agentCustom multi-action agentHandle parsing errorsAccess intermediate stepsCap the max number of iterationsTimeouts for agentsReplicating MRKLShared memory across agents and toolsStreaming final agent outputUse ToolKits with OpenAI FunctionsToolsToolkitsCallbacksModulesSecurityGuidesMoreModulesAgentsHow-toUse ToolKits with OpenAI FunctionsUse ToolKits with OpenAI FunctionsThis notebook shows how to use the OpenAI functions agent with arbitrary toolkits.from langchain.chains import LLMMathChainfrom langchain.llms import OpenAIfrom langchain.utilities import SerpAPIWrapperfrom langchain.utilities import SQLDatabasefrom langchain_experimental.sql import SQLDatabaseChainfrom langchain.agents import initialize_agent, Toolfrom langchain.agents import AgentTypefrom langchain.chat_models import ChatOpenAIfrom langchain.agents.agent_toolkits import SQLDatabaseToolkitfrom langchain.schema import SystemMessageLoad the toolkit:db = SQLDatabase.from_uri("sqlite:///../../../../../notebooks/Chinook.db")toolkit = SQLDatabaseToolkit(llm=ChatOpenAI(), db=db)Set a system message specific to that toolkit:agent_kwargs = {    "system_message": SystemMessage(content="You are an expert SQL data analyst.")}llm = ChatOpenAI(temperature=0, model="gpt-3.5-turbo-0613")agent = initialize_agent(    toolkit.get_tools(),    llm,    agent=AgentType.OPENAI_FUNCTIONS,