-
Notifications
You must be signed in to change notification settings - Fork 126
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
parameter fix #629
parameter fix #629
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,20 +24,21 @@ | |
items: promptParameterTypeToJSONSchema(t[0]), | ||
} | ||
else if ( | ||
typeof t === "object" && | ||
["number", "integer", "string", "object"].includes((t as any).type) | ||
) | ||
["number", "integer", "string", "boolean", "object"].includes( | ||
(t as any).type | ||
) | ||
) { | ||
return < | ||
| JSONSchemaNumber | ||
| JSONSchemaString | ||
| JSONSchemaBoolean | ||
| JSONSchemaObject | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The types
|
||
>t | ||
// TODO better filtering | ||
else if (typeof t === "object") | ||
} else if (typeof t === "object") | ||
return <JSONSchemaObject>{ | ||
type: "object", | ||
properties: Object.fromEntries( | ||
Check failure on line 41 in packages/core/src/parameters.ts GitHub Actions / build
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The object type is being set to "object" without any checks. This could lead to unexpected behavior if
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The properties of the object are being set using
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The object creation
|
||
Object.entries(t).map(([k, v]) => [ | ||
k, | ||
promptParameterTypeToJSONSchema(v), | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
script({ | ||
model: "openai:gpt-4-32k", | ||
files: [], | ||
temperature: 1, | ||
title: "pr-describe", | ||
system: ["system", "system.fs_find_files", "system.fs_read_file"], | ||
}) | ||
|
||
const defaultBranch = (env.vars.defaultBranch || "main") + "" | ||
const { text, finishReason, error } = await runPrompt(async (_) => { | ||
const { stdout: changes } = await host.exec("git", [ | ||
"diff", | ||
defaultBranch, | ||
"--", | ||
".", | ||
":!**/genaiscript.d.ts", | ||
":!**/*sconfig.json", | ||
":!genaisrc/*", | ||
":!.github/*", | ||
":!.vscode/*", | ||
":!*yarn.lock", | ||
":!*THIRD_PARTY_LICENSES.md", | ||
]) | ||
|
||
_.def("GIT_DIFF", changes, { | ||
language: "diff", | ||
maxTokens: 20000, | ||
}) | ||
|
||
_.$`You are an expert software developer and architect. | ||
|
||
## Task | ||
|
||
Create a pull request title and description for the changes in GIT_DIFF. | ||
|
||
The first line of the response should be the title of the pull request, the rest should be the description. | ||
|
||
<title> | ||
<description...> | ||
|
||
## Title Instructions | ||
|
||
- the title should be less than 50 characters | ||
|
||
## Description Instructions | ||
|
||
- do NOT explain that GIT_DIFF displays changes in the codebase | ||
- try to extract the intent of the changes, don't focus on the details | ||
- use bullet points to list the changes | ||
- use emojis to make the description more engaging | ||
- focus on the most important changes | ||
- ignore comments about imports (like added, remove, changed, etc.) | ||
- the public API is defined in "packages/core/src/prompt_template.d.ts" and "packages/core/src/prompt_type.ts". | ||
Changes in those files are "user facing". | ||
` | ||
}) | ||
|
||
// exec output | ||
console.log(error) | ||
console.log(text) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
script({ | ||
title: "summarize with max tokens", | ||
model: "openai:gpt-3.5-turbo", | ||
files: ["src/rag/*"], | ||
tests: { | ||
files: ["src/rag/*"], | ||
keywords: ["markdown", "lorem", "microsoft"], | ||
}, | ||
}) | ||
|
||
def("FILE", env.files, { maxTokens: 20 }) | ||
def("FILE", env.files, { maxTokens: 40 }) | ||
|
||
$`Summarize each file. Be concise.` | ||
$`Extract keywords for the contents of FILE.` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type check
(t as any).type
might not be safe. Consider using a type guard function to ensuret
is of the expected type. 🛡️