-
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
Refactor code and update documentation #719
Conversation
@@ -36,6 +36,12 @@ import testExplorerAlt from "../../assets/vscode-test-explorer.png.txt?raw" | |||
|
|||
Programmatically assemble prompts for LLMs using JavaScript. | |||
|
|||
```js | |||
$`Analyze ${env.files} and report errors. Use emojis.` | |||
``` |
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.
Invalid JavaScript code snippet, missing closing backtick and parenthesis.
generated by pr-docs-review-commit
invalid_code
``` | ||
|
||
Of course, things can get more complex... | ||
|
||
```js wrap title="extract-data.genai.mjs" | ||
// define the context | ||
def("FILE", env.files, { endsWith: ".pdf" }) |
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.
Typo in the JavaScript code snippet, 'weahter' should be 'weather'.
generated by pr-docs-review-commit
typo
```js | ||
def("FILE", env.files) | ||
``` | ||
|
||
Or filtered, | ||
- filtered, | ||
|
||
```js | ||
def("DOCS", env.files, { endsWith: ".md" }) |
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.
Missing code fence backticks to close the JavaScript code block.
generated by pr-docs-review-commit
missing_code_fence
The changes can be summarized as follows:
Although the changes look good, I have one concern:
However, overall, the code changes look good. LGTM 🚀
|
@@ -105,7 +105,7 @@ export function createChatTurnGenerationContext( | |||
throw new Error(`def ${name} is empty`) | |||
appendChild( | |||
node, | |||
createDefNode( | |||
createDef( | |||
name, | |||
{ filename: "", content: body }, | |||
doptions |
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 function createDefNode
has been renamed to createDef
. If this function is used in other parts of the codebase, those references will need to be updated to reflect this change. This could potentially break the code if not handled properly. 🔄
generated by pr-review-commit
function_rename
The pull request includes several commits that refactor the codebase. The
dedentAsync
function has been removed and thecreateDefNode
function has been refactored tocreateDef
. Unused imports have also been removed from theindent.ts
file. Additionally, the documentation has been updated with examples for usingenv.files
in prompts.docs/src/content/docs/index.mdx
anddocs/src/content/docs/reference/scripts/context.md
.env.files
in a$
call and ways to handle it usingdef
.packages/core/src/indent.ts
by removingdedentAsync
function, and its usage inpackages/core/src/promptdom.ts
has been replaced with asynchronous handling within the 'stringTemplate' case inresolvePromptNode
.createDef
function (renamed fromcreateDefNode
for consistency).createDef
function inpackages/core/src/runpromptcontext.ts
.packages/sample/genaisrc/nested-args.genai.mts
has been added that demonstrates the use of nested arguments for summarizing files.