From 6bc5c6f162477bc8647656a38a9445645162380c Mon Sep 17 00:00:00 2001 From: Igor Ilic Date: Mon, 29 Sep 2025 17:06:01 +0200 Subject: [PATCH] refactor: Use latest JSON tool type for structured outputs --- .../litellm_instructor/llm/openai/adapter.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cognee/infrastructure/llm/structured_output_framework/litellm_instructor/llm/openai/adapter.py b/cognee/infrastructure/llm/structured_output_framework/litellm_instructor/llm/openai/adapter.py index 8a0109d99..7ea9dedaa 100644 --- a/cognee/infrastructure/llm/structured_output_framework/litellm_instructor/llm/openai/adapter.py +++ b/cognee/infrastructure/llm/structured_output_framework/litellm_instructor/llm/openai/adapter.py @@ -73,8 +73,10 @@ class OpenAIAdapter(LLMInterface): fallback_api_key: str = None, fallback_endpoint: str = None, ): - self.aclient = instructor.from_litellm(litellm.acompletion, mode=instructor.Mode.JSON) - self.client = instructor.from_litellm(litellm.completion, mode=instructor.Mode.JSON) + self.aclient = instructor.from_litellm( + litellm.acompletion, mode=instructor.Mode.JSON_SCHEMA + ) + self.client = instructor.from_litellm(litellm.completion, mode=instructor.Mode.JSON_SCHEMA) self.transcription_model = transcription_model self.model = model self.api_key = api_key