Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .semversioner/next-release/patch-20260206194808781905.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "patch",
"description": "Remove unnecessary response format check. Fixes: #2203"
}
11 changes: 0 additions & 11 deletions packages/graphrag-llm/graphrag_llm/completion/completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,6 @@ def __init__(
"""
raise NotImplementedError

@abstractmethod
def supports_structured_response(self) -> bool:
"""Whether the completion supports structured responses.
Returns
-------
bool:
True if structured responses are supported, False otherwise.
"""
raise NotImplementedError

@abstractmethod
def completion(
self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import litellm
from azure.identity import DefaultAzureCredential, get_bearer_token_provider
from litellm import ModelResponse, supports_response_schema # type: ignore
from litellm import ModelResponse # type: ignore

from graphrag_llm.completion.completion import LLMCompletion
from graphrag_llm.config.types import AuthMethod
Expand Down Expand Up @@ -128,10 +128,6 @@ def __init__(
retrier=self._retrier,
)

def supports_structured_response(self) -> bool:
"""Check if the model supports structured response."""
return supports_response_schema(self._model_id)

def completion(
self,
/,
Expand All @@ -140,9 +136,6 @@ def completion(
"""Sync completion method."""
messages: LLMCompletionMessagesParam = kwargs.pop("messages")
response_format = kwargs.pop("response_format", None)
if response_format and not self.supports_structured_response():
msg = f"Model '{self._model_id}' does not support response schemas."
raise ValueError(msg)

is_streaming = kwargs.get("stream") or False

Expand Down Expand Up @@ -182,11 +175,6 @@ async def completion_async(
"""Async completion method."""
messages: LLMCompletionMessagesParam = kwargs.pop("messages")
response_format = kwargs.pop("response_format", None)
if response_format and not supports_response_schema(
self._model_id,
):
msg = f"Model '{self._model_id}' does not support response schemas."
raise ValueError(msg)

is_streaming = kwargs.get("stream") or False

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,6 @@ def __init__(

self._mock_responses = mock_responses # type: ignore

def supports_structured_response(self) -> bool:
"""Check if the model supports structured response."""
return True

def completion(
self,
/,
Expand Down
32 changes: 3 additions & 29 deletions packages/graphrag-llm/notebooks/03_structured_responses.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 3,
"id": "a79c242b",
"metadata": {},
"outputs": [
Expand All @@ -22,10 +22,10 @@
"text": [
"City: Seattle\n",
" Temperature: 11.1 °C\n",
" Condition: sunny\n",
" Condition: Sunny\n",
"City: San Francisco\n",
" Temperature: 23.9 °C\n",
" Condition: cloudy\n"
" Condition: Cloudy\n"
]
}
],
Expand Down Expand Up @@ -84,32 +84,6 @@
" print(f\" Condition: {report.condition}\")"
]
},
{
"cell_type": "markdown",
"id": "6dcfa20c",
"metadata": {},
"source": [
"## Checking for support\n"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "aa1edadb",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Supports structured responses: True\n"
]
}
],
"source": [
"print(f\"Supports structured responses: {llm_completion.supports_structured_response()}\")"
]
},
{
"cell_type": "markdown",
"id": "6360f512",
Expand Down
2 changes: 1 addition & 1 deletion packages/graphrag-llm/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ classifiers = [
"Programming Language :: Python :: 3.13",
]
dependencies = [
"azure-identity~=1.19.0",
"azure-identity~=1.25",
"graphrag-cache==3.0.1",
"graphrag-common==3.0.1",
"jinja2~=3.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/graphrag-storage/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ classifiers = [
dependencies = [
"aiofiles~=24.1",
"azure-cosmos~=4.9",
"azure-identity~=1.19",
"azure-identity~=1.25",
"azure-storage-blob~=12.24",
"graphrag-common==3.0.1",
"pandas~=2.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/graphrag-vectors/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ classifiers = [
dependencies = [
"azure-core~=1.32",
"azure-cosmos~=4.9",
"azure-identity~=1.19",
"azure-identity~=1.25",
"azure-search-documents~=11.6",
"graphrag-common==3.0.1",
"lancedb~=0.24.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/graphrag/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ classifiers = [
]

dependencies = [
"azure-identity~=1.19",
"azure-identity~=1.25",
"azure-search-documents~=11.5",
"azure-storage-blob~=12.24",
"devtools~=0.12",
Expand Down
3 changes: 0 additions & 3 deletions tests/integration/language_model/test_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ class CustomChatModel(LLMCompletion):
def __init__(self, **kwargs):
pass

def supports_structured_response(self) -> bool:
return True

def completion(
self,
/,
Expand Down
14 changes: 7 additions & 7 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.