From e4cfc00b1e0ff51e80f14a7317e4aff9676aa435 Mon Sep 17 00:00:00 2001 From: Senko Rasic Date: Thu, 27 Jun 2024 18:24:20 +0200 Subject: [PATCH] add jsonref dep --- core/agents/convo.py | 2 ++ pyproject.toml | 1 + requirements.txt | 1 + 3 files changed, 4 insertions(+) diff --git a/core/agents/convo.py b/core/agents/convo.py index 20b3ef1d..0eb58f9d 100644 --- a/core/agents/convo.py +++ b/core/agents/convo.py @@ -97,6 +97,8 @@ class AgentConvo(Convo): else: return d + # We want to make the schema as simple as possible to avoid confusing the LLM, + # so we remove (dereference) all the refs we can and show the "final" schema version. schema_txt = json.dumps(remove_defs(jsonref.loads(json.dumps(model.model_json_schema())))) self.user( f"IMPORTANT: Your response MUST conform to this JSON schema:\n```\n{schema_txt}\n```." diff --git a/pyproject.toml b/pyproject.toml index 9ab84f4d..195260da 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,6 +38,7 @@ httpx = "^0.27.0" alembic = "^1.13.1" python-dotenv = "^1.0.1" prompt-toolkit = "^3.0.45" +jsonref = "^1.1.0" [tool.poetry.group.dev.dependencies] pytest = "^8.1.1" diff --git a/requirements.txt b/requirements.txt index eef51be1..2ef591a0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -18,6 +18,7 @@ httpx==0.27.0 huggingface-hub==0.23.2 idna==3.7 jinja2==3.1.4 +jsonref==1.1.0 mako==1.3.5 markupsafe==2.1.5 openai==1.31.0