Skip to content
Open
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-20261026003724271651.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "patch",
"description": "Update dependencies (litellm 1.106.0, lancedb 0.40, pyarrow 26, ruff 0.17) and fix resulting lint/type issues."
}
4 changes: 2 additions & 2 deletions packages/graphrag-llm/graphrag_llm/completion/completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from graphrag_llm.threading.completion_thread_runner import completion_thread_runner

if TYPE_CHECKING:
from collections.abc import AsyncIterator, Iterator
from collections.abc import AsyncIterator, Generator, Iterator

from graphrag_cache import Cache, CacheKeyCreator

Expand Down Expand Up @@ -167,7 +167,7 @@ def completion_thread_pool(
response_handler: "ThreadedLLMCompletionResponseHandler",
concurrency: int,
queue_limit: int = 0,
) -> "Iterator[ThreadedLLMCompletionFunction]":
) -> "Generator[ThreadedLLMCompletionFunction, None, None]":
"""Run a completion thread pool.

Args
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"""LLMCompletion based on litellm."""

from collections.abc import AsyncIterator, Iterator
from typing import TYPE_CHECKING, Any, Unpack
from typing import TYPE_CHECKING, Any, Unpack, cast

import litellm
from azure.identity import DefaultAzureCredential, get_bearer_token_provider
Expand All @@ -22,6 +22,7 @@

if TYPE_CHECKING:
from graphrag_cache import Cache, CacheKeyCreator
from litellm import CustomStreamWrapper

from graphrag_llm.config import ModelConfig
from graphrag_llm.metrics import MetricsProcessor, MetricsStore
Expand Down Expand Up @@ -262,8 +263,11 @@ def _base_completion(
if json_object and "response_format" not in new_args:
new_args["response_format"] = {"type": "json_object"}

response = litellm.completion(
**new_args,
response = cast(
"ModelResponse | CustomStreamWrapper",
litellm.completion(
**new_args,
),
)
if isinstance(response, ModelResponse):
return LLMCompletionResponse(**response.model_dump())
Expand Down
4 changes: 2 additions & 2 deletions packages/graphrag-llm/graphrag_llm/embedding/embedding.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from graphrag_llm.threading.embedding_thread_runner import embedding_thread_runner

if TYPE_CHECKING:
from collections.abc import Iterator
from collections.abc import Generator

from graphrag_cache import Cache, CacheKeyCreator

Expand Down Expand Up @@ -93,7 +93,7 @@ def embedding_thread_pool(
response_handler: "ThreadedLLMEmbeddingResponseHandler",
concurrency: int,
queue_limit: int = 0,
) -> "Iterator[ThreadedLLMEmbeddingFunction]":
) -> "Generator[ThreadedLLMEmbeddingFunction, None, None]":
"""Run an embedding thread pool.

Args
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

"""LLMEmbedding based on litellm."""

from typing import TYPE_CHECKING, Any, Unpack
from typing import TYPE_CHECKING, Any, Unpack, cast

import litellm
from azure.identity import DefaultAzureCredential, get_bearer_token_provider
Expand All @@ -15,6 +15,7 @@

if TYPE_CHECKING:
from graphrag_cache import Cache, CacheKeyCreator
from litellm import EmbeddingResponse

from graphrag_llm.config import ModelConfig
from graphrag_llm.metrics import MetricsProcessor, MetricsStore
Expand Down Expand Up @@ -185,7 +186,7 @@ def _base_embedding(**kwargs: Any) -> LLMEmbeddingResponse:
kwargs.pop("metrics", None) # Remove metrics if present
new_args: dict[str, Any] = {**base_args, **kwargs}

response = litellm.embedding(**new_args)
response = cast("EmbeddingResponse", litellm.embedding(**new_args))
return LLMEmbeddingResponse(**response.model_dump())

async def _base_embedding_async(**kwargs: Any) -> LLMEmbeddingResponse:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import threading
import time
from collections import deque
from collections.abc import Iterator
from collections.abc import Generator
from contextlib import contextmanager
from typing import Any

Expand Down Expand Up @@ -62,7 +62,7 @@ def __init__(
self._stagger = self._period_in_seconds / self._rpp

@contextmanager
def acquire(self, token_count: int) -> Iterator[None]:
def acquire(self, token_count: int) -> Generator[None, None, None]:
"""
Acquire Rate Limiter.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import sys
import threading
import time
from collections.abc import Awaitable, Iterator
from collections.abc import Awaitable, Generator, Iterator
from contextlib import contextmanager
from queue import Empty, Queue
from typing import TYPE_CHECKING, Protocol, Unpack, runtime_checkable
Expand Down Expand Up @@ -147,7 +147,7 @@ def completion_thread_runner(
concurrency: int,
queue_limit: int = 0,
metrics_store: "MetricsStore | None" = None,
) -> Iterator[ThreadedLLMCompletionFunction]:
) -> Generator[ThreadedLLMCompletionFunction, None, None]:
"""Run a completion thread pool.

Args
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import sys
import threading
import time
from collections.abc import Awaitable, Iterator
from collections.abc import Awaitable, Generator
from contextlib import contextmanager
from queue import Empty, Queue
from typing import TYPE_CHECKING, Protocol, Unpack, runtime_checkable
Expand Down Expand Up @@ -120,7 +120,7 @@ def embedding_thread_runner(
concurrency: int,
queue_limit: int = 0,
metrics_store: "MetricsStore | None" = None,
) -> Iterator[ThreadedLLMEmbeddingFunction]:
) -> Generator[ThreadedLLMEmbeddingFunction, None, None]:
"""Run an embedding thread pool.

Args
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 @@ -38,7 +38,7 @@ dependencies = [
"graphrag-cache==3.3.0",
"graphrag-common==3.3.0",
"jinja2~=3.1",
"litellm==1.100.1",
"litellm==1.106.0",
"nest-asyncio2~=1.7",
# orjson is required for litellm tool calling. https://github.com/BerriAI/litellm/issues/32993
"orjson>=3.11.6,<4.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/graphrag-vectors/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ dependencies = [
"azure-identity~=1.25",
"azure-search-documents~=12.0",
"graphrag-common==3.3.0",
"lancedb~=0.38.0",
"lancedb~=0.40.0",
"numpy~=2.4",
"pyarrow~=25.0",
"pyarrow~=26.0",
"pydantic~=2.13",
]

Expand Down
2 changes: 1 addition & 1 deletion packages/graphrag/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ dependencies = [
"nltk~=3.9.0",
"numpy~=2.4",
"pandas~=3.0",
"pyarrow~=25.0",
"pyarrow~=26.0",
"pydantic~=2.13",
"spacy~=3.8",
"blis~=1.3",
Expand Down
Loading
Loading