From ccbc483e02efb8080128155277f7b361b8e0623d Mon Sep 17 00:00:00 2001 From: misternasty <151004437+misternasty@users.noreply.github.com> Date: Sat, 18 Nov 2023 22:03:05 -0600 Subject: [PATCH 1/3] strip out gpt-4-1106-preview garbage preamble --- blockagi/chains/evaluate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blockagi/chains/evaluate.py b/blockagi/chains/evaluate.py index de6bbe7..1358573 100644 --- a/blockagi/chains/evaluate.py +++ b/blockagi/chains/evaluate.py @@ -95,7 +95,7 @@ def _call(self, inputs: Dict[str, Any]) -> Dict[str, Any]: response = self.retry_llm(messages) - result = json.loads(response.content) + result = json.loads(response.content.strip("```json")) updated_findings = Findings( generated_objectives=[ From ee000c9421d704dd5dbcac53a966418951e0c447 Mon Sep 17 00:00:00 2001 From: misternasty <151004437+misternasty@users.noreply.github.com> Date: Sat, 18 Nov 2023 22:04:33 -0600 Subject: [PATCH 2/3] fix gpt-4-1106-preview garbage preamble --- blockagi/chains/narrate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blockagi/chains/narrate.py b/blockagi/chains/narrate.py index c9333e3..7d05aa3 100644 --- a/blockagi/chains/narrate.py +++ b/blockagi/chains/narrate.py @@ -148,4 +148,4 @@ def _call_chunk(self, inputs: Dict[str, Any]) -> Dict[str, Any]: response = self.retry_llm(messages) - return response.content + return response.content.strip("```json") From ab3368bf61fe9df63540873314328799c035efae Mon Sep 17 00:00:00 2001 From: misternasty <151004437+misternasty@users.noreply.github.com> Date: Sat, 18 Nov 2023 22:05:38 -0600 Subject: [PATCH 3/3] fix gpt-4-1106-preview garbage preamble --- blockagi/chains/plan.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blockagi/chains/plan.py b/blockagi/chains/plan.py index 3ee74b7..c6ba48c 100644 --- a/blockagi/chains/plan.py +++ b/blockagi/chains/plan.py @@ -100,7 +100,7 @@ def _call(self, inputs: Dict[str, Any]) -> Dict[str, Any]: args=task["args"], reasoning=task["reasoning"], ) - for task in json.loads(response.content) + for task in json.loads(response.content.strip("```json")) ] return {"research_tasks": research_tasks}