Skip to content

Commit

Permalink
tutorial109
Browse files Browse the repository at this point in the history
  • Loading branch information
ronidas39 committed Aug 25, 2024
1 parent 608e99c commit 3914aa3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tutorial109/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from langchain_community.tools.tavily_search import TavilySearchResults
from langchain_openai import ChatOpenAI
from langchain_core.prompts import ChatPromptTemplate,MessagesPlaceholder
from langchain.agents import create_openai_functions_agent,AgentExecutor
search=TavilySearchResults()
llm=ChatOpenAI(model="gpt-4o")
prompt=ChatPromptTemplate.from_messages(
[
("system","you are an expert in searching internet and returning output with nice formatted paragraphs"),
("human","{input}"),
MessagesPlaceholder(variable_name="agent_scratchpad")
]
)
tools=[search]
agent=create_openai_functions_agent(llm=llm,tools=tools,prompt=prompt)
executor=AgentExecutor(agent=agent,tools=tools,verbose=True)
response=executor.invoke({"input":"what is the latest news in Cricket in as per todays date 25th august , 2024"})
print(response["output"])
Binary file added tutorial109/tutorial109.pptx
Binary file not shown.

0 comments on commit 3914aa3

Please sign in to comment.