Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
IT Security NachrichtenIT Security News Hourly Summary 2026-09-22 08h : 8 posts(22.09.2026 um 08:00 Uhr)
IT Security NachrichtenDeutsche Telekom startet internationale Reise-eSIM T-Travel(22.09.2026 um 07:41 Uhr)
IT Security NachrichtenDrei ergänzende Microsoft-365-Apps werden im Dezember eingestellt(22.09.2026 um 07:42 Uhr)
IT Security NachrichtenRechnungshof: EU nicht genug gegen Cyberangriffe gewappnet(22.09.2026 um 07:42 Uhr)
IT NachrichtenThis UCD expert is building advanced quantum sensing tech(22.09.2026 um 08:00 Uhr)
IT NachrichtenHow to watch BJK Cup Finals 2026: Free Streams & Schedule(22.09.2026 um 08:00 Uhr)
IT Security NachrichtenIT Security News Hourly Summary 2026-09-22 08h : 8 posts(22.09.2026 um 08:00 Uhr)
IT Security NachrichtenDeutsche Telekom startet internationale Reise-eSIM T-Travel(22.09.2026 um 07:41 Uhr)
IT Security NachrichtenDrei ergänzende Microsoft-365-Apps werden im Dezember eingestellt(22.09.2026 um 07:42 Uhr)
IT Security NachrichtenRechnungshof: EU nicht genug gegen Cyberangriffe gewappnet(22.09.2026 um 07:42 Uhr)
IT NachrichtenThis UCD expert is building advanced quantum sensing tech(22.09.2026 um 08:00 Uhr)
IT NachrichtenHow to watch BJK Cup Finals 2026: Free Streams & Schedule(22.09.2026 um 08:00 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

🚀 From Agents to Data Intelligence: Load Files, Scrape Web & Analyze with LangChain

In my previous blog, I covered: 👉 From LLMs to Agents: Build Smart AI Systems with Tools in LangChain We learned how to: build custom tools create AI agents fetch real-world data 🔥 What’s Next? Now let’s take it further. 👉 Instead of…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

In my previous blog, I covered:

👉 From LLMs to Agents: Build Smart AI Systems with Tools in LangChain



We learned how to:




  • build custom tools

  • create AI agents

  • fetch real-world data



🔥 What’s Next?



Now let’s take it further.



👉 Instead of just querying tools, we will make AI work with real data sources:



In this blog, we will learn:




  1. 📄 Load and analyze text files

  2. 📊 Process CSV data

  3. 🌐 Fetch and analyze web URLs (web scraping)

  4. ⚡ Optimize using semantic search (vector DB)





📄 1. Load Text File Using TextLoader



We can directly load a *.txt file into LangChain:




from langchain_community.document_loaders import TextLoader

loader = TextLoader("tata_motors.txt")
docs = loader.load()
docs









Output



👉 This converts your text file into structured documents.





Add Queries to fetch result from .txt file





from langchain_community.document_loaders import TextLoader
from langchain_openai import ChatOpenAI
from langchain_core.prompts import ChatPromptTemplate

loader = TextLoader("tata_motors.txt", encoding="utf-8")
docs = loader.load()

# Combine all texts into one single string
context = "\n\n".join(doc.page_content for doc in docs)

# Ask Questions
query = """
How much worth Tata Motors has provided on behalf of its Singapore holding company?
"""

prompt = ChatPromptTemplate.from_template("""
You are a stock research assistant.

Use only the context below.
Do not invent missing values.

User query:
{query}

Context:
{context}
""")

chain = prompt | llm
response = chain.invoke({
"query": query,
"context": context
})

print(response.content)







Output







📊 2. Load CSV Data Using CSVLoader





from langchain_community.document_loaders import CSVLoader

loader = CSVLoader("cars.csv")
data = loader.load()
data







Output







👉 cars.csv file contents





You can also use Pandas for better control:




pip install -U pandas






👉 This allows LLMs to behave like a data analyst on your CSV.




import os
import pandas as pd
from langchain_openai import ChatOpenAI

df = pd.read_csv("cars.csv")
question = "List the cars within 10 Lakhs budget?"

csv_text = df.to_string(index=False)

prompt = f"""
You are answering questions from this CSV data.

CSV data:
{csv_text}

Question:
{question}

Answer clearly using only the CSV data.
"""

response = llm.invoke(prompt)

print(response.content)









Output








🌐 3. Load URLs & Perform Web Scraping



Now comes the powerful part.




pip install -U unstructured






👉 LLM will read web content and generate structured analysis.




from langchain_community.document_loaders import UnstructuredURLLoader

urls = [
"https://www.tickertape.in/stocks/tata-motors-TMC",
"https://groww.in/stocks/tata-motors-ltd",
]

loader = UnstructuredURLLoader(urls=urls)
documents = loader.load()

query = """
Analyze valuation, profitability, entry point, red flags,
and overall whether Tata Motors stock looks attractive.
"""

prompt = f"""
You are a stock research assistant.

Use only the context below. Do not invent missing values.

User query:
{query}

Return the answer in this exact format:

# Tata Motors Stock Analysis

## 1. Quick View
- Overall view:
- Reason:

## 2. Key Metrics Found
| Metric | Value | Interpretation |
|---|---:|---|
| Market Cap | | |
| PE Ratio | | |
| PB Ratio | | |
| Dividend Yield | | |
| Risk / Volatility | | |
| Red Flags | | |

## 3. Valuation

## 4. Profitability / Quality

## 5. Entry Point

## 6. Red Flags / Risks

## 7. Final Tentative View
"""

response = llm.invoke(prompt)

print(response.content)









Output








⚠️ Problem: Slow Performance



If you load many URLs:




  • ⏳ Processing becomes slow

  • 📉 Context becomes too large

  • 💸 Cost increases

  • ⚡ Solution: Semantic Search (Vector DB)



Instead of passing all data, we:




  • Split content into chunks

  • Convert into embeddings

  • Store in vector DB

  • Retrieve only relevant data






⚡ 4. Optimize using semantic search (vector DB)






from langchain_community.document_loaders import UnstructuredURLLoader
from langchain_text_splitters import RecursiveCharacterTextSplitter
from langchain_openai import OpenAIEmbeddings
from langchain_chroma import Chroma

urls = [
"https://www.tickertape.in/stocks/tata-motors-TMC",
"https://groww.in/stocks/tata-motors-ltd",
]

loader = UnstructuredURLLoader(urls=urls)
documents = loader.load()

# Step 1: Split into Chunks
text_splitter = RecursiveCharacterTextSplitter(
chunk_size=1000,
chunk_overlap=200
)

chunks = text_splitter.split_documents(documents)

# Step 2: Create Embeddings + Store
embeddings = OpenAIEmbeddings(model="text-embedding-3-small")

vector_db = Chroma.from_documents(
documents=chunks,
embedding=embeddings,
persist_directory="./chroma_url_db"
)

# Step 3: Retrieve Relevant Data
retriever = vector_db.as_retriever(search_kwargs={"k": 4})
retrieved_docs = retriever.invoke(query)

context = "\n\n".join(
doc.page_content for doc in retrieved_docs
)

query = """
Analyze valuation, profitability, entry point, red flags,
and overall whether Tata Motors stock looks attractive.
"""

prompt = ChatPromptTemplate.from_template("""
You are a stock research assistant.

Use only the context below. Do not invent missing values.

User query:
{query}

Context:
{context}

Return the answer in this exact format:

# Tata Motors Stock Analysis

## 1. Quick View
- Overall view:
- Reason:

## 2. Key Metrics Found
| Metric | Value | Interpretation |
|---|---:|---|
| Market Cap | | |
| PE Ratio | | |
| PB Ratio | | |
| Dividend Yield | | |
| Risk / Volatility | | |
| Red Flags | | |

## 3. Valuation

## 4. Profitability / Quality

## 5. Entry Point

## 6. Red Flags / Risks

## 7. Final Tentative View
""")

context = "\n\n".join(
doc.page_content for doc in retrieved_docs
)

# Step 4: Final Analysis
chain = prompt | llm
response = chain.invoke({
"query": query,
"context": context,
})

print(response.content)









Output





🚀 What You Learned



In this blog, we moved from:

👉 AI Agents → AI + Data Intelligence



You learned how to:




  • Load text and CSV data

  • Scrape and analyze web content

  • Handle large data efficiently

  • Use vector databases for semantic search

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten 🚀 From Agents to Data Intelligence: Load Files, Scrape Web & Analyze with LangChain

Thematisch verwandte Begriffe: From, Agents, Data, Intelligence · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-61647 | NotebookLM MCP is an MCP server and HTTP service for interacting with Go…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick