Giter Site home page Giter Site logo

web_bowsing_agent's Introduction

Web Browsing Agent Sample

tl;dr

This is a sample Web Browsing Agent app that uses LangChain's OpenAIFunctionsAgent and Streamlit's StreamlitCallbackHandler.

You can try this out from this Sample App (OpenAI API key required).

demo.mp4

How it Works

  • The agent uses custom-built DuckDuckGo's search tools and a page retrieval tool to perform web browsing to answer users' questions.
  • It employs an agent that uses OpenAI Function Calling, ensuring stable operation.
  • The agent operates as follows:
    • Considers search keywords based on the users' question
    • Executes the search using the considered keywords
      • The search results include titles, URLs, and snippets
    • Decides which page to view from the search results, retrieves the page content, and reviews the content
      • Writes the final answer if possible; otherwise, retrieves another page if more information is needed
  • Of course, it is also possible to ask additional questions to the agent's answers.
  • You can also check the details of the agent's operation.

Prerequisites

  • You will need OpenAI's API_KEY

Details

Retrieving Page Content

  • Utilizes the from_tiktoken_encoder function of RecursiveCharacterTextSplitter to fetch content in chunks of 1000 tokens.
    • If the agent wish to obtain more content, add a page parameter to fetch the page again
  • As it's a prototype, caching has not been implemented
  • It uses readability and html2text to extract the main body of the page
    • Note that html2text has a GPL3.0 license, so be cautious
  • Some pages on the website load slowly at times, so we have also set up timeouts in requests.

Model

  • Because the number of tokens used can significantly increase when a question and answer interaction occurs, using gpt-4 or gpt-3.5-turbo-16k is recommended.
    • You can select models in sidebar option buttons.

Reference

web_bowsing_agent's People

Contributors

naotaka1128 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.