Skip to content

Assistive-Tech-2307/ai_service

Repository files navigation

README

Table of Contents

About this App

This application is built as a microservice to handle communications with OpenAi specifically in the search for assistive technologies. A FE app or other service can call the endpoints to get data on technologies that can assist individuals with different kinds of disabilities. Data is formatted for ease of use by breaking each technology down into a different object with attributes describing the tech.

Production Sites

Associated Repos

Ruby version

ruby 3.2.2

System dependencies

  • Dependencies are contained in Gemfile, run bundle after cloning repo to install all dependencies

Configuration

  • After cloning repo to your own directory run commands in terminal:
  • bundle install
  • rails db:create
  • To run the server in development env:
  • rails s

Tests

  • to run the test run in terminal:
  • bundle exec rspec

Services

  • Uses OpenAi as a chat service to get back dynamic responses on technologies, can easily be swapped out for another Ai chat services by modifying the base endpoint contained in services/ai_service.rb

Get your own OpenAi api key here https://openai.com/

  • create an account or log-in, then request a new api_key through their dashboard
  • Hide your new key by typing EDITOR="code --wait" rails credentials:edit
  • when the file opens save your new key as
    open_ai:
      key: "Your key here"

Sign up for a Twilio free trial here

  • you will need an account-sid, auth-token, and a phone number
  • hide this by typing EDITOR="code --wait" rails credentials:edit
  • when the file opens save your new information as
twilio:
   account_sid: ACCOUNT_SID_HERE
   auth_token: ACCOUNT_TOKEN_HERE
   phone_number: PHONE_NUMBER_HERE

Endpoints

POST Endpoints

"/api/v1/ai_requests"

example request:
Picture of example request.

  • pass params in the body of the request
  • required params {"tech_needs":[], "disability_description": []}
  • even if only 1 parameter is submitted the value for each key must be an Array
  • returns assistive technologies that the AI finds for the given tech needs and disability description
    example response:
    Picture of response.

"/api/v1/messages"

example request:

{
    "user_phone_number": "+13038830579",
    "title": "NVDA (NonVisual Desktop Access)"
}
  • pass in the user's phone number and title of the tech
  • receieve text message with more detailed information about a tech

successful response:

{
   "message": "Message successfully sent!"
}

DISCLAIMER: Due to the nature of trial Twilio accounts this currently only works when sending to a specific number (one that has been verified). In order to be useful in a larger instance the account would need to be taken out of trial mode.

Get Endpoints

"/api/v1/ai_requests"

example request:
Picture of example request.

  • pass 1 parameter as a query parameter {tech: "name of technology"}
  • returns more detailed information for the queried technology from OpenAi
    example response:
    Picture of response.

Contributors

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages