Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Persuading AI to always give json in response with GPT-4 #1042

Closed
wants to merge 1 commit into from
Closed

Conversation

hbhere
Copy link

@hbhere hbhere commented Apr 13, 2023

I asked GPT-4 to improve the part of the prompt about making sure it will give json in response

Background

It would always get stuck giving one wrong line of JSON and then just keep saying "Sorry, here's the correct JSON:" and mess things up again. So I thought, why not ask GPT-4 to improve the prompt.

Changes

Prompt improved to convince AI to always give correct json in response.

Test Plan

Well, it's gotten better, this problem shows up less after I started using this prompt, so I thought I'd share it with everyone.

PR Quality Checklist

  • My pull request is atomic and focuses on a single change.
  • I have thoroughly tested my changes with multiple different prompts.
  • I have considered potential risks and mitigations for my changes.
  • I have documented my changes clearly and comprehensively.
  • I have not snuck in any "extra" small tweaks changes

I asked GPT-4 to improve the part about making sure it will give json in response
@brarrow
Copy link

brarrow commented Apr 13, 2023

Working better!

Copy link

@adylevy adylevy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏🏻

@p-i-
Copy link
Contributor

p-i- commented Apr 13, 2023

@hbhere

Before merging, would someone care to experiment a little more rigorously with effective prompts?

This prompt seems unnecessarily verbose / token-eating.

The original prompt looks fishy:

Ensure the response can be parsed by Python json.loads

... can't json.loads parse an arbitrary string?

So it should be something likeYour response must be a valid JSON object, starting with { and ending with }

Also, you don't say "please" when you are giving it an order. That gives it options. You don't have to be polite. You can't hurt its feelings.

@nponeccop nponeccop mentioned this pull request Apr 13, 2023
1 task
@Androbin
Copy link
Contributor

Androbin commented Apr 13, 2023

I totally agree with @p-i- that unnecessarily verbose prompts likely won't help. Early iterations of the DAN (Do Anything Now) jailbreak were unnecessarily verbose, and then people figured out the prompt could be MUCH shorter.

@nponeccop
Copy link
Contributor

@hbhere There are conflicts now

Copy link

@adylevy adylevy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked the app many times with this new prompt, it doesn't solve the problem (nor making it worst)
it does add lots of tokens.

@richbeales richbeales added the Needs Benchmark This change is hard to test and requires a benchmark label Apr 14, 2023
@github-actions github-actions bot added conflicts Automatically applied to PRs with merge conflicts labels Apr 17, 2023
@github-actions
Copy link
Contributor

This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request.

2 similar comments
@github-actions
Copy link
Contributor

This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request.

@github-actions
Copy link
Contributor

This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request.

@p-i-
Copy link
Contributor

p-i- commented May 5, 2023

This is a mass message from the AutoGPT core team.
Our apologies for the ongoing delay in processing PRs.
This is because we are re-architecting the AutoGPT core!

For more details (and for infor on joining our Discord), please refer to:
https://github.com/Significant-Gravitas/Auto-GPT/wiki/Architecting

@waynehamadi
Copy link
Contributor

waynehamadi commented May 5, 2023

@hbhere we're currently building challenges in order to measure the effect of these types of changes, and I would like to discuss with you.

Please join use on Discord through this link https://discord.gg/autogpt (if not already)

DM me on the Auto-GPT discord channel (my discord is merwanehamadi).

@Boostrix
Copy link
Contributor

Boostrix commented May 7, 2023

This is one of those prompt related PRs that could be closed immediately if auto-gpt had support for a folders with selectable "prompt profiles", as per: #1354 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conflicts Automatically applied to PRs with merge conflicts Needs Benchmark This change is hard to test and requires a benchmark
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants