Skip to content

Commit 1b6c191

Browse files
committed
string type and better explanation
1 parent b7274ce commit 1b6c191

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

plugins/filters/askAI/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* @module askAI
33
* @description A gitStream plugin to interact with AI models. Currently works with `ChatGPR-4o-mini`.
44
* @param {Object} context - The context that will be attached to the prompt .
5+
* @param {string} role - Role instructions for the conversation.
56
* @param {string} prompt - The prompt string.
67
* @param {Object} token - The token to the AI model.
78
* @returns {Object} Returns the response from the AI model.
@@ -83,7 +84,7 @@ const buildContextForGPT = context => {
8384
};
8485

8586
const askAI = async (context, role = '', prompt, token, callback) => {
86-
const cacheKey = `${__filename}${prompt}`;
87+
const cacheKey = `${__filename}${role}${prompt}`;
8788

8889
if (process.env[cacheKey]) {
8990
return callback(null, process.env[cacheKey]);

plugins/filters/askAI/reference.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ A gitStream plugin to interact with AI models. Currently works with `ChatGPR-4o-
55

66
![Example PR description](screenshots/askAI-describe-PR.png)
77

8-
**Returns**: <code>Object</code> - Returns the response from the AI model
8+
**Returns**: <code>Object</code> - Returns the AI-generated response based on the provided context and prompt.
99
**License**: MIT
1010

11-
| Param | Type | Description |
12-
| ------- | -------- | ----------------------------------------------- |
13-
| context | `Object` | The context that will be attached to the prompt |
14-
| role | `string` | Role instructions for the conversationThe |
15-
| prompt | `string` | The prompt string |
16-
| token | `Object` | The token to the AI model |
11+
| Param | Type | Description |
12+
| ------- | -------- | ------------------------------------------------------------------------------------------------------------------ |
13+
| context | `Object` | The context that needs to be sent to the AI model for analysis. |
14+
| role | `string` | Free text. If not empty, Defines the role or persona for the AI to adopt while generating the response. |
15+
| prompt | `string` | The specific request or question you want the AI to respond to, after the context has been provided. |
16+
| token | `Object` | The token to the AI model |
1717

1818

1919
**Example**

0 commit comments

Comments
 (0)