mirror of https://github.com/mudler/LocalAI.git
Adding regex capabilities to ParseFunctionCall replacement
Signed-off-by: Lenaxia <github@47north.lat>
This commit is contained in:
parent
02f1b477df
commit
7f27acaf39
|
@ -60,10 +60,11 @@ type FuncCallResults struct {
|
|||
func ParseFunctionCall(llmresult string, functionConfig FunctionsConfig) []FuncCallResults {
|
||||
log.Debug().Msgf("LLM result: %s", llmresult)
|
||||
|
||||
for k, v := range functionConfig.ReplaceResults {
|
||||
log.Debug().Msgf("Replacing %s with %s", k, v)
|
||||
llmresult = strings.ReplaceAll(llmresult, k, v)
|
||||
}
|
||||
for k, v := range functionConfig.ReplaceResults {
|
||||
log.Debug().Msgf("Replacing %s with %s", k, v)
|
||||
re := regexp.MustCompile(k)
|
||||
llmresult = re.ReplaceAllString(llmresult, v)
|
||||
}
|
||||
|
||||
log.Debug().Msgf("LLM result(processed): %s", llmresult)
|
||||
|
||||
|
|
Loading…
Reference in New Issue