@@ -237,55 +237,41 @@ private void RemoveResponseHeadersIfDisabled(OpenApiPathItem pathItem)
237237 /// <param name="method">The HTTP method.</param>
238238 /// <param name="serverUrl">The server URL.</param>
239239 /// <param name="parametrizedPath">The parametrized path.</param>
240- /// <returns>The generated operationId.</returns>
241- private async Task < string > GetOperationIdAsync ( string method , string serverUrl , string parametrizedPath )
240+ /// <param name="promptyFile">The prompt file to use for LLM generation.</param>
241+ /// <returns>The generated operation id.</returns>
242+ protected override Task < string > GetOperationIdAsync ( string method , string serverUrl , string parametrizedPath , string promptyFile = "powerplatform_api_operation_id" )
242243 {
243- ILanguageModelCompletionResponse ? id = null ;
244- if ( await _languageModelClient . IsEnabledAsync ( ) )
245- {
246- id = await _languageModelClient . GenerateChatCompletionAsync ( "powerplatform_api_operation_id" , new ( )
247- {
248- { "request" , $ "{ method . ToUpper ( CultureInfo . InvariantCulture ) } { serverUrl } { parametrizedPath } " }
249- } ) ;
250- }
251- return id ? . Response ? . Trim ( ) ?? $ "{ method } { parametrizedPath . Replace ( '/' , '.' ) } ";
244+ return base . GetOperationIdAsync ( method , serverUrl , parametrizedPath , promptyFile ) ;
252245 }
253246
254247 /// <summary>
255- /// Generates a summary for an OpenAPI operation using LLM or fallback logic.
248+ /// Generates an operationId for an OpenAPI operation using LLM or fallback logic.
256249 /// </summary>
257250 /// <param name="method">The HTTP method.</param>
258251 /// <param name="serverUrl">The server URL.</param>
259252 /// <param name="parametrizedPath">The parametrized path.</param>
260- /// <returns>The generated summary.</returns>
261- private async Task < string > GetOperationSummaryAsync ( string method , string serverUrl , string parametrizedPath )
253+ /// <param name="promptyFile">The prompt file to use for LLM generation.</param>
254+ /// <returns>The generated operation description.</returns>
255+ protected override Task < string > GetOperationDescriptionAsync ( string method , string serverUrl , string parametrizedPath , string promptyFile = "powerplatform_api_operation_description" )
262256 {
263- ILanguageModelCompletionResponse ? description = null ;
264- if ( await _languageModelClient . IsEnabledAsync ( ) )
265- {
266- description = await _languageModelClient . GenerateChatCompletionAsync ( "powerplatform_api_operation_summary" , new ( )
267- {
268- { "request" , @$ "{ method . ToUpper ( CultureInfo . InvariantCulture ) } { serverUrl } { parametrizedPath } " }
269- } ) ;
270- }
271- return description ? . Response ? . Trim ( ) ?? $ "{ method } { parametrizedPath } ";
257+ return base . GetOperationDescriptionAsync ( method , serverUrl , parametrizedPath , promptyFile ) ;
272258 }
273259
274260 /// <summary>
275- /// Generates a description for an OpenAPI operation using LLM or fallback logic.
261+ /// Generates a summary for an OpenAPI operation using LLM or fallback logic.
276262 /// </summary>
277263 /// <param name="method">The HTTP method.</param>
278264 /// <param name="serverUrl">The server URL.</param>
279265 /// <param name="parametrizedPath">The parametrized path.</param>
280- /// <returns>The generated description .</returns>
281- private async Task < string > GetOperationDescriptionAsync ( string method , string serverUrl , string parametrizedPath )
266+ /// <returns>The generated summary .</returns>
267+ private async Task < string > GetOperationSummaryAsync ( string method , string serverUrl , string parametrizedPath )
282268 {
283269 ILanguageModelCompletionResponse ? description = null ;
284270 if ( await _languageModelClient . IsEnabledAsync ( ) )
285271 {
286- description = await _languageModelClient . GenerateChatCompletionAsync ( "powerplatform_api_operation_description " , new ( )
272+ description = await _languageModelClient . GenerateChatCompletionAsync ( "powerplatform_api_operation_summary " , new ( )
287273 {
288- { "request" , $ "{ method . ToUpper ( CultureInfo . InvariantCulture ) } { serverUrl } { parametrizedPath } " }
274+ { "request" , @ $ "{ method . ToUpper ( CultureInfo . InvariantCulture ) } { serverUrl } { parametrizedPath } " }
289275 } ) ;
290276 }
291277 return description ? . Response ? . Trim ( ) ?? $ "{ method } { parametrizedPath } ";
0 commit comments