Appearance
VM Code SDK v2 / askGPT
Function: askGPT()
askGPT(
params,options):Promise<string>
Sends a request to GPT with specified parameters and options.
This function is used to interact with a GPT model by sending it a prompt and additional instructions if necessary. The params object must include a prompt which is the main text the GPT model will process. Optionally, instructions can be provided to guide the GPT model's response style or content.
Parameters
• params
An object containing the prompt string and optionally instructions string.
• params.instructions?: string
• params.prompt: string
• options: TimeoutOption
Configuration options for the GPT request, defined by GPTRequestOptions.
Returns
Promise<string>
The response from the GPT model as handled by session.gptRequest.
Example
typescript
const response = askGPT({ prompt: "Explain the theory of relativity.", instructions: "Keep it simple." }, { timeout: 5000 });
console.log(response);