File tree 1 file changed +10
-0
lines changed
src/codeinterpreterapi/chains
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(
19
19
result = llm .invoke (prompt )
20
20
21
21
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 :]
22
27
result = json .loads (result .content )
23
28
except json .JSONDecodeError :
24
29
result = ""
@@ -40,6 +45,11 @@ async def aget_file_modifications(
40
45
result = await llm .ainvoke (prompt )
41
46
42
47
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 :]
43
53
result = json .loads (result .content )
44
54
except json .JSONDecodeError :
45
55
result = ""
You can’t perform that action at this time.
0 commit comments