-
Notifications
You must be signed in to change notification settings - Fork 41
📝 docs: improve askAI plugin documentation #630
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
base: main
Are you sure you want to change the base?
Changes from 4 commits
2ae58c1
8123b12
c1440a3
baae64c
0331f23
05bb5f8
8343db2
cd859d0
3c760c9
cb80d1f
70d17b0
30d4b04
d46280f
bb66f63
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 |
---|---|---|
|
@@ -14,8 +14,10 @@ automations: | |
- action: add-comment@v1 | ||
args: | ||
comment: | | ||
# 🧪 Test Suggestions 🧪 | ||
{{ source | askAI("Technical writer", | ||
"Review the code diff and generate documentation for any newly added features or significant changes. | ||
Focus on describing functionality, parameters, and expected behavior. | ||
Format the output in clear, concise bullet points or paragraphs.", env.OPEN_AI_TOKEN) }} | ||
## 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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. @BenLloydPearson One way we could do this is using the gitStream
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 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. 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 commentThe 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 |
||
- Generate documentation for any newly added features or significant changes. | ||
- Focus on describing functionality, parameters, and expected behavior. | ||
- Format the output in clear, concise bullet points or paragraphs.", env.OPEN_AI_TOKEN) }} | ||
_This response was generated by the gitStream askAI plugin._ |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,11 +14,12 @@ Choose which repositories are permitted to use GitHub Actions. | |
|
||
[x] Allow all actions and reusable workflows | ||
|
||
## Does gitStream services have access to my code? | ||
## Does gitStream have access to my code? | ||
|
||
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 commentThe 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 |
||
|
||
## Why does gitStream require permission to write code? | ||
|
||
To support automations that either Approve or Merge PRs, the git providers require code write scope. | ||
|
||
## What repos are supported? | ||
|
@@ -34,7 +35,7 @@ Yes. When a merge queue is used, and gitStream is set as a required check, gitSt | |
|
||
The `.cm` file uses YAML with JINJA2. For your favorite editor to automatically choose the right syntax, you can use modelines. | ||
|
||
Add the following line to the top of the `.cm` file (the default has it already): | ||
Add the following line to the top of the `.cm` file (the default has it already): | ||
|
||
``` | ||
# -*- mode: yaml -*- | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,39 @@ | ||
--- | ||
title: Integrate gitStream with AI | ||
description: Use gitStream to integrate with AI services for Review, describe and add tests. | ||
description: Use gitStream to integrate with AI for different use cases. | ||
category: [quality, genai, copilot, tests, efficiency] | ||
--- | ||
# Integrate gitStream with AI | ||
|
||
<!-- --8<-- [start:examples]--> | ||
!!! warning "Required gitStream Plugins" | ||
This example requires you to install the [`askAI`](/filter-function-plugins/#askai) plugin. | ||
This example requires you to install the [`askAI`](/filter-function-plugins/#askai) plugin, which will provide context to the configured model provider and may incur API costs. | ||
azigler marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
[Learn more about gitStream plugins](/plugins/). | ||
|
||
## Ask AI to Summarize the Changes in a PR | ||
## Ask AI to Summarize a PR | ||
|
||
--8<-- "docs/automations/integrations/askAI/summarize-pr/README.md:example" | ||
|
||
## Ask AI to Suggest Tests | ||
|
||
--8<-- "docs/automations/integrations/askAI/add-tests/README.md:example" | ||
|
||
## Ask AI for a Code Review | ||
## Ask AI to Review a PR | ||
|
||
--8<-- "docs/automations/integrations/askAI/code-review/README.md:example" | ||
|
||
## Ask AI for Documentation | ||
## Ask AI for Improvements to a PR | ||
|
||
--8<-- "docs/automations/integrations/askAI/document/README.md:example" | ||
--8<-- "docs/automations/integrations/askAI/improve/README.md:example" | ||
|
||
## Ask AI for Code Improvements | ||
## Ask AI for Documentation for a PR | ||
|
||
--8<-- "docs/automations/integrations/askAI/improve/README.md:example" | ||
--8<-- "docs/automations/integrations/askAI/document/README.md:example" | ||
|
||
<!-- ## Ask AI for anything | ||
## Ask AI for Tests for a PR | ||
|
||
--8<-- "docs/automations/integrations/askAI/code-review/README.md:example" --> | ||
--8<-- "docs/automations/integrations/askAI/add-tests/README.md:example" | ||
<!-- --8<-- [end:examples]--> | ||
|
||
## Additional Resources | ||
|
||
--8<-- "docs/snippets/general.md" | ||
|
||
--8<-- "docs/snippets/automation-footer.md" | ||
--8<-- "docs/snippets/automation-footer.md" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
<a name="module_generateDescription"></a> | ||
|
||
## askAI | ||
A gitStream plugin to interact with AI models. Currently works with `ChatGPR-4o-mini` | ||
|
||
 | ||
!!! warning "Data privacy" | ||
The [`askAI`](/filter-function-plugins/#askai) plugin will provide context to the configured model provider and may incur API costs. | ||
|
||
[Learn more about gitStream plugins](/plugins/). | ||
|
||
A gitStream plugin to facilitate AI workflows with OpenAI's `gpt-4o-2024-08-06` model. | ||
|
||
**Returns**: <code>Object</code> - Returns the AI-generated response based on the provided context and prompt. | ||
**License**: MIT | ||
|
||
| Param | Type | Description | | ||
| ------- | -------- | ------------------------------------------------------------------------------------------------------------------ | | ||
| context | `Object` | The context that needs to be sent to the AI model for analysis. | | ||
| role | `string` | Free text. If not empty, Defines the role or persona for the AI to adopt while generating the response. | | ||
| context | `Object` | The context to be sent to the AI model with the prompt. | | ||
| role | `string` | The system role or persona for the AI to adopt while generating the response. | | ||
| prompt | `string` | The specific request or question you want the AI to respond to, after the context has been provided. | | ||
| token | `Object` | The token to the AI model | | ||
|
||
| token | `string` | Your OpenAI API token. | | ||
|
||
**Example** | ||
!!! tip "Encoding output" | ||
The output of AI models may be lengthy, which might cause issues when setting the comment. We recommend using the [`encode`](./filter-functions.md#encode) filter function, as shown in the example, to ensure that the comment is passed fully. | ||
The [`add-comment`](./automation-actions.md#add-comment) action automatically decodes encoded strings. | ||
|
||
|
||
```yaml | ||
{{ source | askAI("QA tester", "Based on the given context, search for new functions without tests and suggest the tests to add. If all functions are covered completely, return 'no tests to suggest.'", env.OPEN_AI_TOKEN) }} | ||
{{ source | askAI("Experienced developer", "Summarize the changes in this PR in bullet points.", env.OPEN_AI_TOKEN) }} | ||
``` |
Uh oh!
There was an error while loading. Please reload this page.