Skip to content

Commit 4de7b19

Browse files
committed
DOC: Autogenerate and update documentation
1 parent ae65197 commit 4de7b19

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

docs/helpers/AI.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
permalink: /helpers/AI
3+
editLink: false
4+
sidebar: auto
5+
title: AI
6+
---
7+
8+
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
9+
10+
## AI
11+
12+
**Extends Helper**
13+
14+
AI Helper for CodeceptJS.
15+
16+
This helper class provides integration with the AI GPT-3.5 or 4 language model for generating responses to questions or prompts within the context of web pages. It allows you to interact with the GPT-3.5 model to obtain intelligent responses based on HTML fragments or general prompts.
17+
This helper should be enabled with any web helpers like Playwright or Puppeteer or WebDrvier to ensure the HTML context is available.
18+
19+
## Configuration
20+
21+
This helper should be configured in codecept.json or codecept.conf.js
22+
23+
- `chunkSize`: - The maximum number of characters to send to the AI API at once. We split HTML fragments by 8000 chars to not exceed token limit. Increase this value if you use GPT-4.
24+
25+
### Parameters
26+
27+
- `config`
28+
29+
### askGptGeneralPrompt
30+
31+
Send a general request to ChatGPT and return response.
32+
33+
#### Parameters
34+
35+
- `prompt` **[string][1]**
36+
37+
Returns **[Promise][2]&lt;[string][1]>** A Promise that resolves to the generated response from the GPT model.
38+
39+
### askGptOnPage
40+
41+
Asks the AI GPT language model a question based on the provided prompt within the context of the current page's HTML.
42+
43+
```js
44+
I.askGptOnPage('what does this page do?');
45+
```
46+
47+
#### Parameters
48+
49+
- `prompt` **[string][1]** The question or prompt to ask the GPT model.
50+
51+
Returns **[Promise][2]&lt;[string][1]>** A Promise that resolves to the generated responses from the GPT model, joined by newlines.
52+
53+
### askGptOnPageFragment
54+
55+
Asks the AI a question based on the provided prompt within the context of a specific HTML fragment on the current page.
56+
57+
```js
58+
I.askGptOnPageFragment('describe features of this screen', '.screen');
59+
```
60+
61+
#### Parameters
62+
63+
- `prompt` **[string][1]** The question or prompt to ask the GPT-3.5 model.
64+
- `locator` **[string][1]** The locator or selector used to identify the HTML fragment on the page.
65+
66+
Returns **[Promise][2]&lt;[string][1]>** A Promise that resolves to the generated response from the GPT model.
67+
68+
[1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
69+
70+
[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise

0 commit comments

Comments
 (0)