Skip to content

Generative AI

In this course, all usage of generative AI must be fully cited.

This is to:

  • encourage you to be thoughtful about your usage of these tools as you gain experience programming.
  • help resolve issues if AI-generated code results in code that resembles publicly-available source code.

Note

As noted in the Academic Honesty policy, you are expected to write the majority of your code. If we feel that the usage seems too high on an assignment, following these guidelines will help us provide that feedback without jumping to an academic honesty conversation.

How to Cite

To cite the usage of AI, add a comment above the relevant line(s) of code explaining:

  • what tool you used
  • what queries resulted in the code you wrote
  • what changes you made to the resulting code

This comment should start with # AI (or equivalent if not using Python)

If the comment is longer than a line or two, you should instead move the details into a file named citations.md that is submitted with your assignment.

An acceptable example might look like:

# AI: I couldn't remember the name of the function here and asked
#     ChatGPT "how do you compute the mean of a list in Python?"
mpg_mean = statistics.mean(vehicles_mpg)

Or, alternatively:

// AI: details in citations under "gradient"
const redToBlueHoriz = svg
  .append("defs")
  .append("linearGradient")
  .attr("id", "linear-gradient")
  .attr("x1", "0%")
  .attr("y1", "0%")
  .attr("x2", "100%")
  .attr("y2", "0%");
gradient.append("stop").attr("offset", "0%").attr("stop-color", "red");
gradient.append("stop").attr("offset", "100%").attr("stop-color", "blue");

And in citations.md:

## gradient

I wanted to apply a smooth gradient and asked ChatGPT for an example of a gradient in D3js.

It gave:

// Select the SVG container
const svg = d3.select("svg");

// Define a linear gradient
const gradient = svg.append("defs")
.append("linearGradient")
.attr("id", "linear-gradient")
.attr("x1", "0%")
.attr("y1", "0%")
.attr("x2", "100%")
.attr("y2", "100%");

// Add color stops to the gradient
gradient.append("stop")
.attr("offset", "0%")
.attr("stop-color", "blue");

gradient.append("stop")
.attr("offset", "100%")
.attr("stop-color", "red");

// Use the gradient in a shape
svg.append("rect")
.attr("x", 50)
.attr("y", 50)
.attr("width", 400)
.attr("height", 400)
.style("fill", "url(#linear-gradient)");

This was diagonal, and I wanted my gradient to be horizontal, so I asked it to help with that, and it pointed out that the x1,y1,x2,y2 parameters controlled the direction.

This led to me altering the provided code to get the results I wanted.

Reproducing the entire conversation is not required, but including the code that any assistant gives is required.