-
Notifications
You must be signed in to change notification settings - Fork 36
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
📝 docs: improve askAI plugin documentation #630
base: main
Are you sure you want to change the base?
Conversation
Updates documentation for the askAI plugin and FAQ sections to provide clearer information about data privacy, API usage, and supported features. Includes better formatting, more precise descriptions of the plugin's functionality, and improved examples of how to use the askAI integration with OpenAI's latest model. The documentation now better explains the data privacy implications of using AI features and provides more accurate technical details about the OpenAI integration. The FAQ section has been streamlined for better readability and understanding of gitStream's capabilities.
Hi, I’m Jit, a friendly security platform designed to help developers build secure applications from day zero with an MVS (Minimal viable security) mindset. In case there are security findings, they will be communicated to you as a comment inside the PR. Hope you’ll enjoy using Jit. Questions? Comments? Want to learn more? Get in touch with us. |
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.
Orca Security Scan Summary
Status | Check | Issues by priority | |
---|---|---|---|
Passed | Infrastructure as Code | 0 0 0 0 | View in Orca |
Passed | Secrets | 0 0 0 0 | View in Orca |
Passed | Vulnerabilities | 0 0 0 0 | View in Orca |
…ntax Documentation has been updated to be more precise about data sharing in gitStream and to fix syntax in the askAI plugin example. The parameter type for the token argument has been corrected from Object to string in the JSDoc comments to better reflect its actual type.
Improves documentation for askAI features by standardizing titles, descriptions, and formatting across all automation files. Updates prompts to be more specific and adds consistent footers to AI responses. Makes labels formatting consistent using backticks and enhances readability of configuration descriptions.
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.
I have a few comments, but nothing that should block publishing these changes.
## gitStream askAI: recommended documentation for this PR 📑 | ||
{{ source | askAI("experienced technical writer focused on documentation", | ||
"Review the PR code diff. |
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.
I'm concerned about putting the prompt info into the CM file, rather than incorporating it into the plugin code because this has a risk of becoming messy if we build out additional use cases this way.
Is it possible to incorporate the prompt into the plugin? I'm imagining it as a JSON file that's pulled into the code for easy updates.
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.
@BenLloydPearson One way we could do this is using the gitStream readFile
filter in a .cm
config to import *.txt
files from a askAI/prompts/
folder as strings. Then we could maintain the prompts there or even use multiple readFile
function calls to "build" a prompt for each use case. Something like this:
automations:
ask_ai_summarize:
if:
- true
run:
- action: add-comment@v1
args:
comment: |
{{ TITLE }}
{{ source | askAI(ROLE, PROMPT, env.OPEN_AI_TOKEN) }}
TITLE: ## gitStream askAI: summary for this PR 📜
ROLE: {{ "./.cm/plugins/filters/askAI/prompts/PR_summary_role.txt" | readFile() }}
PROMPT: {{ "./.cm/plugins/filters/askAI/prompts/PR_summary_prompt.txt" | readFile() }}
Using variables in this approach makes it so each AI automation uses the same base configuration, and you simply adjust behavior by swapping in and out prompts. I think a small folder of combinable prompts is the good way to approach this for longevity while keeping it flat and intuitive, but open to more brainstorming here.
Alternatively, we could change the plugin's .js
file to load prompts this way, but feels less composable for dev adoption in the long run. @PavelLinearB probably has an opinion on a good approach.
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.
I love this solution.
I think your naming convention for the txt files should work, but just be wary that we'll want to make sure we follow something that's consistent, descriptive, and sorts properly alphabetically (i.e. the prompt and role should appear next to each other when viewed inside the directory.) I believe your convention should check all these boxes, and we can adjust in the future if we find too many edge cases.
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.
Using the ReadFile filter looks great imo! It will require a bit more work from users tho, but once we'll open PRs to install automations this will be super easy and neat
The documentation titles and descriptions are now more clear and consistent. The changes make the purpose of each AI integration more explicit and actionable. For example, "Ask AI to Review a PR" becomes "Ask AI for a PR Review Checklist" which better describes the actual functionality.
A screenshot of the relevant part of docs after the changes is a life saver 🛟 |
/gs run `{{ source | LinearB_AI(prompt="Perform a detailed code review of the provided code diff. For each modified file:
Focus strictly on actionable, specific feedback. Avoid generic comments, restating existing changes, or unrelated observations.") }}` /gs_run_result Documentation Consistency Issue - askAI plugin references (multiple files)Several documentation files have inconsistent quotation marks around label values: # Before
The PR has a label "askai tests"
The PR has a label "askai cr"
The PR has a label "askai document"
# After
The PR has a label `askai tests`
The PR has a label `askai cr`
The PR has a label `askai document` Update all askAI plugin documentation to use consistent backticks for label references to improve readability and follow technical documentation best practices. Affected files:
API Documentation Issue - plugins/filters/askAI/index.js:1-10The JSDoc comments have incorrect parameter type and inconsistent documentation: // Before
* @param {Object} token - The token to the AI model.
* @example {{ branch | generateDescription(pr, repo, source) }}
// After
* @param {string} token - Your OpenAI API token.
* @example {{ source | askAI("Experienced developer", "Summarize the changes in this PR in bullet points.", env.OPEN_AI_TOKEN) }} Update the JSDoc comments to:
This improves API documentation accuracy and helps developers use the plugin correctly. Content Structure Issue - docs/integrations/askAI.md:1-43The ordering of askAI use cases is inconsistent and could be better organized: Current order:
1. Summarize PR
2. PR Review Checklist
3. PR Improvements
4. Documentation
5. Tests
Suggested order:
1. Summarize PR (High-level overview)
2. PR Review Checklist (Detailed analysis)
3. PR Improvements (Actionable changes)
4. Documentation (Supporting materials)
5. Tests (Quality assurance) Reorder the sections to follow a logical progression from high-level overview to specific implementations. This improves readability and helps users better understand the capabilities progression. Formatting Issue - docs/downloads/automation-library/integrations/askAI/*.cm filesThe comment headers in AI automation files have inconsistent formatting: # Before
# ✨ gitStream Review ✨
# After
## gitStream askAI: <purpose> for this PR <emoji> Standardize the comment headers across all askAI automation files to use:
This improves visual consistency and makes automation outputs more immediately recognizable. Affected files:
|
/gs run `{{ source | LinearB_AI(prompt="Perform a precise code review based on the provided diff. Identify only necessary changes (e.g., bugs, performance, readability, maintainability). Ignore descriptions of already implemented changes. For each issue:
🚫 Avoid redundant changes (e.g., reformatting without actual improvement). Focus only on essential, high-impact improvements.") }}` /gs_run_result Improvement - plugins/filters/askAI/index.js (Line 98)The filter function for array context could be simplified and fixed. Current implementation has a bug where it filters the context twice: - return context.filter(element =>
- typeof element !== 'object' ? true : context.filter(shouldIncludeFile)
- );
+ return context.filter(element =>
+ typeof element !== 'object' || shouldIncludeFile(element)
+ ); This change:
Improvement - askAI config files (Multiple files)The AI prompts across config files should include a consistent footer message. Add to all askAI_*.cm files: comment: |
{{ source | askAI(...) }}
+ ---
+ _Generated by gitStream askAI using GPT-4. Human review recommended._ This improves:
Optional format improvement - docs/automations/integrations/askAI/*/README.md (Multiple files)The example section formatting in askAI documentation could be standardized across all files for better readability: # Title
-<!-- --8<-- [start:example]-->
-Description text.
+<!-- --8<-- [start:example]-->
+## Overview
+Description text.
+
+## Usage
!!! info "Configuration Description" This improves:
|
/gs run `{{ source | LinearB_AI(prompt="Review the provided code diff and identify only necessary changes (bugs, performance, readability, maintainability). Ignore already implemented changes. For each issue: Use a collapsible section: /gs_run_result Readability - docs/automations/integrations/askAI/code-review/README.md- If all functions are covered completely, return 'no tests to suggest.'
+ If all functions are covered, return 'No additional tests needed.' Consistent messaging with other code review sections. Enhancement - docs/downloads/automation-library/integrations/askAI/askAI_CR.cm args:
comment: |
## gitStream askAI: code review checklist for this PR ✨
+ <!-- START gitStream Code Review -->
{{ source | askAI("experienced software developer focused on code reviews",
"Review the PR code diff.
- Identify bugs, security risks, and performance issues.
- Check for deprecated methods and style guide violations.
- Suggest specific improvements based on the changes.
- Provide a code review checklist that can be utilized by a human reviewer.", env.OPEN_AI_TOKEN) }}
_This response was generated by the gitStream askAI plugin._
+ <!-- END gitStream Code Review --> Adds HTML comments to clearly mark generated content sections for parsing. Consistency - plugins/filters/askAI/index.js and reference.md- model: 'gpt-4o-2024-08-06',
+ model: 'gpt-4', // Update to latest stable model version Ensures consistent model version reference across documentation and code. These changes improve code organization, readability and maintainability while keeping functionality intact. |
## gitStream askAI: recommended documentation for this PR 📑 | ||
{{ source | askAI("experienced technical writer focused on documentation", | ||
"Review the PR code diff. |
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.
Using the ReadFile filter looks great imo! It will require a bit more work from users tho, but once we'll open PRs to install automations this will be super easy and neat
|
||
Like any other CI/CD automation, the source code is being scanned in the repo and is not shared with any external services. Only metadata related to and affecting the workflow is shared to allow rule-based automation on the repo. | ||
Like any other CI/CD automation, the source code is being scanned in the repo and is not shared with any external services. By default, only metadata related to and affecting the workflow is shared to allow rule-based automation on the repo. Your own gitStream plugins that may connect to other services, such as using the [`askAI`](/filter-function-plugins/#askai) plugin which will provide context to the configured model provider. |
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.
I think we should also add that the user fully controls the data that is shared with LinearB or any other service as they have the control over the arguments for each filter
Co-authored-by: Pavel Vaks <[email protected]>
gitStream review assistantEnhancement - askAI_CR.cm (Line 17)Improve the AI role prompt by being more specific about the code review focus: - {{ source | askAI("Code reviewer",
+ {{ source | askAI("experienced software developer focused on code reviews", This change makes the AI role more specific and helps generate more focused and relevant code review responses. Enhancement - plugins/filters/askAI/index.js (Line 8)Update the JSDoc token parameter type to be more accurate: - * @param {Object} token - The token to the AI model.
+ * @param {string} token - Your OpenAI API token. This change makes the parameter type more accurate since the token is expected to be a string, not an object. Enhancement - plugins/filters/askAI/index.js (Lines 3-4)Improve plugin description and first parameter documentation: - * @description A gitStream plugin to interact with AI models. Currently works with `ChatGPR-4o-mini`.
- * @param {Object} context - The context that will be attached to the prompt.
+ * @description A gitStream plugin to facilitate AI workflows with OpenAI's `gpt-4o-2024-08-06` model.
+ * @param {Object} context - The context to be sent to the AI model with the prompt. This change provides more accurate and detailed information about the plugin's purpose and parameters. Enhancement - All askAI automation filesAdd a consistent footer message to all AI-generated responses: + _This response was generated by the gitStream askAI plugin._ This change adds transparency by clearly indicating the source of the generated content. Add this line to all askAI automation files except askAI_summarize.cm which already includes an equivalent message. Please rate this
|
Updates documentation for the askAI plugin to provide clearer information about data privacy, API usage, and getting started with recommended use cases. Includes better formatting, more precise descriptions of the plugin's functionality, and improved examples of how to use the askAI integration with OpenAI's latest model.
The documentation and FAQ now better explains the data privacy of using AI features with third-party providers. The FAQ section has been streamlined for better readability and understanding of gitStream's capabilities in regards to AI.___
PR Description by askLB('Describe PR')
gpt-4o-2024-08-06
model and an API token.The purpose of these changes is to enhance clarity and functionality of gitStream's AI integration documentation and plugin usage, ensuring users understand configuration requirements and potential impacts.
Please rate this
askLB
description:✨ PR Description
Purpose: Updates documentation and improves clarity around gitStream's AI integration features, particularly focusing on consistent terminology and better descriptions of AI-powered PR analysis capabilities.
Main changes: