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
24
24
_logger . LogDebug ( "Prompt file name '{PromptFileName}' does not end with '.prompty'. Appending the extension." , promptFileName ) ;
25
25
promptFileName += ".prompty" ;
26
26
}
27
- var ( messages , options ) = _promptCache . GetOrAdd ( promptFileName , _ =>
27
+
28
+ var cacheKey = GetPromptCacheKey ( promptFileName , parameters ) ;
29
+ var ( messages , options ) = _promptCache . GetOrAdd ( cacheKey , _ =>
28
30
LoadPrompt ( promptFileName , parameters ) ) ;
29
31
30
32
if ( messages is null || ! messages . Any ( ) )
@@ -81,4 +83,10 @@ public abstract class BaseLanguageModelClient(ILogger logger) : ILanguageModelCl
81
83
82
84
return ( messages , options ) ;
83
85
}
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
+ }
84
92
}
You can’t perform that action at this time.
0 commit comments