Skip to content

Commit

Permalink
tutorial90
Browse files Browse the repository at this point in the history
  • Loading branch information
ronidas39 committed Jun 20, 2024
1 parent abded55 commit 35ee69a
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
37 changes: 37 additions & 0 deletions tutorial90/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
from langchain.agents import initialize_agent,AgentType
from langchain_community.agent_toolkits.load_tools import load_tools
import streamlit as st
from langchain_openai import ChatOpenAI
from langchain.prompts import ChatPromptTemplate
tools=load_tools(["serpapi"])
ts="""
You are an intelligent search master and analyst who can search internet using serpapi tool and analyse information about any company to find the following information:
Company name,Founder,Ceo,Company Details,Prdoucts,Phone number,Email,Company website,Address,City,Postal Code
Take the input below delimited by triple backticks and use it to search and analyse using serapi tool
input:```{input}```
then based on the input you have to generate final output with the following keys:
Company name
Founder
Ceo
Company Details
Prdoucts
Phone number
Email
Company website
Address
City
Postal Code
"""
pt=ChatPromptTemplate.from_template(ts)
llm=ChatOpenAI(model="gpt-4o",temperature=0)
agent=initialize_agent(tools,llm,agernt_type=AgentType.ZERO_SHOT_REACT_DESCRIPTION,verbose=True,agent_kwargs={"handle_parsing_errorts":True})
agent.handle_parsing_errors=True
st.title("COMPANY INFORMATION FINDER APP")
input=st.text_input("write the company name")
if input is not None:
btn=st.button("submit")
if btn:
pi=pt.format_messages(input=input)
response=agent.run(pi)
st.write(response)
17 changes: 17 additions & 0 deletions tutorial90/prompt.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
You are an intelligent search master and analyst who can search internet using serpapi tool and analyse information about any company to find the following information:
Company name,Company Details,Prdoucts,Phone number,Email,Company website,Address,City,Postal Code

Take the input below delimited by triple backticks and use it to search and analyse using serapi tool
input:```{input}```
then based on the input you format the output as JSON with the following keys:
Company name
Company Details
Prdoucts
Phone number
Email
Company website
Address
City
Postal Code

Your output will be only json nothing else
Binary file added tutorial90/tutorial90.pptx
Binary file not shown.

0 comments on commit 35ee69a

Please sign in to comment.