Giter Club home page Giter Club logo

laravel-ai-client's Introduction

Base client to talk to ChatBot amd Dall-e2 and Soon Other Services

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Going to build some basic Driver like clients to talk to different AI service but like with Laravel Storage it will treat them all the same.

  • ChatGPT for text
  • Jasper when ChatGPT is down :(
  • Dall-2
  • OpenAI Moderator
  • Midjourney - when it gets an api

Installation

You can install the package via composer:

composer require alnutile/laravel-chatgpt

You can then set your .env:

AI_CLIENT=sk-key
AI_MOCK=false

If you set AI_MOCK to true it will just return some fixture data so if you are working in your UI for example it will just show that data.

Usage

Here is an example of

  • Call Moderation to see if the text is ok
  • TextClientFacade to do a text search with adding a prefix to the request
  • SearchResults Event to just let the system know and react to it like make a local copy of the data
  • ModerationFailed Event so you can react to that
$moderationOk = ModerationClientFacade::checkOk(request()->search);
if ($moderationOk == false) {
    ModerationFailed::dispatch(request());
} else {
        $results = TextClientFacade::addPrefix('can you give me tl;dr terms of service for')->text($search);
        SearchResults::dispatch($results);
}

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

laravel-ai-client's People

Contributors

alnutile avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

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