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 runPrompt to import list and create new script for llm-as-expert with Rush albums filter and sorting logic #695

Merged
merged 1 commit into from
Sep 6, 2024
Merged
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
1 change: 1 addition & 0 deletions packages/core/src/importprompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"retrieval",
"fetchText",
"cancel",
"runPrompt",

Check failure on line 28 in packages/core/src/importprompt.ts

View workflow job for this annotation

GitHub Actions / build

The function "runPrompt" is added to the array but its definition is not found in the changes. Please ensure that this function is defined elsewhere in your code. 🧐

Check failure on line 28 in packages/core/src/importprompt.ts

View workflow job for this annotation

GitHub Actions / build

The "runPrompt" function is added to the array but it's not used anywhere in the changes. Please make sure to use it or remove it if it's not necessary. 😊

Check failure on line 28 in packages/core/src/importprompt.ts

View workflow job for this annotation

GitHub Actions / build

The addition of "runPrompt" function in the array seems to be a new feature. Please ensure to add tests for this new functionality to maintain the code quality. 🧪
Copy link

Choose a reason for hiding this comment

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

The function "runPrompt" is added to the array but its definition is not found in the changes. Please ensure that this function is defined elsewhere in your code. 🧐

generated by pr-review-commit missing_function_definition

Copy link

Choose a reason for hiding this comment

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

The "runPrompt" function is added to the array but it's not used anywhere in the changes. Please make sure to use it or remove it if it's not necessary. 😊

generated by pr-review-commit unused_array_item

Copy link

Choose a reason for hiding this comment

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

The addition of "runPrompt" function in the array seems to be a new feature. Please ensure to add tests for this new functionality to maintain the code quality. 🧪

generated by pr-review-commit missing_test

]

const oldGlb: any = {}
Expand Down
85 changes: 85 additions & 0 deletions packages/sample/genaisrc/llm-as-expert.genai.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
script({
model: "openai:gpt-4o",
tests: {
keywords: [
"Permanent Waves",
"Moving Pictures",
"Signals",
"Power Windows",
],
},
})
// https://github.com/Stevenic/agentm-js/blob/main/examples/filter-discography.ts
const rushAlbums = [
"Grace Under Pressure",
"Hemispheres",
"Permanent Waves",
"Presto",
"Clockwork Angels",
"Roll the Bones",
"Signals",
"Rush",
"Power Windows",
"Fly by Night",
"A Farewell to Kings",
"2112",
"Snakes & Arrows",
"Test for Echo",
"Caress of Steel",
"Moving Pictures",
"Counterparts",
"Vapor Trails",
"Hold Your Fire",
]

defData("RUSH_ALBUMS", rushAlbums)

defTool(
"llm-gpt35",
"Invokes gpt-3.5-turbo to execute a LLM request",
{
prompt: {
type: "string",
description: "the prompt to be executed by the LLM",
},
},
async ({ prompt }) => {
const res = await runPrompt(prompt, {
model: "openai:gpt-3.5-turbo",
label: "llm-gpt35",
})
return res.text
}
)

defTool(
"llm-4o",
"Invokes gpt-4o to execute a LLM request",
{
prompt: {
type: "string",
description: "the prompt to be executed by the LLM",
},
},
async ({ prompt }) => {
const res = await runPrompt(prompt, {
model: "openai:gpt-4o",
label: "llm-4o",
})
return res.text
}
)

$`
Filter the list to only include rush albums released in the 1980's.

Sort the result from the previous task chronologically from oldest to newest.

Validate results.

Report as YAML list.

Let's solve this step by step.
Use gpt-3.5 for filter and sort options.
Use gpt-4o for validation.
`