Skip to content

Commit

Permalink
tutorial 74
Browse files Browse the repository at this point in the history
  • Loading branch information
ronidas39 committed Jun 2, 2024
1 parent 70b1382 commit 0347b97
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tutorial74/doc1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

Aiden Blake lives in San Francisco, California. He works as a software engineer at a leading tech company. Aiden is 28 years old.
1 change: 1 addition & 0 deletions tutorial74/doc10.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Ella Parker resides in Portland, Oregon. She is a chef at a popular local restaurant. Ella is 26 years old.
1 change: 1 addition & 0 deletions tutorial74/doc2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Harper Quinn resides in Austin, Texas. She is employed as a marketing manager for a renowned fashion brand. Harper is 32 years old.
1 change: 1 addition & 0 deletions tutorial74/doc3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Liam Carter lives in New York City, New York. He works as an investment banker on Wall Street. Liam is 35 years old.
1 change: 1 addition & 0 deletions tutorial74/doc4.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Ava Morgan resides in Seattle, Washington. She is a graphic designer at a prominent design firm. Ava is 27 years old.
1 change: 1 addition & 0 deletions tutorial74/doc5.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Ethan Hayes lives in Chicago, Illinois. He works as a mechanical engineer at a major manufacturing company. Ethan is 30 years old.
1 change: 1 addition & 0 deletions tutorial74/doc6.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Chloe Bennett resides in Denver, Colorado. She is a school teacher at a well-known elementary school. Chloe is 29 years old.
1 change: 1 addition & 0 deletions tutorial74/doc7.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Noah Riley lives in Miami, Florida. He works as a real estate agent for a top realty company. Noah is 33 years old.
1 change: 1 addition & 0 deletions tutorial74/doc8.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Grace Taylor** resides in Boston, Massachusetts. She is a research scientist at a leading pharmaceutical company. Grace is 31 years old.
1 change: 1 addition & 0 deletions tutorial74/doc9.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Mason Brooks lives in Los Angeles, California. He works as a film director in the Hollywood industry. Mason is 37 years old.
18 changes: 18 additions & 0 deletions tutorial74/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from langchain_openai import ChatOpenAI
from langchain_community.document_loaders import DirectoryLoader
from langchain.prompts import ChatPromptTemplate
from langchain.chains.combine_documents import create_stuff_documents_chain
import os

prompt=ChatPromptTemplate.from_messages(
[
("system","what are everyone's age:\n\n{context}")
]
)
llm=ChatOpenAI(model="gpt-4o")
chain=create_stuff_documents_chain(llm,prompt)
loader=DirectoryLoader(path=os.getcwd(),glob="**/*.txt")
docs=loader.load()
print(len(docs))
response=chain.invoke({"context":docs})
print(response)
Binary file added tutorial74/tutorial74.pptx
Binary file not shown.

0 comments on commit 0347b97

Please sign in to comment.