Dama12 commited on
Commit
4b5fcba
·
1 Parent(s): 5293b7b

fix: use standard json module for parsing to avoid langchain version conflicts

Browse files
Files changed (1) hide show
  1. app/services/k2_think_engine.py +3 -4
app/services/k2_think_engine.py CHANGED
@@ -141,11 +141,10 @@ RESEARCHER PROFILE:
141
  else:
142
  clean_json = content_no_think.replace("```json", "").replace("```", "").strip()
143
 
144
- # Parser le JSON nettoyé
145
  try:
146
- # On utilise un parseur de LangChain qui gère mieux les petits défauts
147
- from langchain_core.utils.json import parse_json_markdown
148
- k2_analysis = parse_json_markdown(clean_json)
149
  except Exception as e:
150
  logger.error(f"Failed to parse cleaned JSON: {e}")
151
  logger.debug(f"Cleaned JSON was: {clean_json}")
 
141
  else:
142
  clean_json = content_no_think.replace("```json", "").replace("```", "").strip()
143
 
144
+ # Parser le JSON nettoyé avec le module JSON standard
145
  try:
146
+ import json
147
+ k2_analysis = json.loads(clean_json)
 
148
  except Exception as e:
149
  logger.error(f"Failed to parse cleaned JSON: {e}")
150
  logger.debug(f"Cleaned JSON was: {clean_json}")