Skip to content

Commit

Permalink
tutorial50
Browse files Browse the repository at this point in the history
  • Loading branch information
ronidas39 committed Mar 23, 2024
1 parent 3c4e1db commit ceb73e6
Show file tree
Hide file tree
Showing 7 changed files with 43 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/kvd5771UfCY")
loader=youtube.YoutubeLoader.from_youtube_url("https://youtu.be/BPqOh0wVBGE")
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.

3 changes: 3 additions & 0 deletions tutorial50/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
VECTARA_CUSTOMER_ID = 2764105130
VECTARA_CORPUS_ID = 2
VECTARA_API_KEY = zwt_pMDlqgvsbKUz6D3Sql7sFRc_AqLWw_eoBNiC0g
23 changes: 23 additions & 0 deletions tutorial50/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import os
from dotenv import load_dotenv
from langchain_openai import ChatOpenAI
from langchain_community.vectorstores import Vectara
from langchain_community.document_loaders import S3DirectoryLoader
from langchain.chains import ConversationalRetrievalChain
from langchain.memory import ConversationBufferMemory
load_dotenv()
llm=ChatOpenAI(model="gpt-4-turbo-preview",temperature=0.0)
memory=ConversationBufferMemory(memory_key="chat_history",return_messages=True)

vs=Vectara(vectara_customer_id=os.getenv("VECTARA_CUSTOMER_ID"),
vectara_corpus_id=os.getenv("VECTARA_CORPUS_ID"),
vectara_api_key=os.getenv("VECTARA_API_KEY")
)
loader=S3DirectoryLoader("llm-test-2024")
doc=loader.load()

vectara=Vectara.from_documents(doc,embedding=None)
retriever=vectara.as_retriever()
bot=ConversationalRetrievalChain.from_llm(llm,retriever,memory=memory,verbose=False)
result=bot.invoke({"What early civilizations in Greece were influential in shaping Western culture?"})
print(result["answer"])
15 changes: 15 additions & 0 deletions tutorial50/qsn.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
### Questions on the History of Greece:

1. What early civilizations in Greece were influential in shaping Western culture?
2. Who were some of the prominent figures during the Classical period in Greece?
3. Which monumental architectural achievement is associated with the Classical period in Greece?
4. Describe the sequence of dominations Greece went through after the Classical era.
5. How and when did the modern nation of Greece emerge?

### Questions on the History of India:

1. Which civilization is considered one of the world's earliest urban cultures in India?
2. What was the significance of the Vedic period in India?
3. Which empires are considered the golden ages of ancient India?
4. What major changes occurred during Medieval India?
5. How did India achieve independence from British rule?
Binary file added tutorial50/tutorial50.pptx
Binary file not shown.

0 comments on commit ceb73e6

Please sign in to comment.