-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
38 additions
and
34 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,23 @@ | ||
from langchain_community.document_loaders import RedditPostsLoader | ||
from langchain.text_splitter import RecursiveCharacterTextSplitter | ||
from langchain_openai import ChatOpenAI,OpenAIEmbeddings | ||
from langchain_chroma import Chroma | ||
from langchain_community.vectorstores.utils import filter_complex_metadata | ||
from langchain.chains.question_answering import load_qa_chain | ||
import io | ||
from langchain_core.documents import Document | ||
from langchain.chains.combine_documents import create_stuff_documents_chain | ||
from langchain_core.prompts import ChatPromptTemplate | ||
from langchain_openai import ChatOpenAI | ||
llm=ChatOpenAI(model="gpt-4o") | ||
loader=RedditPostsLoader( | ||
client_id="7aJt9CuSBwg4unyMjk8kZg", | ||
client_secret="v1UUmCA4VHU-0MLzzR11pHYv7dRzXA", | ||
user_agent="Sad_Mud_4484", | ||
search_queries=["IndiaCricket"], | ||
mode= "subreddit", | ||
number_posts= 100 | ||
) | ||
docs=loader.load() | ||
ts=RecursiveCharacterTextSplitter(chunk_size=1000,chunk_overlap=20) | ||
sd=ts.split_documents(docs) | ||
vs=Chroma.from_documents(filter_complex_metadata(sd),embedding=OpenAIEmbeddings(),persist_directory="./vs") | ||
vs=Chroma(persist_directory="./vs",embedding_function=OpenAIEmbeddings()) | ||
retriever=vs.as_retriever(k=5) | ||
match_docs=retriever.invoke("india vs newzeland test") | ||
print(match_docs) | ||
chain=load_qa_chain(llm=llm,chain_type="stuff") | ||
response=chain.run(input_documents=match_docs,question="how Washington Sundar performed?") | ||
print(response) | ||
import os,glob | ||
cwd=os.getcwd() | ||
files=glob.glob(cwd+"/*.txt") | ||
documents=[] | ||
for file in files: | ||
with io.open(file,"r",encoding="utf-8")as f1: | ||
data=f1.read() | ||
f1.close() | ||
documents.append(Document(page_content=data,metadata={"title":file.split("\\")[-1]})) | ||
# print(documents) | ||
|
||
prompt=ChatPromptTemplate.from_template("Summarize this content with little bullet :{context}") | ||
chain=create_stuff_documents_chain(llm,prompt) | ||
response=chain.invoke({"context":documents}) | ||
print(response) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
QuantumTech Inc. Unveils Revolutionary Quantum Processor Expected to Transform AI | ||
New York, October 30, 2024 — QuantumTech Inc. announced a major advancement in quantum computing with the introduction of its latest processor, the "Q-Pro 2025." According to the company, this breakthrough promises to process calculations far faster than traditional supercomputers, opening doors to unprecedented applications in artificial intelligence, medicine, and environmental modeling. | ||
|
||
"Q-Pro 2025 will help address some of the world’s most complex challenges," said Dr. Lisa Morgan, CEO of QuantumTech. "From advanced AI algorithms to drug discovery, our quantum processor will redefine what’s possible." Industry experts are calling it a milestone that may push other tech firms to intensify their own quantum research, though widespread commercial use could still be several years away |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
New Biodegradable Solar Panels Could Be Key to Truly Green Energy | ||
Washington D.C., October 30, 2024 — Scientists at the National Renewable Energy Laboratory (NREL) have unveiled the world’s first fully biodegradable solar panels, offering a new solution to reduce environmental waste in renewable energy. Traditional solar panels are challenging to recycle, often containing harmful chemicals, while these new panels are made from organic materials that can naturally decompose. | ||
|
||
Dr. Emily Zhao, who led the NREL team, stated, "This technology allows us to harness solar energy sustainably. We’re excited about the environmental benefits as we work toward mass production." The research team plans to scale up production in the coming year, with hopes that the innovation could lead to greener energy on a global scale. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Tokyo’s New AI Traffic System Aims to Reduce Congestion and Emissions | ||
Tokyo, October 30, 2024 — In a bold step toward sustainable urban planning, the City of Tokyo has announced plans to launch an AI-driven smart traffic management system next year. Using real-time data from vehicles, traffic cameras, and sensors, the AI system will optimize traffic flow, reduce delays, and improve public transportation schedules. | ||
|
||
"With this system, we aim to make daily commuting faster and more efficient, while also reducing the city’s carbon emissions," explained Yuki Tanaka, head of Tokyo’s urban planning department. The AI traffic system is expected to be implemented in phases, starting in high-traffic areas. Once fully operational, it’s anticipated to enhance air quality and make Tokyo’s streets safer for all residents. |
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Binary file removed
BIN
-5.99 MB
tutorial117/vs/60fe07cb-89e6-4bee-8995-d5aa5440933a/data_level0.bin
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.