Composable
useGPT('How high is Mt. Everest?')
The above example would initialize a request but won't do anything without a trigger afterwards.
useGPT(prompt)
Creates an instance of a request with a message.
| key | Type | Default | Description |
|---|---|---|---|
| prompt | String | The message you want to send. Not needed if followed by .createChat() |
.addContextData(data)
This function can be appended to the initial useGPT(prompt) to have the prompt reference the provided data.
const response = await useGPT('Which countries are in europe?')
.addContextData(['Austria', 'Germany', 'Canada'])
| key | Type | Default | Description |
|---|---|---|---|
| data | any | Will append the data as JSON to the intial prompt to let GPT reference it. |
Table of Contents