-
Notifications
You must be signed in to change notification settings - Fork 125
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
Jq #965
base: main
Are you sure you want to change the base?
Conversation
@@ -257,6 +257,7 @@ The `defData` function also supports functions to slice the input rows and colum | |||
- `sliceTail`, number of rows to include from the end | |||
- `sliceSample`, number of rows to pick at random | |||
- `distinct`, list of column names to deduplicate the data based on | |||
- `query`, a [jq](https://jqlang.github.io/jq/) query to filter the data |
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 link to the jq documentation is missing a closing parenthesis. It should be https://jqlang.github.io/jq/
.
AI-generated content by pr-docs-review-commit
missing_jq_link
may be incorrect
LGTM 🚀 The changes in the Specifically:
Therefore, I approve of this PR. 😊
|
## jq | ||
|
||
Apply a [jq](https://jqlang.github.io/jq/) query to a JSON object. | ||
|
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 jq
section is added but lacks an explanation of how to use it with the parsers. Consider providing more details on how to apply a jq query to a JSON object using the parsers.
AI-generated content by pr-docs-review-commit
missing_jq_section
may be incorrect
|
||
```js | ||
const d = parsers.jq(rows, "map({ a })") | ||
``` |
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 jq
example is provided but lacks an explanation of what the code does. Consider adding a brief description or comment to explain the purpose of the example.
AI-generated content by pr-docs-review-commit
missing_jq_example
may be incorrect
The [def](/genaiscript/reference/scripts/context) also supports setting a `detectPromptInjection` flag to apply the detection to each file. | ||
The [def](/genaiscript/reference/scripts/context) | ||
and [defData](/genaiscript/reference/scripts/context) | ||
functions supports setting a `detectPromptInjection` flag to apply the detection to each 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 links to def
and defData
should be formatted as inline code for clarity.
AI-generated content by pr-docs-review-commit
missing_link
may be incorrect
Here are the key enhancements introduced by the changes:
Introduction of JQ Support for Data Querying:
query
option to theDefDataOptions
interface, allowing users to specify a jq query to filter data before rendering. This enables more flexible and powerful data manipulation within prompts.Enhanced Public API Surface:
"packages/core/src/prompt_template.d.ts"
and"packages/core/src/prompt_type.ts"
. ThedefData
function now supports awaiting data, making it more versatile to handle asynchronous data sources.defData
.Improved Prompt Rendering:
renderDefDataNode
function. This change now dynamically handles different data structures and formats, ensuring that prompts are tailored accurately based on the provided data.Internal Logic Improvements:
resolvePromptNode
. Now, the system can more efficiently manage asynchronous data fetching and rendering.Documentation Update: