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/minor-20250514234228008828.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "minor",
"description": "Update fnllm to latest. Update default graphrag configuration"
}
5 changes: 3 additions & 2 deletions graphrag/config/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from dataclasses import dataclass, field
from pathlib import Path
from typing import Literal

from graphrag.config.enums import (
AsyncType,
Expand Down Expand Up @@ -275,8 +276,8 @@ class LanguageModelDefaults:
proxy: None = None
audience: None = None
model_supports_json: None = None
tokens_per_minute: int = 50_000
requests_per_minute: int = 1_000
tokens_per_minute: Literal["auto"] = "auto"
requests_per_minute: Literal["auto"] = "auto"
retry_strategy: str = "native"
max_retries: int = 10
max_retry_wait: float = 10.0
Expand Down
8 changes: 4 additions & 4 deletions graphrag/config/init_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
async_mode: {language_model_defaults.async_mode.value} # or asyncio
retry_strategy: native
max_retries: -1 # set to -1 for dynamic retry logic (most optimal setting based on server response)
tokens_per_minute: 0 # set to 0 to disable rate limiting
requests_per_minute: 0 # set to 0 to disable rate limiting
tokens_per_minute: {language_model_defaults.tokens_per_minute} # set to null to disable rate limiting
requests_per_minute: {language_model_defaults.requests_per_minute} # set to null to disable rate limiting
{defs.DEFAULT_EMBEDDING_MODEL_ID}:
type: {defs.DEFAULT_EMBEDDING_MODEL_TYPE.value} # or azure_openai_embedding
# api_base: https://<instance>.openai.azure.com
Expand All @@ -52,8 +52,8 @@
async_mode: {language_model_defaults.async_mode.value} # or asyncio
retry_strategy: native
max_retries: -1 # set to -1 for dynamic retry logic (most optimal setting based on server response)
tokens_per_minute: 0 # set to 0 to disable rate limiting
requests_per_minute: 0 # set to 0 to disable rate limiting
tokens_per_minute: {language_model_defaults.tokens_per_minute} # set to null to disable rate limiting
requests_per_minute: {language_model_defaults.requests_per_minute} # set to null to disable rate limiting

### Input settings ###

Expand Down
6 changes: 4 additions & 2 deletions graphrag/config/models/language_model_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

"""Language model configuration."""

from typing import Literal

import tiktoken
from pydantic import BaseModel, Field, model_validator

Expand Down Expand Up @@ -192,11 +194,11 @@ def _validate_deployment_name(self) -> None:
description="The request timeout to use.",
default=language_model_defaults.request_timeout,
)
tokens_per_minute: int = Field(
tokens_per_minute: int | Literal["auto"] | None = Field(
description="The number of tokens per minute to use for the LLM service.",
default=language_model_defaults.tokens_per_minute,
)
requests_per_minute: int = Field(
requests_per_minute: int | Literal["auto"] | None = Field(
description="The number of requests per minute to use for the LLM service.",
default=language_model_defaults.requests_per_minute,
)
Expand Down
2 changes: 0 additions & 2 deletions graphrag/language_model/providers/fnllm/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ def _create_openai_config(config: LanguageModelConfig, azure: bool) -> OpenAICon
encoding=encoding_model,
deployment=config.deployment_name,
chat_parameters=chat_parameters,
sleep_on_rate_limit_recommendation=True,
)
return PublicOpenAIConfig(
api_key=config.api_key,
Expand All @@ -98,7 +97,6 @@ def _create_openai_config(config: LanguageModelConfig, azure: bool) -> OpenAICon
model=config.model,
encoding=encoding_model,
chat_parameters=chat_parameters,
sleep_on_rate_limit_recommendation=True,
)


Expand Down
2,078 changes: 1,092 additions & 986 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ lancedb = "^0.17.0"
aiofiles = "^24.1.0"

# LLM
fnllm = {extras = ["azure", "openai"], version = "0.2.3"}
fnllm = {extras = ["azure", "openai"], version = "^0.3.0"}
json-repair = "^0.30.3"
openai = "^1.68.0"
nltk = "3.9.1"
Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/min-csv/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ models:
api_version: ${GRAPHRAG_API_VERSION}
deployment_name: ${GRAPHRAG_EMBEDDING_DEPLOYMENT_NAME}
model: ${GRAPHRAG_EMBEDDING_MODEL}
tokens_per_minute: ${GRAPHRAG_EMBEDDING_TPM}
requests_per_minute: ${GRAPHRAG_EMBEDDING_RPM}
tokens_per_minute: null
requests_per_minute: null
concurrent_requests: 50
async_mode: threaded

Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/text/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ models:
api_version: ${GRAPHRAG_API_VERSION}
deployment_name: ${GRAPHRAG_EMBEDDING_DEPLOYMENT_NAME}
model: ${GRAPHRAG_EMBEDDING_MODEL}
tokens_per_minute: ${GRAPHRAG_EMBEDDING_TPM}
requests_per_minute: ${GRAPHRAG_EMBEDDING_RPM}
tokens_per_minute: null
requests_per_minute: null
concurrent_requests: 50
async_mode: threaded

Expand Down
2 changes: 2 additions & 0 deletions tests/smoke/test_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ def __run_indexer(
root.resolve().as_posix(),
"--logger",
"print",
"--method",
"standard",
]
command = [arg for arg in command if arg]
log.info("running command ", " ".join(command))
Expand Down
Loading