Skip to content

Commit 5e287ef

Browse files
committed
Minor fixes to shuffle-ai app to ensure it uploads Singul fields properly
1 parent 1dba0e3 commit 5e287ef

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

shuffle-ai/1.0.0/requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
shuffle_sdk==0.0.11
1+
shuffle-sdk==0.0.28
2+
23
pytesseract
34
pdf2image
45
pypdf2
5-
requests
66

77
llama-cpp-python

shuffle-ai/1.0.0/src/app.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def load_llm_model(model):
8989
"reason": "Failed to load LLM model %s" % model,
9090
}
9191

92-
class Tools(AppBase):
92+
class ShuffleAI(AppBase):
9393
__version__ = "1.0.0"
9494
app_name = "Shuffle AI"
9595

@@ -430,6 +430,7 @@ def gpt(self, input_text):
430430
def run_schemaless(self, category, action, app_name="", fields=""):
431431
self.logger.info("[DEBUG] Running schemaless action with category '%s' and action label '%s'" % (category, action))
432432

433+
# Not necessary anymore
433434
"""
434435
action := shuffle.CategoryAction{
435436
Label: step.Name,
@@ -462,9 +463,16 @@ def run_schemaless(self, category, action, app_name="", fields=""):
462463

463464
elif isinstance(fields, dict):
464465
for key, value in fields.items():
466+
parsedvalue = str(value)
467+
try:
468+
if str(value).startswith("{") or str(value).startswith("["):
469+
parsedvalue = json.dumps(value)
470+
except:
471+
pass
472+
465473
data["fields"].append({
466474
"key": key,
467-
"value": str(value),
475+
"value": parsedvalue,
468476
})
469477

470478
else:
@@ -530,4 +538,4 @@ def run_schemaless(self, category, action, app_name="", fields=""):
530538
return request.text
531539

532540
if __name__ == "__main__":
533-
Tools.run()
541+
ShuffleAI.run()

0 commit comments

Comments
 (0)