How to prompt ChatGPT to provide full answers, including technical details such as source code?

Hi everyone,
I’m trying to study some IoT codes by ChatGPT help.
How can i get the completely answers from ChatGPT, he very often stop his reply when the answer was still not completed.

Thank you!

3 Likes

You can always ask it to continue its sentence. (ref)

For example

Prompt

Some question

Completion/Answer

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore <rest is missing>

Prompt

continue

Completion/Answer

magna aliqua.

2 Likes

Thanks, i have tried this, but it seem work well for text reply only, with the complex combine codes and explain text, it often give the continue answer not exactly with the previous content.

As a programmer know exactly what you are asking. There is a varition on the continue but it is not widely publized and since I have only used it once can’t say if it is better but noting for the record.

Instead of just continue try using the last partial sentence or lines of code then add continue, e.g.

If the full expected output is (ref)

const matrixA = math.matrix([[0, 1], [2, 3], [4, -5]]);
const matrixB = math.matrix([[1, -1], [-2, 4], [-7, 4]]);

// addition
const matrixAdditionAB = math.add(matrixA, matrixB);
// [ [ 1, 0 ], [ 0, 7 ], [ -3, -1 ] ]

// subtraction
const matrixAdditionAB = math.subtract(matrixA, matrixB);
// [ [ -1, 2 ], [ 4, -1 ], [ 11, -9 ] ]

// multiplication
const matrixK = math.matrix([[0, 1], [2, 3], [4, 5]]);
const matrixL = math.matrix([[2, 4], [6, 2]]);

const matrixKL = math.multiply(matrixK, matrixL);
// [ [ 6, 2 ], [ 22, 14 ], [ 38, 26 ] ]

// division
const matrixY = math.matrix([[0, 2], [2, 4], [4, 6]]);
const matrixZ = math.matrix([[2, 1], [2, 2]]);

const matrixYZ = math.divide(matrixY, matrixZ);
// [ [ -2, 2 ], [ -2, 3 ], [ -2, 4 ] ]

and ChatGPT gives

const matrixA = math.matrix([[0, 1], [2, 3], [4, -5]]);
const matrixB = math.matrix([[1, -1], [-2, 4], [-7, 4]]);

// addition
const matrixAdditionAB = math.

then in the next prompt try

continue

// addition
const matrixAdditionAB = math.

or

// addition
const matrixAdditionAB = math.

continue

Also the sooner you try continuing after the partial completion is written the better it works. In other words if you are waiting for a completion to complete and then do another task and come back to find a partial completion and try this, it will often be seen as a new prompt and start over as opposed to continuing.

YMMV

2 Likes

I usually copy the last line and type “continue from ‘paste’. It def works to let it pick up where it left off, although it doesn’t always continue with the code format if i wanted it to complete a code section. I’ve seen someone say” continue, in code block" but haven’t tried yet. Good luck

3 Likes

Check the max tokens. Sometimes if the prompt is too big, it’s stop when the total tokens reach the max token.

2 Likes

I have had this problem I just interrupt the response because it will go on for a long time.

I then say The last response was interuoted please continue.

If it doesn’t continue correctly tell it to repeat the entire response to your query instead. That almost always works.

You can also go to your query and resubmit it manually, but Chat GPT doesn’t always answer the same and sometimes the 2-5th time answering the same query gets a much better result.

2 Likes

The model produced a complete response, It don’t known that its last response was cut.
If you just type ‘continue’, It will think that the previous response was not enough and reelaborate.

That can produce a lot of incomplete source code. Sometimes having allucinatory code trying to complete the previous good/simple code.

To get the most accurate sequence, the best way I found, is copy all (or most at the end) saying:

Your previous messages was cut, please repeat after:

It will complete the code, or bring a refactored version.

2 Likes

Could you please edit the title of this topic. Your title is very generic but your paticular question is much more specific, e.g. you note that continue works find for just text but that you have complex combine codes, which I have no idea what that means other than it is not simple text. :slightly_smiling_face:

The reason I ask is that there are several good options for your specific case and finding this topic would be much harder without a more specific title.

3 Likes

Hi cehlab14,

I have found a solution which works very good for me. No advanced sorcery but quite reliable:

Input 1 (Prompt & Specification how to awnswer):
Explain different ways to align a CSS-Element.
Split your awnswer in two seperate replys, mark them with (1/2) and (2/2), send me first the first awnswer and when I send “next” send the second one.

Input 2 (let ChatGPT continue)
next

Work’s well for me because you can specify that you want to continue the awnser - also you can check with the (1/X) that you are at the right response.

4 Likes

Thank for your advice, could you give me the suggesstion for this topic ?

Are you asking for more adivse on this or how to make the title more specific?

If you are asking for a more specific title for the topic then perphas

How to prompt ChatGPT to provide full answers, including technical details such as source code?

That was created using ChatGPT, the prompt was

rephrase question, keep to one sentence, this is for a topic title

ChatGPT often stops short of a full answer, in this case something very technical such as source code, how can it be prompted to provovide the answer?

I know I am using the phrase source code and you did not use source code, many programmers do use this site and the phrase source code will grab their attention so that they read this even if it is not something they might currently be seeking but may need in the future.

The real distinction with you question is that normally with just prose continue is more likely to work but with something technical, the last part of the previous completion needs to be included so that the next completion will continue correctly.

1 Like