Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
markhodierne committed Oct 16, 2024
1 parent 3a57985 commit f41c5b5
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions streamlit/pages/12_🤖_Batch_Results_Checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
from openai import OpenAI
from openai import BadRequestError, AuthenticationError, APIError

from utils.formatting import (
fix_json_format
)
from utils.common_utils import (
clear_all_caches
)
Expand Down Expand Up @@ -50,12 +53,10 @@ def add_batch_results(output):
for json_str in json_strings:
try:
# Convert the main JSON object
st.write('HERE')
st.write(json_str)
data = json.loads(json_str)
cleaned_str = fix_json_format(json_str)
data = json.loads(cleaned_str)
content = data["response"]["body"]["choices"][0]["message"]["content"]
cleaned_content = content.replace('json\n', '', 1).strip()
cleaned_content = cleaned_content.strip('`').strip()
cleaned_content = fix_json_format(content)
inner_data = json.loads(cleaned_content)

# Access specific fields as needed
Expand Down

0 comments on commit f41c5b5

Please sign in to comment.