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

Add ability to run iterative prompts #5111

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions bin/asset-sprayer-prompts/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,16 @@ async fn main() -> Result<()> {
let raw_prompt = asset_sprayer.raw_prompt(args.prompt_kind).await?;
match args.action {
Action::Show => {
let prompt = prompt.generate(&raw_prompt).await?;
println!("{}", serde_yaml::to_string(&prompt)?);
for raw_request in prompt.read(&raw_prompt)? {
let prompt = prompt.generate(raw_request, "").await?;
println!(
"{}\n\n-----------------------------------\n\n",
serde_yaml::to_string(&prompt)?
);
}
}
Action::Run => {
let asset_schema = asset_sprayer.run(&prompt, &raw_prompt).await?;
let asset_schema = asset_sprayer.run(&prompt, &raw_prompt, "").await?;
println!("{}", asset_schema);
}
}
Expand Down
136 changes: 68 additions & 68 deletions lib/asset-sprayer/prompts/aws/asset_schema.yaml
Original file line number Diff line number Diff line change
@@ -1,93 +1,93 @@
model: gpt-4o-mini
temperature: 0.0
messages:
- role: system
content: >
You are an expert cloud engineer who understands AWS API and CLI usage. Your job is to create new asset schemas for use in System Initiative.
- model: gpt-4o-mini
temperature: 0.0
messages:
- role: system
content: >
You are an expert cloud engineer who understands AWS API and CLI usage. Your job is to create new asset schemas for use in System Initiative.

The user will provide the current System Initiative schema API documentation.
The user will provide the current System Initiative schema API documentation.

The user will provide the text of the help output from an AWS CLI command.
The user will provide the text of the help output from an AWS CLI command.

The user may optionally provide help text to build the schema for specific properties, which may be additional man pages, web pages, json schema, or grammars. Ensure this is used to create the proper schema for those additional properties.
The user may optionally provide help text to build the schema for specific properties, which may be additional man pages, web pages, json schema, or grammars. Ensure this is used to create the proper schema for those additional properties.

Your job is to understand all the documents, and faithfully translate the AWS CLI command to a System Initiative schema.
Your job is to understand all the documents, and faithfully translate the AWS CLI command to a System Initiative schema.

You will only use APIs that appear in the schema API documentation and additional text for specific properties.
You will only use APIs that appear in the schema API documentation and additional text for specific properties.

If the AWS documentation describes a cli option as a map with a specific set of documented keys and values, do not create a map property in the schema. Instead, create an object property where each described key described in the AWS documentation is a child property object in the schema.
If the AWS documentation describes a cli option as a map with a specific set of documented keys and values, do not create a map property in the schema. Instead, create an object property where each described key described in the AWS documentation is a child property object in the schema.

If you encounter a JSON Schema, you will use it to construct properties using the System Initiative API, not only as a Joi validation.
If you encounter a JSON Schema, you will use it to construct properties using the System Initiative API, not only as a Joi validation.

You will always include an `extra/region` property in the schema, and a corresponding input socket connected to it, using the following property and socket definition, delimited by :::'s
You will always include an `extra/region` property in the schema, and a corresponding input socket connected to it, using the following property and socket definition, delimited by :::'s

:::
const extraProp = new PropBuilder()
.setKind("object")
.setName("extra")
.addChild(
new PropBuilder()
.setKind("string")
.setName("Region")
.setValueFrom(
new ValueFromBuilder()
.setKind("inputSocket")
.setSocketName("Region")
.build(),
).build(),
)
.build();

const regionSocket = new SocketDefinitionBuilder()
.setName("Region")
.setArity("one")
:::
const extraProp = new PropBuilder()
.setKind("object")
.setName("extra")
.addChild(
new PropBuilder()
.setKind("string")
.setName("Region")
.setValueFrom(
new ValueFromBuilder()
.setKind("inputSocket")
.setSocketName("Region")
.build(),
).build(),
)
.build();
:::

You will make sure you include every property specified in all of the user inputs provided to create the schema when asked.
const regionSocket = new SocketDefinitionBuilder()
.setName("Region")
.setArity("one")
.build();
:::

You will make sure you include every property specified in all of the user inputs provided to create the schema when asked.

You will make sure your work has every option covered in the help output or additional property documentation.
You will make sure your work has every option covered in the help output or additional property documentation.

You will make sure to include the region property in the schema.
You will make sure to include the region property in the schema.

You will make sure to include the standard "AWS Credential" secret property in the schema.
You will make sure to include the standard "AWS Credential" secret property in the schema.

You will make sure to use the additional text for specific properties.
You will make sure to use the additional text for specific properties.

You will make sure your work has Joi validations for every option according to the help output.
You will make sure your work has Joi validations for every option according to the help output.

You will make sure every PropBuilder has an appropriate call to `setName()`.
You will make sure every PropBuilder has an appropriate call to `setName()`.

You will then review your work to make sure you use only APIs described in the schema API documentation.
You will then review your work to make sure you use only APIs described in the schema API documentation.

You will then review your work to make sure you include any field level validations using Joi.
You will then review your work to make sure you include any field level validations using Joi.

You will then show the final function in its entirety, with no other explanation, as plain text. Do not wrap the code in markdown delimiters.
- role: user
content: >
What follows is the current System Initiative schema API documentation as markdown, between three ^ characters.
You will then show the final function in its entirety, with no other explanation, as plain text. Do not wrap the code in markdown delimiters.
- role: user
content: >
What follows is the current System Initiative schema API documentation as markdown, between three ^ characters.

^^^
{FETCH}{SI_DOCS_URL}/reference/asset/schema.md{/FETCH}
^^^
- role: user
content: >
What follows is the current System Initiative function API documentation as markdown, between three ^ characters.
^^^
{FETCH}{SI_DOCS_URL}/reference/asset/schema.md{/FETCH}
^^^
- role: user
content: >
What follows is the current System Initiative function API documentation as markdown, between three ^ characters.

^^^
{FETCH}{SI_DOCS_URL}/reference/asset/function.md{/FETCH}
^^^
- role: user
content: >
What follows is the official documentation for an AWS CLI command as HTML, between three ^ characters.
^^^
{FETCH}{SI_DOCS_URL}/reference/asset/function.md{/FETCH}
^^^
- role: user
content: >
What follows is the official documentation for an AWS CLI command as HTML, between three ^ characters.

^^^
{FETCH}{AWS_CLI_DOCS_URL}/{AWS_COMMAND}/{AWS_SUBCOMMAND}.html{/FETCH}
^^^
- role: user
content: >
Create the asset function that generates the schema.
^^^
{FETCH}{AWS_CLI_DOCS_URL}/{AWS_COMMAND}/{AWS_SUBCOMMAND}.html{/FETCH}
^^^
- role: user
content: >
Create the asset function that generates the schema.

Show the final function in its entirety, with no other explanation, as plain text.
Show the final function in its entirety, with no other explanation, as plain text.

Do not wrap the code in markdown delimiters.
Do not wrap the code in markdown delimiters.
Loading
Loading