GithubHelp home page GithubHelp logo

thedayisntgray / react_ai Goto Github PK

View Code? Open in Web Editor NEW
7.0 1.0 0.0 17 KB

ReAct is an llm prompting pattern that enables an LLM to take actions such as searching the web or using a calculator.

Ruby 98.04% Shell 1.96%

react_ai's Introduction

ReactAi

Welcome to react_ai a gemified version of my attempt to recreate the ReAct pattern in Ruby with added features.

Purpose

The ReAct pattern is a technique used to circumvent the limitation LLMs have of only being able to respond past the date they were trained. We do this by prompting our LLM to use tools that we can define for it. Another advantage of using tools is that we can reduce hallucinations and therefore improve accuracy of LLM responses.

If you enjoy this gem you should check out langchain.rb which has a more fully featured implementation of the ReAct pattern with more tools to play with!

Features

Tools

  • Calculator
  • Wikipedia

CLI

  • A simple CLI tool to test prompts

Installation

Install the gem and add to the application's Gemfile by executing:

$ bundle add react_ai

If bundler is not being used to manage dependencies, install the gem by executing:

$ gem install react_ai

Create a .env file in the root directory and add your open-ai key and your're ready to go!๐Ÿ”ฅ

OPEN_AI_KEY='your open ai key'

Usage

You can use this gem via the commmand line after it is installed by typing:

./exe/react_ai "Some prompt for our LLM!"

Here's an example of what a user prompt and subsequent response might look like:

Screen.Recording.2024-01-08.at.10.53.33.PM.mov

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/thedayisntgray/react_ai.

react_ai's People

Contributors

thedayisntgray avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  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.