File tree Expand file tree Collapse file tree 3 files changed +41
-0
lines changed
Expand file tree Collapse file tree 3 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ export {
1010 orchestrationChatCompletion ,
1111 orchestrationTemplating ,
1212 orchestrationPromptRegistry ,
13+ orchestrationCompletionPromptRegistryScoped ,
1314 orchestrationInputFiltering ,
1415 orchestrationOutputFiltering ,
1516 orchestrationRequestConfig ,
Original file line number Diff line number Diff line change @@ -205,6 +205,39 @@ export async function orchestrationPromptRegistry(): Promise<OrchestrationRespon
205205 } ) ;
206206}
207207
208+ /**
209+ * Use a template stored in the prompt registry store at
210+ * the resource group scope.
211+ * @returns The orchestration service response.
212+ */
213+ export async function orchestrationCompletionPromptRegistryScoped ( ) : Promise < OrchestrationResponse > {
214+ const orchestrationClient = new OrchestrationClient (
215+ {
216+ promptTemplating : {
217+ prompt : {
218+ // refer to a prompt template stored at resource group scope
219+ template_ref : {
220+ name : 'e2e-test-scoped' ,
221+ scenario : 'e2e-test-scoped' ,
222+ version : '0.0.1' ,
223+ scope : 'resource_group'
224+ }
225+ } ,
226+ // define the language model to be used
227+ model : {
228+ name : 'gpt-4o'
229+ }
230+ }
231+ } ,
232+ // provide resource group where the template is stored
233+ { resourceGroup : 'ai-sdk-js-e2e' }
234+ ) ;
235+
236+ return orchestrationClient . chatCompletion ( {
237+ placeholderValues : { country : 'France' }
238+ } ) ;
239+ }
240+
208241/**
209242 * Apply multiple content filters to the input.
210243 * @returns The orchestration service error response.
Original file line number Diff line number Diff line change 22 orchestrationChatCompletion ,
33 orchestrationTemplating ,
44 orchestrationPromptRegistry ,
5+ orchestrationCompletionPromptRegistryScoped ,
56 orchestrationInputFiltering ,
67 orchestrationOutputFiltering ,
78 orchestrationRequestConfig ,
@@ -52,6 +53,12 @@ describe('orchestration', () => {
5253 assertContent ( response ) ;
5354 } ) ;
5455
56+ it ( 'should complete a chat with a scoped template reference' , async ( ) => {
57+ const response = await orchestrationCompletionPromptRegistryScoped ( ) ;
58+
59+ assertContent ( response ) ;
60+ } ) ;
61+
5562 it ( 'should trigger an input filter' , async ( ) => {
5663 await orchestrationInputFiltering ( ) ;
5764 } ) ;
You can’t perform that action at this time.
0 commit comments