What is suffix and prefix prompt in openai Codex?

I have been trying to understand what is the suffix prompt in addition to the prefix prompt in Codex.

They have provided an example

def get_largest_prime_factor(n):
    if n < 2:
        return False
    def is_prime(n): >  for i in range(2, n): >  if n % i == 0: >  return False >  return True >     largest = 1
    for j in range(2, n + 1):
        if n % j == 0 and is_prime(j):
    return largest

From this example it is not clear to me how to create a suffix prompt?

Are they referring to > as the suffix prompt?

How to delineate the suffix prompt?

2 Likes

it’s for the insert mode. you don’t need it in regular completions

@nunodonato my use case is insert mode i.e. code needs to be updated in the middle of a code snippet.

Can you please clarify how can I delineate the suffix prompt so that model would work in an insert mode.

1 Like

suffix is the text that comes after the insertion point.
So if you have in the playground something like

line1
[insert]
line2

in the API, it would become
prompt: line1
suffix: line2

Is using suffix mode really necessary?

Lets say if I give demonstrations like the following before prompting Codex:

# sample1
line1
[insert]
line2
insert = something

# sample2
line445
[insert]
line446
insert = something else

line888
[insert]
line889

And then if I query Codex, I suppose it will do the auto complete itself. So why do we need the suffix?