File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
DevProxy.Abstractions/LanguageModel Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,9 @@ public abstract class BaseLanguageModelClient(ILogger logger) : ILanguageModelCl
2424 _logger . LogDebug ( "Prompt file name '{PromptFileName}' does not end with '.prompty'. Appending the extension." , promptFileName ) ;
2525 promptFileName += ".prompty" ;
2626 }
27- var ( messages , options ) = _promptCache . GetOrAdd ( promptFileName , _ =>
27+
28+ var cacheKey = GetPromptCacheKey ( promptFileName , parameters ) ;
29+ var ( messages , options ) = _promptCache . GetOrAdd ( cacheKey , _ =>
2830 LoadPrompt ( promptFileName , parameters ) ) ;
2931
3032 if ( messages is null || ! messages . Any ( ) )
@@ -81,4 +83,10 @@ public abstract class BaseLanguageModelClient(ILogger logger) : ILanguageModelCl
8183
8284 return ( messages , options ) ;
8385 }
86+
87+ private static string GetPromptCacheKey ( string promptFileName , Dictionary < string , object > parameters )
88+ {
89+ var parametersString = string . Join ( ";" , parameters . Select ( kvp => $ "{ kvp . Key } ={ kvp . Value } ") ) ;
90+ return $ "{ promptFileName } :{ parametersString } ";
91+ }
8492}
You can’t perform that action at this time.
0 commit comments