Git Product home page Git Product logo

sat_bot_demo's Introduction

This is a project demo showing how I would go about implementing the code for an SAT question generator feature which was part of a prompt engineering technical interview.

Feature requirements:

  • We want the AI to create a set of sample questions and choices to be used as practice for the SAT.
  • Assume the UI handles all interaction with the student. We only need to generate questions in a standardized format to pass to the UI.
  • The UI will pass us a theme_string variable that we should use to generate questions with that theme.
  • Generate exactly 5 questions for each category: math, reading, vocabulary.
  • Assume the AI generates good questions by default.

Additional enhancements discussed

  • Add the ability to pass a rubric to the AI to facilitate question creation.
  • We don't want to keep the student waiting while all the questions are generated.
  • Ensure the JSON we pass to the UI is valid

I have created two separate versions of this implementation, the first on the main branch implements all of the logic within the prompt to the AI.

The second on the optimized branch uses python code to:

  • keep track of the questions asked and question numbers
  • pick random categories and ensure they have 5 questions each
  • only ask the AI to generate one question at a time
  • validate the json and generate the question again if it is invalid
  • send the json to the ui (I just built a dummy method for this)

The tests can be run with python test.py in either branch.

If you use pipenv you can install the dependencies with pipenv install, otherwise use pip install -r requirements.txt.

To run the tests you will need an environment variable named OPENAI_API_KEY. This should contain the value of an OpenAI API key. You can add the key to your environment variables, or to a .env file in the root directory.

sat_bot_demo's People

Contributors

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