You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -78,9 +78,9 @@ This code registers a chat participant with the following attributes:
78
78
79
79
Finally, setting `isSticky: true` will automatically prepend the participant name in the chat input field after the user has started interacting with the participant.
80
80
81
-
## Step 3: Craft the prompt and select the model
81
+
## Step 3: Craft the prompt
82
82
83
-
Now that the participant is registered, you can start implementing the logic for the code tutor. In the `extension.ts` file, you will define a prompt and select the model for the requests.
83
+
Now that the participant is registered, you can start implementing the logic for the code tutor. In the `extension.ts` file, you will define a prompt for the requests.
84
84
85
85
Crafting a good prompt is the key to getting the best response from your participant. Check out [this article](https://platform.openai.com/docs/guides/prompt-engineering) for tips on prompt engineering.
86
86
@@ -97,15 +97,9 @@ The second prompt is more specific and gives the participant a clear direction o
97
97
const BASE_PROMPT ='You are a helpful code tutor. Your job is to teach the user with simple descriptions and sample code of the concept. Respond with a guided overview of the concept in a series of messages. Do not give the user the answer directly, but guide them to find the answer themselves. If the user asks a non-programming question, politely decline to respond.';
98
98
```
99
99
100
-
You also need to select the model for the requests. gpt-4o is recommended since it is fast and high quality.
Now that the prompt and model are selected, you need to implement the request handler. This is what will process the user's chat request. You will define the request handler, perform logic for processing the request, and return a response to the user.
102
+
Now that the prompt is selected, you need to implement the request handler. This is what will process the user's chat request. You will define the request handler, perform logic for processing the request, and return a response to the user.
Within the body of this handler, initialize the prompt and a `messages` array with the prompt. Then, send in what the user typed in the chat box. You can access this through `request.prompt`.
130
115
131
-
// make sure the model is available
132
-
if (model) {
133
-
134
-
}
135
-
136
-
return;
137
-
};
138
-
```
139
-
140
-
Initialize a `messages` array with the prompt we crafted in the previous step. Then, send in what the user typed in the chat box. You can access this through `request.prompt`.
141
-
142
-
Finally, send the request and stream the response to the user.
116
+
Send the request using `request.model.sendRequest`, which will send the request using the currently selected model. Finally, stream the response to the user.
0 commit comments