Skip to content

Commit

Permalink
tutorial51
Browse files Browse the repository at this point in the history
  • Loading branch information
ronidas39 committed Mar 26, 2024
1 parent ceb73e6 commit 4eb26a9
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 2 deletions.
Binary file modified .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion tutorial2/single_url.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from langchain.document_loaders import youtube
import io

loader=youtube.YoutubeLoader.from_youtube_url("https://youtu.be/BPqOh0wVBGE")
loader=youtube.YoutubeLoader.from_youtube_url("https://youtu.be/A7ETB5n45rA")
docs=loader.load()
print(docs)
with io.open("transcript.txt","w",encoding="utf-8")as f1:
Expand Down
2 changes: 1 addition & 1 deletion tutorial2/transcript.txt

Large diffs are not rendered by default.

Binary file modified tutorial48/.DS_Store
Binary file not shown.
Binary file added tutorial51/.DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions tutorial51/bucket.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

46 changes: 46 additions & 0 deletions tutorial51/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
from langchain_openai import ChatOpenAI
from langchain.agents import initialize_agent, AgentType
from langchain.tools import Tool
import streamlit as st
import boto3

llm=ChatOpenAI(model="gpt-4",temperature=0.0)
client=boto3.client("s3",region_name="us-east-1")
st.set_page_config(page_title="AWS GPT")
st.header="ask anything related to aws"
input=st.text_input("what you want me to do")

def getS3BucketName(input):
names=[]
buckets=client.list_buckets()["Buckets"]
for bucket in buckets:
names.append(bucket["Name"])
return(names)

def createS3Bucket(input):
response=client.create_bucket(Bucket=input)
data=response["ResponseMetadata"]["HTTPStatusCode"]
if data==200:
return "successfully created"
else:
return "failed to create"


s3name=Tool(
name="BucketNames",
func=getS3BucketName,
description="use to get s3 bucket names using BucketNames tool"
)


s3create=Tool(
name="BucketCreate",
func=createS3Bucket,
description="use to create s3 bucket using BucketCreate tool as per the input name provided for s3 bucket by the end user"
)
tools=[s3name,s3create]
agent=initialize_agent(tools,llm,agent_type=AgentType.ZERO_SHOT_REACT_DESCRIPTION,verbose=True)
if st.button("Submit",type="primary"):
if input is not None:
response=agent.run(input)
st.write(response)
Binary file added tutorial51/tutorial51.pptx
Binary file not shown.

0 comments on commit 4eb26a9

Please sign in to comment.