GithubHelp home page GithubHelp logo

abhi-37 / simple-chatbot_with_openai_and_openlibrary Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 11 KB

This script creates a simple chatbot that can provide information about books using the Open Library API and engage in conversation using OpenAI's GPT-3.5 model.

Python 100.00%
api books chatbot openai python

simple-chatbot_with_openai_and_openlibrary's Introduction

Simple-chatbot_with_openai_and_openlibrary

Overview This Python program is a simple chatbot that allows users to search for books using the Open Library API. Users can enter the title of a book they're interested in, and the chatbot will retrieve information about the book, including its title, authors, publish year, and publishers.

How It Works Search Functionality: The chatbot prompts the user to enter a book title they want to search for. It then makes a request to the Open Library API using the provided title as the search query.

API Integration: The program sends an HTTP request to the Open Library API endpoint https://openlibrary.org/search.json, passing the user's query as a parameter.

Processing Response: The program receives a JSON response from the API, which contains information about the books matching the search query. It extracts relevant data such as the title, authors, publish year, and publishers from the response.

Display Results: If books matching the query are found, the chatbot displays the information for each book, including its title, authors, publish year, and publishers. If no books are found, it notifies the user accordingly.

Repeat or Quit: After displaying the search results, the chatbot prompts the user to enter another book title to search for. The user can continue searching for books or type 'quit' to exit the program.

Enter Your Search Query: After running the script, you will see a prompt: Enter a book title to search (or 'quit' to exit):. Example Type The Lord of Rings and press Enter.

View the Search Results: The script will search the Open Library database for books matching your query.

Search for Another Book or Quit: After viewing the search results, you can enter another book title to search for more books. If you want to exit the script, simply type quit and press Enter.

Notes Running the Program To run the Book Search Chatbot: Make sure you have Python installed on your system. Download the provided Python script (book_search_chatbot.py) and save it in your desired directory. Open a terminal or command prompt and navigate to the directory where the script is saved. Run the script by executing the command: python book_search_chatbot.py Follow the prompts to search for books by entering their titles. Type 'quit' to exit the program

This chatbot uses the Open Library API to search for books. Since it doesn't require an API key, there's no need to sign up or obtain any credentials to use it. The search functionality may not always return accurate results, depending on the quality and completeness of the data available in the Open Library database.

Dependencies This program requires the requests library to make HTTP requests to the Open Library API. You can install it using pip: pip install requests

simple-chatbot_with_openai_and_openlibrary's People

Contributors

abhi-37 avatar

Stargazers

 avatar

Watchers

 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.