miguelamendez commited on
Commit
248459a
·
verified ·
1 Parent(s): 7888dec

Update app.py

Browse files

Added image generation tool and logs of text_to_json

Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -47,7 +47,9 @@ def text_to_json(text: str, json_schema: dict) -> dict:
47
  {"role": "system", "content": "You are an assistant that converts text into JSON. Convert the provided text into a JSON object based on the provided schema. JSON_SCHEMA:\n```json " + json.dumps(json_schema) + "```"},
48
  {"role": "user", "content": text},
49
  ]
50
- return json.loads(model(messages, response_format={"type": "json_object", "schema": json_schema}).content)
 
 
51
 
52
 
53
  @tool
@@ -87,7 +89,7 @@ with open("prompts.yaml", 'r') as stream:
87
 
88
  agent = CodeAgent(
89
  model=model,
90
- tools=[final_answer,text_to_json], ## add your tools here (don't remove final answer)
91
  max_steps=6,
92
  verbosity_level=1,
93
  grammar=None,
 
47
  {"role": "system", "content": "You are an assistant that converts text into JSON. Convert the provided text into a JSON object based on the provided schema. JSON_SCHEMA:\n```json " + json.dumps(json_schema) + "```"},
48
  {"role": "user", "content": text},
49
  ]
50
+ data= model(messages, response_format={"type": "json_object", "schema": json_schema}).content
51
+ print(data)
52
+ return json.loads(data)
53
 
54
 
55
  @tool
 
89
 
90
  agent = CodeAgent(
91
  model=model,
92
+ tools=[final_answer,text_to_json,image_generation_tool], ## add your tools here (don't remove final answer)
93
  max_steps=6,
94
  verbosity_level=1,
95
  grammar=None,