sample_id
stringlengths
21
196
text
stringlengths
105
936k
metadata
dict
category
stringclasses
6 values
microsoft/graphrag:packages/graphrag-chunking/graphrag_chunking/chunk_strategy_type.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Chunk strategy type enumeration.""" from enum import StrEnum class ChunkerType(StrEnum): """ChunkerType class definition.""" Tokens = "tokens" Sentence = "sentence"
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-chunking/graphrag_chunking/chunk_strategy_type.py", "license": "MIT License", "lines": 8, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-chunking/graphrag_chunking/chunker.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """A module containing the 'Chunker' class.""" from abc import ABC, abstractmethod from collections.abc import Callable from typing import Any from graphrag_chunking.text_chunk import TextChunk class Chunker(ABC): """Abstract base cla...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-chunking/graphrag_chunking/chunker.py", "license": "MIT License", "lines": 17, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-chunking/graphrag_chunking/chunker_factory.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """A module containing 'ChunkerFactory', 'register_chunker', and 'create_chunker'.""" from collections.abc import Callable from graphrag_common.factory.factory import Factory, ServiceScope from graphrag_chunking.chunk_strategy_type import ...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-chunking/graphrag_chunking/chunker_factory.py", "license": "MIT License", "lines": 58, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-chunking/graphrag_chunking/chunking_config.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Parameterization settings for the default configuration.""" from pydantic import BaseModel, ConfigDict, Field from graphrag_chunking.chunk_strategy_type import ChunkerType class ChunkingConfig(BaseModel): """Configuration section f...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-chunking/graphrag_chunking/chunking_config.py", "license": "MIT License", "lines": 29, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-chunking/graphrag_chunking/create_chunk_results.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """A module containing 'create_chunk_results' function.""" from collections.abc import Callable from graphrag_chunking.text_chunk import TextChunk def create_chunk_results( chunks: list[str], transform: Callable[[str], str] | None...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-chunking/graphrag_chunking/create_chunk_results.py", "license": "MIT License", "lines": 27, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-chunking/graphrag_chunking/sentence_chunker.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """A module containing 'SentenceChunker' class.""" from collections.abc import Callable from typing import Any import nltk from graphrag_chunking.bootstrap_nltk import bootstrap from graphrag_chunking.chunker import Chunker from graphrag_c...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-chunking/graphrag_chunking/sentence_chunker.py", "license": "MIT License", "lines": 40, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-chunking/graphrag_chunking/text_chunk.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """The TextChunk dataclass.""" from dataclasses import dataclass @dataclass class TextChunk: """Result of chunking a document.""" original: str """Raw original text chunk before any transformation.""" text: str """The...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-chunking/graphrag_chunking/text_chunk.py", "license": "MIT License", "lines": 19, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-chunking/graphrag_chunking/token_chunker.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """A module containing 'TokenChunker' class.""" from collections.abc import Callable from typing import Any from graphrag_chunking.chunker import Chunker from graphrag_chunking.create_chunk_results import create_chunk_results from graphrag_...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-chunking/graphrag_chunking/token_chunker.py", "license": "MIT License", "lines": 57, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-chunking/graphrag_chunking/transformers.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """A collection of useful built-in transformers you can use for chunking.""" from collections.abc import Callable from typing import Any def add_metadata( metadata: dict[str, Any], delimiter: str = ": ", line_delimiter: str = "...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-chunking/graphrag_chunking/transformers.py", "license": "MIT License", "lines": 19, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-common/graphrag_common/config/load_config.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Load configuration.""" import json import os from collections.abc import Callable from pathlib import Path from string import Template from typing import Any, TypeVar import yaml from dotenv import load_dotenv T = TypeVar("T", covariant...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-common/graphrag_common/config/load_config.py", "license": "MIT License", "lines": 166, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-common/graphrag_common/factory/factory.py
# Copyright (c) 2025 Microsoft Corporation. # Licensed under the MIT License """Factory ABC.""" from abc import ABC from collections.abc import Callable from dataclasses import dataclass from typing import Any, ClassVar, Generic, Literal, TypeVar from graphrag_common.hasher import hash_data T = TypeVar("T", covaria...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-common/graphrag_common/factory/factory.py", "license": "MIT License", "lines": 88, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-common/graphrag_common/hasher/hasher.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """The GraphRAG hasher module.""" import hashlib from collections.abc import Callable from typing import Any import yaml Hasher = Callable[[str], str] """Type alias for a hasher function (data: str) -> str.""" def sha256_hasher(data: str...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-common/graphrag_common/hasher/hasher.py", "license": "MIT License", "lines": 43, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-input/graphrag_input/csv.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """A module containing 'CSVFileReader' model.""" import csv import io import logging import sys from graphrag_input.structured_file_reader import StructuredFileReader from graphrag_input.text_document import TextDocument logger = logging.g...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-input/graphrag_input/csv.py", "license": "MIT License", "lines": 33, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-input/graphrag_input/get_property.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Utility for retrieving properties from nested dictionaries.""" from typing import Any def get_property(data: dict[str, Any], path: str) -> Any: """Retrieve a property from a dictionary using dot notation. Parameters -------...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-input/graphrag_input/get_property.py", "license": "MIT License", "lines": 29, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-input/graphrag_input/hashing.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Hashing utilities.""" from collections.abc import Iterable from hashlib import sha512 from typing import Any def gen_sha512_hash(item: dict[str, Any], hashcode: Iterable[str]) -> str: """Generate a SHA512 hash. Parameters -...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-input/graphrag_input/hashing.py", "license": "MIT License", "lines": 21, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-input/graphrag_input/input_config.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Parameterization settings for the default configuration.""" from pydantic import BaseModel, ConfigDict, Field from graphrag_input.input_type import InputType class InputConfig(BaseModel): """The default configuration section for In...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-input/graphrag_input/input_config.py", "license": "MIT License", "lines": 33, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-input/graphrag_input/input_reader.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """A module containing 'InputReader' model.""" from __future__ import annotations import logging import re from abc import ABCMeta, abstractmethod from typing import TYPE_CHECKING if TYPE_CHECKING: from collections.abc import AsyncIter...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-input/graphrag_input/input_reader.py", "license": "MIT License", "lines": 68, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-input/graphrag_input/input_reader_factory.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """A module containing 'InputReaderFactory' model.""" import logging from collections.abc import Callable from graphrag_common.factory import Factory from graphrag_common.factory.factory import ServiceScope from graphrag_storage.storage imp...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-input/graphrag_input/input_reader_factory.py", "license": "MIT License", "lines": 66, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-input/graphrag_input/input_type.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """A module containing input file type enum.""" from enum import StrEnum class InputType(StrEnum): """The input file type for the pipeline.""" Csv = "csv" """The CSV input type.""" Text = "text" """The text input type....
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-input/graphrag_input/input_type.py", "license": "MIT License", "lines": 19, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-input/graphrag_input/json.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """A module containing 'JSONFileReader' model.""" import json import logging from graphrag_input.structured_file_reader import StructuredFileReader from graphrag_input.text_document import TextDocument logger = logging.getLogger(__name__) ...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-input/graphrag_input/json.py", "license": "MIT License", "lines": 28, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-input/graphrag_input/jsonl.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """A module containing 'JSONLinesFileReader' model.""" import json import logging from graphrag_input.structured_file_reader import StructuredFileReader from graphrag_input.text_document import TextDocument logger = logging.getLogger(__nam...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-input/graphrag_input/jsonl.py", "license": "MIT License", "lines": 27, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-input/graphrag_input/markitdown.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """A module containing 'TextFileReader' model.""" import logging from io import BytesIO from pathlib import Path from markitdown import MarkItDown, StreamInfo from graphrag_input.hashing import gen_sha512_hash from graphrag_input.input_rea...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-input/graphrag_input/markitdown.py", "license": "MIT License", "lines": 37, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-input/graphrag_input/structured_file_reader.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """A module containing 'StructuredFileReader' model.""" import logging from typing import Any from graphrag_input.get_property import get_property from graphrag_input.hashing import gen_sha512_hash from graphrag_input.input_reader import In...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-input/graphrag_input/structured_file_reader.py", "license": "MIT License", "lines": 57, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-input/graphrag_input/text.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """A module containing 'TextFileReader' model.""" import logging from pathlib import Path from graphrag_input.hashing import gen_sha512_hash from graphrag_input.input_reader import InputReader from graphrag_input.text_document import TextDo...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-input/graphrag_input/text.py", "license": "MIT License", "lines": 33, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-input/graphrag_input/text_document.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """TextDocument dataclass.""" import logging from dataclasses import dataclass from typing import Any from graphrag_input.get_property import get_property logger = logging.getLogger(__name__) @dataclass class TextDocument: """The Tex...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-input/graphrag_input/text_document.py", "license": "MIT License", "lines": 45, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/cache/create_cache_key.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Create cache key.""" from typing import Any from graphrag_cache import create_cache_key as default_create_cache_key _CACHE_VERSION = 4 """ If there's a breaking change in what we cache, we should increment this version number to invalid...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/cache/create_cache_key.py", "license": "MIT License", "lines": 57, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/completion/completion.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Completion Abstract Base Class.""" from abc import ABC, abstractmethod from contextlib import contextmanager from typing import TYPE_CHECKING, Any, Unpack from graphrag_llm.threading.completion_thread_runner import completion_thread_runn...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/completion/completion.py", "license": "MIT License", "lines": 235, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/completion/completion_factory.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Completion factory.""" from collections.abc import Callable from typing import TYPE_CHECKING, Any from graphrag_common.factory import Factory from graphrag_llm.cache import create_cache_key from graphrag_llm.config.tokenizer_config impo...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/completion/completion_factory.py", "license": "MIT License", "lines": 122, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/completion/lite_llm_completion.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """LLMCompletion based on litellm.""" from collections.abc import AsyncIterator, Iterator from typing import TYPE_CHECKING, Any, Unpack import litellm from azure.identity import DefaultAzureCredential, get_bearer_token_provider from litellm...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/completion/lite_llm_completion.py", "license": "MIT License", "lines": 255, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/completion/mock_llm_completion.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Mock LLMCompletion.""" from typing import TYPE_CHECKING, Any, Unpack import litellm from graphrag_llm.completion.completion import LLMCompletion from graphrag_llm.utils import ( create_completion_response, structure_completion_r...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/completion/mock_llm_completion.py", "license": "MIT License", "lines": 108, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/config/metrics_config.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Metrics configuration.""" from pydantic import BaseModel, ConfigDict, Field, model_validator from graphrag_llm.config.types import ( MetricsProcessorType, MetricsStoreType, MetricsWriterType, ) class MetricsConfig(BaseModel...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/config/metrics_config.py", "license": "MIT License", "lines": 44, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/config/model_config.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Language model configuration.""" import logging from typing import Any from pydantic import BaseModel, ConfigDict, Field, model_validator from graphrag_llm.config.metrics_config import MetricsConfig from graphrag_llm.config.rate_limit_c...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/config/model_config.py", "license": "MIT License", "lines": 86, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/config/rate_limit_config.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """RateLimit configuration.""" from pydantic import BaseModel, ConfigDict, Field, model_validator from graphrag_llm.config.types import RateLimitType class RateLimitConfig(BaseModel): """Configuration for rate limit behavior.""" ...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/config/rate_limit_config.py", "license": "MIT License", "lines": 45, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/config/retry_config.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Retry configuration.""" from pydantic import BaseModel, ConfigDict, Field, model_validator from graphrag_llm.config.types import RetryType class RetryConfig(BaseModel): """Configuration for retry behavior.""" model_config = Co...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/config/retry_config.py", "license": "MIT License", "lines": 53, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/config/template_engine_config.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Template engine configuration.""" from pydantic import BaseModel, ConfigDict, Field, model_validator from graphrag_llm.config.types import ( TemplateEngineType, TemplateManagerType, ) class TemplateEngineConfig(BaseModel): ...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/config/template_engine_config.py", "license": "MIT License", "lines": 54, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/config/tokenizer_config.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Tokenizer model configuration.""" from pydantic import BaseModel, ConfigDict, Field, model_validator from graphrag_llm.config.types import TokenizerType class TokenizerConfig(BaseModel): """Configuration for a tokenizer.""" mo...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/config/tokenizer_config.py", "license": "MIT License", "lines": 39, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/config/types.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """GraphRAG LLM configuration types.""" from enum import StrEnum class LLMProviderType(StrEnum): """Enum for LLM provider types.""" LiteLLM = "litellm" MockLLM = "mock" class AuthMethod(StrEnum): """Enum for authenticat...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/config/types.py", "license": "MIT License", "lines": 39, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/embedding/embedding.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Completion Abstract Base Class.""" from abc import ABC, abstractmethod from contextlib import contextmanager from typing import TYPE_CHECKING, Any, Unpack from graphrag_llm.threading.embedding_thread_runner import embedding_thread_runner...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/embedding/embedding.py", "license": "MIT License", "lines": 165, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/embedding/embedding_factory.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Embedding factory.""" from collections.abc import Callable from typing import TYPE_CHECKING, Any from graphrag_common.factory import Factory from graphrag_llm.cache import create_cache_key from graphrag_llm.config.tokenizer_config impor...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/embedding/embedding_factory.py", "license": "MIT License", "lines": 122, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/embedding/lite_llm_embedding.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """LLMEmbedding based on litellm.""" from typing import TYPE_CHECKING, Any, Unpack import litellm from azure.identity import DefaultAzureCredential, get_bearer_token_provider from graphrag_llm.config.types import AuthMethod from graphrag_l...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/embedding/lite_llm_embedding.py", "license": "MIT License", "lines": 169, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/embedding/mock_llm_embedding.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """MockLLMEmbedding.""" from typing import TYPE_CHECKING, Any, Unpack import litellm from graphrag_llm.embedding.embedding import LLMEmbedding from graphrag_llm.utils import create_embedding_response if TYPE_CHECKING: from graphrag_ll...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/embedding/mock_llm_embedding.py", "license": "MIT License", "lines": 64, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/metrics/default_metrics_processor.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Default Metrics Processor.""" from typing import TYPE_CHECKING, Any from graphrag_llm.metrics.metrics_processor import MetricsProcessor from graphrag_llm.model_cost_registry import model_cost_registry from graphrag_llm.types import LLMCo...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/metrics/default_metrics_processor.py", "license": "MIT License", "lines": 109, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/metrics/file_metrics_writer.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """File metrics writer implementation.""" import json from collections.abc import Callable from datetime import datetime, timezone from pathlib import Path from typing import TYPE_CHECKING, Any from graphrag_llm.metrics.metrics_writer impor...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/metrics/file_metrics_writer.py", "license": "MIT License", "lines": 27, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/metrics/log_metrics_writer.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Log metrics writer implementation.""" import json import logging from collections.abc import Callable from typing import TYPE_CHECKING, Any from graphrag_llm.metrics.metrics_writer import MetricsWriter if TYPE_CHECKING: from graphra...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/metrics/log_metrics_writer.py", "license": "MIT License", "lines": 28, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/metrics/memory_metrics_store.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Default metrics store.""" import atexit import threading from typing import TYPE_CHECKING, Any from graphrag_llm.metrics.metrics_aggregator import metrics_aggregator from graphrag_llm.metrics.metrics_store import MetricsStore if TYPE_CH...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/metrics/memory_metrics_store.py", "license": "MIT License", "lines": 95, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/metrics/metrics_aggregator.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Metrics aggregator module.""" from collections.abc import Callable from typing import TYPE_CHECKING, Any, ClassVar from typing_extensions import Self if TYPE_CHECKING: from graphrag_llm.types.types import Metrics class MetricsAggr...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/metrics/metrics_aggregator.py", "license": "MIT License", "lines": 112, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/metrics/metrics_processor.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Metrics processor abstract base class.""" from abc import ABC, abstractmethod from typing import TYPE_CHECKING, Any if TYPE_CHECKING: from collections.abc import AsyncIterator, Iterator from graphrag_llm.config import ModelConfi...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/metrics/metrics_processor.py", "license": "MIT License", "lines": 48, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/metrics/metrics_processor_factory.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Metrics processor factory.""" from collections.abc import Callable from typing import TYPE_CHECKING from graphrag_common.factory import Factory from graphrag_llm.config.types import MetricsProcessorType from graphrag_llm.metrics.metrics...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/metrics/metrics_processor_factory.py", "license": "MIT License", "lines": 60, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/metrics/metrics_store.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Metrics Store.""" from abc import ABC, abstractmethod from typing import TYPE_CHECKING, Any if TYPE_CHECKING: from graphrag_llm.metrics.metrics_writer import MetricsWriter from graphrag_llm.types import Metrics class MetricsSto...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/metrics/metrics_store.py", "license": "MIT License", "lines": 65, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/metrics/metrics_store_factory.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Metrics store factory.""" from collections.abc import Callable from typing import TYPE_CHECKING, Any from graphrag_common.factory import Factory from graphrag_llm.config.types import MetricsStoreType from graphrag_llm.metrics.metrics_st...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/metrics/metrics_store_factory.py", "license": "MIT License", "lines": 70, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/metrics/metrics_writer.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Metrics writer abstract base class.""" from abc import ABC, abstractmethod from typing import TYPE_CHECKING, Any if TYPE_CHECKING: from graphrag_llm.types import Metrics class MetricsWriter(ABC): """Abstract base class for metr...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/metrics/metrics_writer.py", "license": "MIT License", "lines": 24, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/metrics/metrics_writer_factory.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Metrics writer factory.""" from collections.abc import Callable from typing import TYPE_CHECKING from graphrag_common.factory import Factory from graphrag_llm.config.types import MetricsWriterType from graphrag_llm.metrics.metrics_writ...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/metrics/metrics_writer_factory.py", "license": "MIT License", "lines": 68, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/metrics/noop_metrics_store.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Noop metrics store.""" from typing import Any from graphrag_llm.metrics.metrics_store import MetricsStore from graphrag_llm.types import Metrics class NoopMetricsStore(MetricsStore): """Noop store for metrics.""" def __init__(...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/metrics/noop_metrics_store.py", "license": "MIT License", "lines": 30, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/middleware/with_cache.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Cache middleware.""" import asyncio from typing import TYPE_CHECKING, Any, Literal from graphrag_llm.types import LLMCompletionResponse, LLMEmbeddingResponse if TYPE_CHECKING: from graphrag_cache import Cache, CacheKeyCreator f...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/middleware/with_cache.py", "license": "MIT License", "lines": 130, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/middleware/with_errors_for_testing.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Error testing middleware.""" import asyncio import random import time from typing import TYPE_CHECKING, Any import litellm.exceptions as exceptions if TYPE_CHECKING: from graphrag_llm.types import ( AsyncLLMFunction, ...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/middleware/with_errors_for_testing.py", "license": "MIT License", "lines": 68, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/middleware/with_logging.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Request count middleware.""" import logging from typing import TYPE_CHECKING, Any if TYPE_CHECKING: from graphrag_llm.types import ( AsyncLLMFunction, LLMFunction, Metrics, ) logger = logging.getLogger(__...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/middleware/with_logging.py", "license": "MIT License", "lines": 61, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/middleware/with_metrics.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Metrics middleware to process metrics using a MetricsProcessor.""" import time from typing import TYPE_CHECKING, Any if TYPE_CHECKING: from graphrag_llm.config import ModelConfig from graphrag_llm.metrics import MetricsProcessor ...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/middleware/with_metrics.py", "license": "MIT License", "lines": 84, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/middleware/with_middleware_pipeline.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Wraps model functions in middleware pipeline.""" from typing import TYPE_CHECKING, Literal from graphrag_llm.middleware.with_cache import with_cache from graphrag_llm.middleware.with_errors_for_testing import with_errors_for_testing from...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/middleware/with_middleware_pipeline.py", "license": "MIT License", "lines": 136, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/middleware/with_rate_limiting.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Rate limit middleware.""" from typing import TYPE_CHECKING, Any if TYPE_CHECKING: from graphrag_llm.rate_limit import RateLimiter from graphrag_llm.tokenizer import Tokenizer from graphrag_llm.types import ( AsyncLLMF...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/middleware/with_rate_limiting.py", "license": "MIT License", "lines": 68, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/middleware/with_request_count.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Request count middleware.""" from typing import TYPE_CHECKING, Any if TYPE_CHECKING: from graphrag_llm.types import ( AsyncLLMFunction, LLMFunction, Metrics, ) def with_request_count( *, sync_mid...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/middleware/with_request_count.py", "license": "MIT License", "lines": 69, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/middleware/with_retries.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Retry middleware.""" from typing import TYPE_CHECKING, Any if TYPE_CHECKING: from graphrag_llm.retry import Retry from graphrag_llm.types import ( AsyncLLMFunction, LLMFunction, ) def with_retries( *, ...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/middleware/with_retries.py", "license": "MIT License", "lines": 50, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/model_cost_registry/model_cost_registry.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Model cost registry module.""" from typing import Any, ClassVar, TypedDict from litellm import model_cost from typing_extensions import Self class ModelCosts(TypedDict): """Model costs.""" input_cost_per_token: float outpu...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/model_cost_registry/model_cost_registry.py", "license": "MIT License", "lines": 46, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/rate_limit/rate_limit_factory.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Rate limit factory.""" from collections.abc import Callable from typing import TYPE_CHECKING from graphrag_common.factory import Factory from graphrag_llm.config import RateLimitType from graphrag_llm.rate_limit.rate_limiter import Rate...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/rate_limit/rate_limit_factory.py", "license": "MIT License", "lines": 63, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/rate_limit/sliding_window_rate_limiter.py
# Copyright (c) 2025 Microsoft Corporation. # Licensed under the MIT License """LiteLLM Static Rate Limiter.""" import threading import time from collections import deque from collections.abc import Iterator from contextlib import contextmanager from typing import Any from graphrag_llm.rate_limit.rate_limiter import...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/rate_limit/sliding_window_rate_limiter.py", "license": "MIT License", "lines": 124, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/retry/exceptions_to_skip.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """List of exception names to skip for retries.""" _default_exceptions_to_skip = [ "BadRequestError", "UnsupportedParamsError", "ContextWindowExceededError", "ContentPolicyViolationError", "ImageFetchError", "InvalidR...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/retry/exceptions_to_skip.py", "license": "MIT License", "lines": 20, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/retry/exponential_retry.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Exponential backoff retry implementation.""" import asyncio import random import time from collections.abc import Awaitable, Callable from typing import TYPE_CHECKING, Any from graphrag_llm.retry.exceptions_to_skip import _default_except...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/retry/exponential_retry.py", "license": "MIT License", "lines": 104, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/retry/immediate_retry.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Native (immediate) retry implementation.""" from collections.abc import Awaitable, Callable from typing import TYPE_CHECKING, Any from graphrag_llm.retry.exceptions_to_skip import _default_exceptions_to_skip from graphrag_llm.retry.retry...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/retry/immediate_retry.py", "license": "MIT License", "lines": 71, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/retry/retry.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Retry abstract base class.""" from abc import ABC, abstractmethod from collections.abc import Awaitable, Callable from typing import Any class Retry(ABC): """Retry Abstract Base Class.""" @abstractmethod def __init__(self, ...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/retry/retry.py", "license": "MIT License", "lines": 25, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/retry/retry_factory.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Retry factory.""" from collections.abc import Callable from typing import TYPE_CHECKING from graphrag_common.factory import Factory from graphrag_llm.config.types import RetryType from graphrag_llm.retry.retry import Retry if TYPE_CHEC...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/retry/retry_factory.py", "license": "MIT License", "lines": 65, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/templating/file_template_manager.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """In-memory template manager implementation.""" from pathlib import Path from typing import Any from graphrag_llm.templating.template_manager import TemplateManager class FileTemplateManager(TemplateManager): """Abstract base class f...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/templating/file_template_manager.py", "license": "MIT License", "lines": 61, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/templating/jinja_template_engine.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Jinja template engine.""" from typing import TYPE_CHECKING, Any from jinja2 import StrictUndefined, Template, UndefinedError from graphrag_llm.templating.template_engine import TemplateEngine if TYPE_CHECKING: from graphrag_llm.tem...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/templating/jinja_template_engine.py", "license": "MIT License", "lines": 43, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/templating/template_engine.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Abstract base class for template engines.""" from abc import ABC, abstractmethod from typing import TYPE_CHECKING, Any if TYPE_CHECKING: from graphrag_llm.templating.template_manager import TemplateManager class TemplateEngine(ABC)...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/templating/template_engine.py", "license": "MIT License", "lines": 40, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/templating/template_engine_factory.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Template engine factory implementation.""" from collections.abc import Callable from typing import TYPE_CHECKING from graphrag_common.factory import Factory from graphrag_llm.config.template_engine_config import TemplateEngineConfig fro...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/templating/template_engine_factory.py", "license": "MIT License", "lines": 75, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/templating/template_manager.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Abstract base class for template managers.""" from abc import ABC, abstractmethod from typing import Any class TemplateManager(ABC): """Abstract base class for template managers.""" @abstractmethod def __init__(self, **kwar...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/templating/template_manager.py", "license": "MIT License", "lines": 51, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/templating/template_manager_factory.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Template manager factory implementation.""" from collections.abc import Callable from typing import TYPE_CHECKING from graphrag_common.factory import Factory from graphrag_llm.config.template_engine_config import TemplateEngineConfig fr...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/templating/template_manager_factory.py", "license": "MIT License", "lines": 63, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/threading/completion_thread.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Completion Thread.""" import threading from queue import Empty, Queue from typing import TYPE_CHECKING if TYPE_CHECKING: from collections.abc import Iterator from graphrag_llm.types import ( LLMCompletionArgs, LL...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/threading/completion_thread.py", "license": "MIT License", "lines": 72, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/threading/completion_thread_runner.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Completion Thread Runner.""" import asyncio import sys import threading import time from collections.abc import Awaitable, Iterator from contextlib import contextmanager from queue import Empty, Queue from typing import TYPE_CHECKING, Pro...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/threading/completion_thread_runner.py", "license": "MIT License", "lines": 208, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/threading/embedding_thread.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Embedding Thread.""" import threading from queue import Empty, Queue from typing import TYPE_CHECKING if TYPE_CHECKING: from graphrag_llm.types import ( LLMEmbeddingArgs, LLMEmbeddingFunction, LLMEmbeddingResp...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/threading/embedding_thread.py", "license": "MIT License", "lines": 70, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/threading/embedding_thread_runner.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Embedding Thread Runner.""" import asyncio import sys import threading import time from collections.abc import Awaitable, Iterator from contextlib import contextmanager from queue import Empty, Queue from typing import TYPE_CHECKING, Prot...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/threading/embedding_thread_runner.py", "license": "MIT License", "lines": 182, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/tokenizer/tokenizer.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Tokenizer Abstract Base Class.""" from abc import ABC, abstractmethod from typing import TYPE_CHECKING, Any if TYPE_CHECKING: from graphrag_llm.types import LLMCompletionMessagesParam class Tokenizer(ABC): """Tokenizer Abstract...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/tokenizer/tokenizer.py", "license": "MIT License", "lines": 89, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/tokenizer/tokenizer_factory.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Tokenizer factory.""" from collections.abc import Callable from typing import TYPE_CHECKING from graphrag_common.factory import Factory from graphrag_llm.config.types import TokenizerType from graphrag_llm.tokenizer.tokenizer import Tok...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/tokenizer/tokenizer_factory.py", "license": "MIT License", "lines": 68, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/types/types.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Types for graphrag-llm.""" from collections.abc import AsyncIterator, Awaitable, Iterator, Sequence from typing import ( Any, Generic, Literal, Protocol, Required, TypeVar, Unpack, runtime_checkable, ) fro...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/types/types.py", "license": "MIT License", "lines": 211, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/utils/completion_messages_builder.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """ChatCompletionMessageParamBuilder class.""" from collections.abc import Iterable from typing import TYPE_CHECKING, Literal from openai.types.chat.chat_completion_assistant_message_param import ( ChatCompletionAssistantMessageParam, )...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/utils/completion_messages_builder.py", "license": "MIT License", "lines": 281, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/utils/create_completion_response.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Create completion response.""" from graphrag_llm.types import ( LLMChoice, LLMCompletionMessage, LLMCompletionResponse, LLMCompletionUsage, ) def create_completion_response(response: str) -> LLMCompletionResponse: ""...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/utils/create_completion_response.py", "license": "MIT License", "lines": 39, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/utils/create_embedding_response.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Create embedding response utilities.""" from graphrag_llm.types import LLMEmbedding, LLMEmbeddingResponse, LLMEmbeddingUsage def create_embedding_response( embeddings: list[float], batch_size: int = 1 ) -> LLMEmbeddingResponse: ...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/utils/create_embedding_response.py", "license": "MIT License", "lines": 32, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/utils/function_tool_manager.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Function tool manager.""" import json from collections.abc import Callable from typing import TYPE_CHECKING, Any, Generic, TypeVar from openai import pydantic_function_tool from pydantic import BaseModel from typing_extensions import Typ...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/utils/function_tool_manager.py", "license": "MIT License", "lines": 109, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/utils/gather_completion_response.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Gather Completion Response Utility.""" from collections.abc import AsyncIterator, Iterator from typing import TYPE_CHECKING if TYPE_CHECKING: from graphrag_llm.types import ( LLMCompletionChunk, LLMCompletionResponse,...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/utils/gather_completion_response.py", "license": "MIT License", "lines": 43, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-llm/graphrag_llm/utils/structure_response.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Structure response as pydantic base model.""" import json from typing import Any, TypeVar from pydantic import BaseModel T = TypeVar("T", bound=BaseModel, covariant=True) def structure_completion_response(response: str, model: type[T]...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-llm/graphrag_llm/utils/structure_response.py", "license": "MIT License", "lines": 21, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-storage/graphrag_storage/storage.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Abstract base class for storage.""" import re from abc import ABC, abstractmethod from collections.abc import Iterator from datetime import datetime from typing import Any class Storage(ABC): """Provide a storage interface.""" ...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-storage/graphrag_storage/storage.py", "license": "MIT License", "lines": 110, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-storage/graphrag_storage/storage_config.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Storage configuration model.""" from pydantic import BaseModel, ConfigDict, Field from graphrag_storage.storage_type import StorageType class StorageConfig(BaseModel): """The default configuration section for storage.""" model...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-storage/graphrag_storage/storage_config.py", "license": "MIT License", "lines": 37, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-storage/graphrag_storage/storage_factory.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Storage factory implementation.""" from collections.abc import Callable from graphrag_common.factory import Factory, ServiceScope from graphrag_storage.storage import Storage from graphrag_storage.storage_config import StorageConfig fr...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-storage/graphrag_storage/storage_factory.py", "license": "MIT License", "lines": 56, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-storage/graphrag_storage/storage_type.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Builtin storage implementation types.""" from enum import StrEnum class StorageType(StrEnum): """Enum for storage types.""" File = "file" Memory = "memory" AzureBlob = "blob" AzureCosmos = "cosmosdb"
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-storage/graphrag_storage/storage_type.py", "license": "MIT License", "lines": 10, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-vectors/graphrag_vectors/azure_ai_search.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """A package containing the Azure AI Search vector store implementation.""" from typing import Any from azure.core.credentials import AzureKeyCredential from azure.identity import DefaultAzureCredential from azure.search.documents import S...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-vectors/graphrag_vectors/azure_ai_search.py", "license": "MIT License", "lines": 337, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-vectors/graphrag_vectors/lancedb.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """The LanceDB vector storage implementation package.""" from typing import Any import lancedb import numpy as np import pyarrow as pa from graphrag_vectors.filtering import ( AndExpr, Condition, FilterExpr, NotExpr, Op...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-vectors/graphrag_vectors/lancedb.py", "license": "MIT License", "lines": 235, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-vectors/graphrag_vectors/types.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Common types for vector stores.""" from collections.abc import Callable TextEmbedder = Callable[[str], list[float]]
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-vectors/graphrag_vectors/types.py", "license": "MIT License", "lines": 5, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-vectors/graphrag_vectors/vector_store.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Base classes for vector stores.""" from abc import ABC, abstractmethod from collections.abc import Callable from dataclasses import dataclass, field from datetime import datetime, timezone from typing import Any from graphrag_vectors.fil...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-vectors/graphrag_vectors/vector_store.py", "license": "MIT License", "lines": 179, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-vectors/graphrag_vectors/vector_store_config.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Parameterization settings for the default configuration.""" from pydantic import BaseModel, ConfigDict, Field from graphrag_vectors.index_schema import DEFAULT_VECTOR_SIZE, IndexSchema from graphrag_vectors.vector_store_type import Vecto...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-vectors/graphrag_vectors/vector_store_config.py", "license": "MIT License", "lines": 43, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-vectors/graphrag_vectors/vector_store_factory.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Factory functions for creating a vector store.""" from __future__ import annotations from typing import TYPE_CHECKING from graphrag_common.factory import Factory, ServiceScope from graphrag_vectors.vector_store import VectorStore from ...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-vectors/graphrag_vectors/vector_store_factory.py", "license": "MIT License", "lines": 74, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag-vectors/graphrag_vectors/vector_store_type.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Vector store type enum.""" from enum import StrEnum class VectorStoreType(StrEnum): """The supported vector store types.""" LanceDB = "lancedb" AzureAISearch = "azure_ai_search" CosmosDB = "cosmosdb"
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag-vectors/graphrag_vectors/vector_store_type.py", "license": "MIT License", "lines": 9, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license
microsoft/graphrag:packages/graphrag/graphrag/api/query.py
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """ Query Engine API. This API provides access to the query engine of graphrag, allowing external applications to hook into graphrag and run queries over a knowledge graph generated by graphrag. Contains the following functions: - global_s...
{ "repo_id": "microsoft/graphrag", "file_path": "packages/graphrag/graphrag/api/query.py", "license": "MIT License", "lines": 474, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
license