Skip to content

Commit

Permalink
Fix response fields for zeroshotAPI
Browse files Browse the repository at this point in the history
  • Loading branch information
Robi9 committed Sep 15, 2023
1 parent 6c4248d commit 8eaf3c2
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions flows/routers/smart.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,14 @@ func (r *SmartRouter) classifyText(run flows.FlowRun, step flows.Step, operand s

client := &http.Client{}
response := &struct {
Output string `json:"output"`
Other bool `json:"other"`
}{
Output: "",
}
Output struct {
Classification string `json:"classification"`
Other bool `json:"other"`
}
}{Output: struct {
Classification string "json:\"classification\""
Other bool "json:\"other\""
}{Classification: ""}}

trace, err := httpx.DoTrace(client, req, nil, nil, -1)
if err != nil {
Expand Down Expand Up @@ -249,17 +252,17 @@ func (r *SmartRouter) classifyText(run flows.FlowRun, step flows.Step, operand s
var categoryUUID flows.CategoryUUID
categoryUUID = ""

if response.Other {
if response.Output.Other {
return "", categoryUUID, nil
}

for _, category := range r.categories {
if category.Name() == response.Output {
if category.Name() == response.Output.Classification {
categoryUUID = category.UUID()
}
}

return response.Output, categoryUUID, nil
return response.Output.Classification, categoryUUID, nil

}

Expand Down

0 comments on commit 8eaf3c2

Please sign in to comment.