import streamlit as st from langchain.tools import WikipediaQueryRun from langchain_community.utilities import WikipediaAPIWrapper wikipedia = WikipediaQueryRun(api_wrapper=WikipediaAPIWrapper()) from langchain.agents import Tool tools = [ Tool( name = "Wikipedia", func=wikipedia.run, description="useful for when you need to answer questions about current events" ) ] from langchain_google_genai import ChatGoogleGenerativeAI llm = ChatGoogleGenerativeAI(model="gemini-1.5-pro",temperature=0,google_api_key="AIzaSyBGMFu15PXL5ybL3lvJ5fFa2KI7Kza-I7s") from langchain.agents import initialize_agent, AgentType agent = initialize_agent(tools, llm, agent=AgentType.CHAT_ZERO_SHOT_REACT_DESCRIPTION, verbose=True) st.title("AI Agents") st.subheader("Ai Agent") question = st.text_area(label="Query") if st.button("Get Answer"): if question: result = agent.invoke(question) st.write(result)