
LANGCHAIN — Origin Web Browser
Programs must be written for people to read, and only incidentally for machines to execute. — Harold Abelson
The Origin Web Browser project aims to disrupt the traditional browsing experience by organizing browser history into context-aware workspaces with automatically generated summaries, offering semantic search, recommendation systems, and chatbots. This article provides a tech dive into how LangChain was incorporated into the project.
Summarization
The team utilized BeautifulSoup to develop a web scraper for parsing through recently visited websites. LangChain’s ‘map_reduce’ summarization chain was then employed to efficiently summarize large amounts of text using OpenAI embeddings. Here’s a code snippet demonstrating the summarization process:
from bs4 import BeautifulSoup
import requests
from langchain import summarize
# Get webpage content
url = 'https://example.com'
page = requests.get(url)
soup = BeautifulSoup(page.content, 'html.parser')
text = soup.get_text()
# Use LangChain's map_reduce summarization chain
summary = summarize(text)
print(summary)Chatbot
To enable users to interact with their knowledge across hundreds of tabs, a chatbot was implemented. The team followed LangChain’s Chat Your Data example and utilized a web scraper to break down text into smaller chunks, which were then embedded and stored in a vector store. Here’s an example of how the chatbot implementation might look:
from langchain import ChatVectorDBChain
from web_scraper import scrape_data
# Scrape data from web pages
text_data = scrape_data()
# Embed and store in vector store
vector_store = embed_and_store(text_data)
# Serve time chatbot with context from vector store
chatbot = ChatVectorDBChain(vector_store)
response = chatbot.generate_response(user_input)
print(response)Conclusion and Future Direction
The team acknowledges the challenges and considerations for scaling the project, particularly in terms of compute costs with standard GPT-3 models. They also highlight the need for optimizing the costs of using LLMs in real-world applications. Furthermore, they discuss the importance of focusing on key technical features and processes before adding more advanced features to the product.
In summary, the incorporation of LangChain into the Origin Web Browser project demonstrates its potential for enabling advanced text summarization and chatbot functionalities within a browser environment. With clear use cases and code snippets, the article provides valuable insights for developers looking to integrate LangChain into similar projects.






