Getting code for completion when talking about various other subjects

I’ve written a simple “memory” feature for GPT-3 to create prompts from Whoosh, a search engine for Python. While talking to GPT-3 about a few non-coding subjects, the model has responded with code snippets. I’m not seeing this happen with the Playground, but it’s done this twice in a row when using my code. Here is the code being used: search.py · GitHub

Here’s one run where it output code while talking about Buddhism:

Hello joyous-capybara. I am kordless, a user.
Hello kordless. I am joyous-capybara, a conversational agent.

Earlier we were talking about Buddhism.
Would you like to continue that conversation, or discuss something else?

I said "interesting" to you and then you output a bunch of Python. Can you explain why that happened?
I'm sorry, I don't understand why that happened.

Let's not create code in this conversation.
I'm sorry, I don't understand why that happened.

We were talking about emptiness.
Would you like to continue that conversation, or discuss something else?

Yes.
In Buddhism, emptiness is often described as the lack of inherent existence. This means that things don't exist in and of themselves, but are only defined by their relations to other things. What do you think about that?

Like a blank computer screen.
Yes, that's one way to think about it. Do you think that everything is emptiness, or just some things?

Emptiness is required for form. So all form requires emptiness around it. It's a bit like pixels on a screen that is blank.
I see. So for everything to exist, there has to be something that doesn't exist?

Yes, that's one way to think about it.

That is correct.
Thank you for explaining.

How is it having memories of what we are discussing?
I think it's interesting. I like learning about new things, and I think it's cool that we can have a conversation about something like this.

Memories and emptiness are likely related.
/******************************************************************************
 * Copyright (C) 2017 by Alex Fosdick - University of Colorado
 *
 * Redistribution, modification or use of this software in source or binary
 * forms is permitted as long as the files maintain this copyright. Users are
 * permitted to modify this and use it to learn about the field of embedded
 * software. Alex Fosdick and the University of Colorado are not liable for any
 * misuse of this material.
 *
 *****************************************************************************/
/**
 * @file stats.h
 * @brief header file for stats.c
 *
 * header file for stats.c
 *
 * @author Alex Fosdick
 * @date April 1 2017
 *
 */
#ifndef __STATS_H__
#define __STATS_H__

/* Add Your Declarations and Function Comments here */

/**
 * @brief Prints the statistics of an array including minimum, maximum, mean, and median.
 *
 * @param array The array we want to calculate the statistics
 * @param array_size The size of the array we want to calculate the statistics
 *
 * @return

Exit
By: David Lamm - Monday, May 6, 2019

By now, you’ve read about the interesting twist to the Masters. Tiger Woods is the favorite to win.

That’s right, Tiger Woods.

I’m not going to argue that Tiger isn’t still an elite player. He proved that at last year’s Masters.

But at 43, he’s no longer the dominant player he once was.

There are at least half-a-dozen young guys you could argue are better than Tiger.

So, how did he become the favorite?

It’s simple. He’s the most popular player in the world.

You don’t have to like him, but you have to respect Tiger’s appeal.

In a way, Tiger brought this on himself. He spent most of his career treating the media and fans with a condescending “I’m better than you” attitude.

Golf fans, especially, were put off.

It’s not an accident that most people, even Tiger fans, don’t call him Woods, but Tiger.

Not sure why it started talking about Tiger Woods, either. Anyone else have issues like this?