Giter Site home page Giter Site logo

extra-reasons's Introduction

Extra reasons

Web application based on cohere AI that asks the user for a topic to give reasons about and answers what the cohere generation model suggests.

Required setup to run

In order for the code to run, you need to set some environment variables. I have chosen to have a .htaccess file containing the following information (changing XXXXX by your values):

SetEnv COHERE_API_KEY "BEARER XXXXX"
SetEnv MYSQL_DB_HOST "XXXXX"
SetEnv MYSQL_DB_NAME "XXXXX"
SetEnv MYSQL_DB_USERNAME "XXXXX"
SetEnv MYSQL_DB_PASSWORD "XXXXX"


Also you need to have the database set up as mentioned at the "Database" section of this readme.

Project architecture

This is a very simple project and will just use a very simple frontend and backend.

Frontend

As a frontend, I'll be using a simple web page built in plain html, js and css as it will be a simple page that will be calling the backend with the user input and will display the response.

Backend

As a backend, I'll be using a php file that will capture the user input and call the cohere api using curl. I've chosen this solution to avoid the cohere API key to be visible in the network tab in chrome as a security measure. However, as the task to be executed by the backend is just to proxy the request by now, I opted for a single php file instead of creating a more complex backend project. In addition, to keep a track on what the users are interested on, the "api" stores the search in a mysql database.

Database

As a database to store the user's searches, I have chosen to use a mysql as it's easy to set up and use and fits the needs. The database has only one table called 'searches' that has the following structure:

Field Type Collation Null Default Extra
id int(11) No None AUTO_INCREMENT
prompt varchar(255) utf8mb4_unicode_ci No None
response text No None
timestamp timestamp utf8mb4_unicode_ci No current_timestamp() ON UPDATE CURRENT_TIMESTAMP()

extra-reasons's People

Contributors

jordivx avatar

Stargazers

Full Stack 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.