File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
src/codeinterpreterapi/chains Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,11 @@ def get_file_modifications(
1919 result = llm .invoke (prompt )
2020
2121 try :
22+ if isinstance (result .content , str ):
23+ if result .content .endswith ("```" ):
24+ result .content = result .content [:- 3 ]
25+ if result .content .startswith ("```" ):
26+ result .content = result .content [3 :]
2227 result = json .loads (result .content )
2328 except json .JSONDecodeError :
2429 result = ""
@@ -40,6 +45,11 @@ async def aget_file_modifications(
4045 result = await llm .ainvoke (prompt )
4146
4247 try :
48+ if isinstance (result .content , str ):
49+ if result .content .endswith ("```" ):
50+ result .content = result .content [:- 3 ]
51+ if result .content .startswith ("```" ):
52+ result .content = result .content [3 :]
4353 result = json .loads (result .content )
4454 except json .JSONDecodeError :
4555 result = ""
You can’t perform that action at this time.
0 commit comments