mirror of
https://github.com/mudler/LocalAI.git
synced 2025-05-20 10:35:01 +00:00
feat(functions): allow response_regex
to be a list (#2447)
feat(functions): allow regex match to be a list Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
parent
ff8a6962cd
commit
5d31e5269d
3 changed files with 19 additions and 16 deletions
|
@ -28,7 +28,7 @@ var _ = Describe("LocalAI function parse tests", func() {
|
|||
Context("when not using grammars and regex is needed", func() {
|
||||
It("should extract function name and arguments from the regex", func() {
|
||||
input := `add({"x":5,"y":3})`
|
||||
functionConfig.ResponseRegex = `(?P<function>\w+)\s*\((?P<arguments>.*)\)`
|
||||
functionConfig.ResponseRegex = []string{`(?P<function>\w+)\s*\((?P<arguments>.*)\)`}
|
||||
|
||||
results := ParseFunctionCall(input, functionConfig)
|
||||
Expect(results).To(HaveLen(1))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue