repo stringlengths 7 90 | file_url stringlengths 81 315 | file_path stringlengths 4 228 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 14:38:15 2026-01-05 02:33:18 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/indices/vector_store/retrievers/auto_retriever/output_parser.py | llama-index-core/llama_index/core/indices/vector_store/retrievers/auto_retriever/output_parser.py | from typing import Any
from llama_index.core.output_parsers.base import StructuredOutput
from llama_index.core.output_parsers.utils import parse_json_markdown
from llama_index.core.types import BaseOutputParser
from llama_index.core.vector_stores.types import VectorStoreQuerySpec
class VectorStoreQueryOutputParser(B... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/indices/vector_store/retrievers/auto_retriever/__init__.py | llama-index-core/llama_index/core/indices/vector_store/retrievers/auto_retriever/__init__.py | from llama_index.core.indices.vector_store.retrievers.auto_retriever.auto_retriever import (
VectorIndexAutoRetriever,
)
__all__ = [
"VectorIndexAutoRetriever",
]
| python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/indices/knowledge_graph/retrievers.py | llama-index-core/llama_index/core/indices/knowledge_graph/retrievers.py | """KG Retrievers."""
import deprecated
import logging
from collections import defaultdict
from enum import Enum
from typing import Any, Callable, Dict, List, Optional, Set, Tuple
from llama_index.core.base.base_retriever import BaseRetriever
from llama_index.core.base.embeddings.base import BaseEmbedding
from llama_i... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | true |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/indices/knowledge_graph/__init__.py | llama-index-core/llama_index/core/indices/knowledge_graph/__init__.py | """KG-based data structures."""
from llama_index.core.indices.knowledge_graph.base import (
KnowledgeGraphIndex,
)
from llama_index.core.indices.knowledge_graph.retrievers import (
KGTableRetriever,
KnowledgeGraphRAGRetriever,
)
__all__ = [
"KnowledgeGraphIndex",
"KGTableRetriever",
"Knowledge... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/indices/knowledge_graph/base.py | llama-index-core/llama_index/core/indices/knowledge_graph/base.py | """
Knowledge Graph Index.
Build a KG by extracting triplets, and leveraging the KG during query-time.
"""
import logging
import deprecated
from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple
from llama_index.core.base.base_retriever import BaseRetriever
from llama_index.core.base.embeddings.bas... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/indices/common_tree/__init__.py | llama-index-core/llama_index/core/indices/common_tree/__init__.py | """Init params."""
| python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/indices/common_tree/base.py | llama-index-core/llama_index/core/indices/common_tree/base.py | """Common classes/functions for tree index operations."""
import asyncio
import logging
from typing import Dict, List, Optional, Sequence, Tuple
from llama_index.core.async_utils import run_async_tasks
from llama_index.core.callbacks.schema import CBEventType, EventPayload
from llama_index.core.data_structs.data_stru... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/indices/composability/graph.py | llama-index-core/llama_index/core/indices/composability/graph.py | """Composability graphs."""
from typing import Any, Dict, List, Optional, Sequence, Type, cast
from llama_index.core.base.base_query_engine import BaseQueryEngine
from llama_index.core.data_structs.data_structs import IndexStruct
from llama_index.core.indices.base import BaseIndex
from llama_index.core.schema import ... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/indices/composability/__init__.py | llama-index-core/llama_index/core/indices/composability/__init__.py | """This module contains all classes used for composing graphs over indices."""
from llama_index.core.indices.composability.graph import ComposableGraph
__all__ = ["ComposableGraph"]
| python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/indices/keyword_table/utils.py | llama-index-core/llama_index/core/indices/keyword_table/utils.py | """Utils for keyword table."""
import re
from collections import Counter
from typing import Optional, Set
from llama_index.core.indices.utils import expand_tokens_with_subtokens
from llama_index.core.utils import globals_helper
def simple_extract_keywords(
text_chunk: str, max_keywords: Optional[int] = None, fi... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/indices/keyword_table/retrievers.py | llama-index-core/llama_index/core/indices/keyword_table/retrievers.py | """Query for KeywordTableIndex."""
import logging
from abc import abstractmethod
from collections import defaultdict
from typing import Any, Dict, List, Optional
from llama_index.core.base.base_retriever import BaseRetriever
from llama_index.core.callbacks.base import CallbackManager
from llama_index.core.indices.key... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/indices/keyword_table/simple_base.py | llama-index-core/llama_index/core/indices/keyword_table/simple_base.py | """
Simple keyword-table based index.
Similar to KeywordTableIndex, but uses a simpler keyword extraction
technique that doesn't involve GPT - just uses regex.
"""
from typing import Any, Set, Union
from llama_index.core.base.base_retriever import BaseRetriever
from llama_index.core.indices.keyword_table.base impor... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/indices/keyword_table/__init__.py | llama-index-core/llama_index/core/indices/keyword_table/__init__.py | """Keyword Table Index Data Structures."""
# indices
from llama_index.core.indices.keyword_table.base import (
GPTKeywordTableIndex,
KeywordTableIndex,
)
from llama_index.core.indices.keyword_table.rake_base import (
GPTRAKEKeywordTableIndex,
RAKEKeywordTableIndex,
)
from llama_index.core.indices.keywo... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/indices/keyword_table/rake_base.py | llama-index-core/llama_index/core/indices/keyword_table/rake_base.py | """
RAKE keyword-table based index.
Similar to KeywordTableIndex, but uses RAKE instead of GPT.
"""
from typing import Any, Set, Union
from llama_index.core.base.base_retriever import BaseRetriever
from llama_index.core.indices.keyword_table.base import (
BaseKeywordTableIndex,
KeywordTableRetrieverMode,
)
... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/indices/keyword_table/base.py | llama-index-core/llama_index/core/indices/keyword_table/base.py | """
Keyword-table based index.
Similar to a "hash table" in concept. LlamaIndex first tries
to extract keywords from the source text, and stores the
keywords as keys per item. It similarly extracts keywords
from the query text. Then, it tries to match those keywords to
existing keywords in the table.
"""
from abc im... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/indices/tree/select_leaf_retriever.py | llama-index-core/llama_index/core/indices/tree/select_leaf_retriever.py | """Leaf query mechanism."""
import logging
from typing import Any, Dict, List, Optional, cast
from llama_index.core.base.base_retriever import BaseRetriever
from llama_index.core.base.response.schema import Response
from llama_index.core.callbacks.base import CallbackManager
from llama_index.core.indices.prompt_helpe... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/indices/tree/tree_root_retriever.py | llama-index-core/llama_index/core/indices/tree/tree_root_retriever.py | """Retrieve query."""
import logging
from typing import Any, List, Optional
from llama_index.core.base.base_retriever import BaseRetriever
from llama_index.core.callbacks.base import CallbackManager
from llama_index.core.indices.query.schema import QueryBundle
from llama_index.core.indices.tree.base import TreeIndex
... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/indices/tree/inserter.py | llama-index-core/llama_index/core/indices/tree/inserter.py | """Tree Index inserter."""
from typing import Optional, Sequence
from llama_index.core.data_structs.data_structs import IndexGraph
from llama_index.core.indices.prompt_helper import PromptHelper
from llama_index.core.indices.tree.utils import get_numbered_text_from_nodes
from llama_index.core.indices.utils import (
... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/indices/tree/utils.py | llama-index-core/llama_index/core/indices/tree/utils.py | from typing import List, Optional
from llama_index.core.node_parser.text import TokenTextSplitter
from llama_index.core.node_parser.text.utils import truncate_text
from llama_index.core.schema import BaseNode
def get_numbered_text_from_nodes(
node_list: List[BaseNode],
text_splitter: Optional[TokenTextSplitt... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/indices/tree/__init__.py | llama-index-core/llama_index/core/indices/tree/__init__.py | """Tree-structured Index Data Structures."""
# indices
from llama_index.core.indices.tree.all_leaf_retriever import TreeAllLeafRetriever
from llama_index.core.indices.tree.base import GPTTreeIndex, TreeIndex
from llama_index.core.indices.tree.select_leaf_embedding_retriever import (
TreeSelectLeafEmbeddingRetrieve... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/indices/tree/select_leaf_embedding_retriever.py | llama-index-core/llama_index/core/indices/tree/select_leaf_embedding_retriever.py | """Query Tree using embedding similarity between query and node text."""
import logging
from typing import Any, Dict, List, Optional, Tuple, cast
from llama_index.core.base.embeddings.base import BaseEmbedding
from llama_index.core.callbacks.base import CallbackManager
from llama_index.core.indices.tree.base import T... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/indices/tree/base.py | llama-index-core/llama_index/core/indices/tree/base.py | """Tree-based index."""
from enum import Enum
from typing import Any, Dict, Optional, Sequence, Union
from llama_index.core.base.base_retriever import BaseRetriever
from llama_index.core.base.embeddings.base import BaseEmbedding
# from llama_index.core.data_structs.data_structs import IndexGraph
from llama_index.cor... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/indices/tree/all_leaf_retriever.py | llama-index-core/llama_index/core/indices/tree/all_leaf_retriever.py | """Summarize query."""
import logging
from typing import Any, List, Optional, cast
from llama_index.core.base.base_retriever import BaseRetriever
from llama_index.core.callbacks.base import CallbackManager
from llama_index.core.data_structs.data_structs import IndexGraph
from llama_index.core.indices.tree.base import... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/memory/memory.py | llama-index-core/llama_index/core/memory/memory.py | import asyncio
import uuid
from abc import abstractmethod
from enum import Enum
from sqlalchemy.ext.asyncio import AsyncEngine
from typing import (
Any,
Callable,
Dict,
List,
Optional,
Tuple,
Union,
TypeVar,
Generic,
cast,
)
from llama_index.core.async_utils import asyncio_run
f... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/memory/vector_memory.py | llama-index-core/llama_index/core/memory/vector_memory.py | """
Vector memory.
Memory backed by a vector database.
"""
import uuid
from typing import Any, Dict, List, Optional, Union
from llama_index.core.base.llms.types import ChatMessage, MessageRole
from llama_index.core.bridge.pydantic import Field, field_validator
from llama_index.core.embeddings.utils import EmbedType... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/memory/chat_memory_buffer.py | llama-index-core/llama_index/core/memory/chat_memory_buffer.py | import asyncio
import json
from typing import Any, Callable, Dict, List, Optional
from llama_index.core.base.llms.types import ChatMessage, MessageRole
from llama_index.core.bridge.pydantic import Field, model_validator
from llama_index.core.llms.llm import LLM
from llama_index.core.memory.types import (
DEFAULT_C... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/memory/simple_composable_memory.py | llama-index-core/llama_index/core/memory/simple_composable_memory.py | from typing import Any, List, Optional
from llama_index.core.base.llms.types import ChatMessage, MessageRole
from llama_index.core.bridge.pydantic import Field, SerializeAsAny
from llama_index.core.memory.types import (
BaseMemory,
)
from llama_index.core.memory import ChatMemoryBuffer
DEFAULT_INTRO_HISTORY_MESSA... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/memory/__init__.py | llama-index-core/llama_index/core/memory/__init__.py | from llama_index.core.memory.chat_memory_buffer import ChatMemoryBuffer
from llama_index.core.memory.chat_summary_memory_buffer import ChatSummaryMemoryBuffer
from llama_index.core.memory.types import BaseMemory
from llama_index.core.memory.vector_memory import VectorMemory
from llama_index.core.memory.simple_composabl... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/memory/types.py | llama-index-core/llama_index/core/memory/types.py | import asyncio
from abc import abstractmethod
from typing import Any, List, Optional
from llama_index.core.base.llms.types import ChatMessage
from llama_index.core.llms.llm import LLM
from llama_index.core.schema import BaseComponent
from llama_index.core.storage.chat_store import BaseChatStore, SimpleChatStore
from l... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/memory/chat_summary_memory_buffer.py | llama-index-core/llama_index/core/memory/chat_summary_memory_buffer.py | import json
import logging
from typing import Any, Callable, Dict, List, Tuple, Optional
from llama_index.core.base.llms.types import ChatMessage, MessageRole
from llama_index.core.bridge.pydantic import (
Field,
PrivateAttr,
model_validator,
field_serializer,
SerializeAsAny,
)
from llama_index.cor... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/memory/memory_blocks/vector.py | llama-index-core/llama_index/core/memory/memory_blocks/vector.py | from typing import Any, Dict, List, Optional
from llama_index.core.base.embeddings.base import BaseEmbedding
from llama_index.core.base.llms.types import ChatMessage, TextBlock
from llama_index.core.bridge.pydantic import Field, field_validator
from llama_index.core.memory.memory import BaseMemoryBlock
from llama_inde... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/memory/memory_blocks/fact.py | llama-index-core/llama_index/core/memory/memory_blocks/fact.py | import re
from typing import Any, List, Optional, Union
from llama_index.core.base.llms.types import ChatMessage
from llama_index.core.bridge.pydantic import Field, field_validator
from llama_index.core.llms import LLM
from llama_index.core.memory.memory import BaseMemoryBlock
from llama_index.core.prompts import (
... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/memory/memory_blocks/__init__.py | llama-index-core/llama_index/core/memory/memory_blocks/__init__.py | from llama_index.core.memory.memory_blocks.static import StaticMemoryBlock
from llama_index.core.memory.memory_blocks.vector import VectorMemoryBlock
from llama_index.core.memory.memory_blocks.fact import FactExtractionMemoryBlock
__all__ = [
"StaticMemoryBlock",
"VectorMemoryBlock",
"FactExtractionMemoryB... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/memory/memory_blocks/static.py | llama-index-core/llama_index/core/memory/memory_blocks/static.py | from typing import Any, List, Optional, Union
from llama_index.core.base.llms.types import ChatMessage, ContentBlock, TextBlock
from llama_index.core.bridge.pydantic import Field, field_validator
from llama_index.core.memory.memory import BaseMemoryBlock
class StaticMemoryBlock(BaseMemoryBlock[List[ContentBlock]]):
... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/selectors/pydantic_selectors.py | llama-index-core/llama_index/core/selectors/pydantic_selectors.py | from typing import TYPE_CHECKING, Any, Dict, Optional, Sequence
from llama_index.core.base.base_selector import (
BaseSelector,
MultiSelection,
SelectorResult,
SingleSelection,
)
from llama_index.core.program import FunctionCallingProgram
from llama_index.core.prompts.mixin import PromptDictType
from l... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/selectors/prompts.py | llama-index-core/llama_index/core/selectors/prompts.py | from llama_index.core.prompts.base import PromptTemplate
from llama_index.core.prompts.prompt_type import PromptType
"""Single select prompt.
PromptTemplate to select one out of `num_choices` options provided in `context_list`,
given a query `query_str`.
Required template variables: `num_chunks`, `context_list`, `qu... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/selectors/embedding_selectors.py | llama-index-core/llama_index/core/selectors/embedding_selectors.py | from typing import Any, Dict, Optional, Sequence
from llama_index.core.base.base_selector import (
BaseSelector,
SelectorResult,
SingleSelection,
)
from llama_index.core.base.embeddings.base import BaseEmbedding
from llama_index.core.indices.query.embedding_utils import get_top_k_embeddings
from llama_inde... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/selectors/llm_selectors.py | llama-index-core/llama_index/core/selectors/llm_selectors.py | from typing import Any, Dict, List, Optional, Sequence, cast
from llama_index.core.base.base_selector import (
BaseSelector,
SelectorResult,
SingleSelection,
)
from llama_index.core.llms import LLM
from llama_index.core.output_parsers.base import StructuredOutput
from llama_index.core.output_parsers.select... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/selectors/utils.py | llama-index-core/llama_index/core/selectors/utils.py | from typing import Optional
from llama_index.core.base.base_selector import BaseSelector
from llama_index.core.llms.llm import LLM
from llama_index.core.selectors.llm_selectors import (
LLMMultiSelector,
LLMSingleSelector,
)
from llama_index.core.selectors.pydantic_selectors import (
PydanticMultiSelector,... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/selectors/__init__.py | llama-index-core/llama_index/core/selectors/__init__.py | from llama_index.core.base.base_selector import (
BaseSelector,
MultiSelection,
SingleSelection,
SelectorResult,
)
from llama_index.core.selectors.embedding_selectors import EmbeddingSingleSelector
from llama_index.core.selectors.llm_selectors import (
LLMMultiSelector,
LLMSingleSelector,
)
from... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/callbacks/pythonically_printing_base_handler.py | llama-index-core/llama_index/core/callbacks/pythonically_printing_base_handler.py | import logging
from typing import List, Optional
from llama_index.core.callbacks.base_handler import BaseCallbackHandler
from llama_index.core.callbacks.schema import (
CBEventType,
)
class PythonicallyPrintingBaseHandler(BaseCallbackHandler):
"""
Callback handler that prints logs in a Pythonic way. That... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/callbacks/schema.py | llama-index-core/llama_index/core/callbacks/schema.py | """Base schema for callback managers."""
import uuid
from dataclasses import dataclass
from datetime import datetime
from enum import Enum
from typing import Any, Dict, Optional
# timestamp for callback events
TIMESTAMP_FORMAT = "%m/%d/%Y, %H:%M:%S.%f"
# base trace_id for the tracemap in callback_manager
BASE_TRACE_... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/callbacks/token_counting.py | llama-index-core/llama_index/core/callbacks/token_counting.py | from dataclasses import dataclass
from typing import (
TYPE_CHECKING,
Any,
Callable,
Dict,
List,
Optional,
Tuple,
Union,
cast,
)
from llama_index.core.callbacks.pythonically_printing_base_handler import (
PythonicallyPrintingBaseHandler,
)
from llama_index.core.callbacks.schema ... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/callbacks/base_handler.py | llama-index-core/llama_index/core/callbacks/base_handler.py | import logging
from abc import ABC, abstractmethod
from contextvars import ContextVar
from typing import Any, Dict, List, Optional
from llama_index.core.callbacks.schema import BASE_TRACE_EVENT, CBEventType
logger = logging.getLogger(__name__)
global_stack_trace = ContextVar("trace", default=[BASE_TRACE_EVENT])
cla... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/callbacks/llama_debug.py | llama-index-core/llama_index/core/callbacks/llama_debug.py | from collections import defaultdict
from datetime import datetime
from typing import Any, Dict, List, Optional
import logging
from llama_index.core.callbacks.pythonically_printing_base_handler import (
PythonicallyPrintingBaseHandler,
)
from llama_index.core.callbacks.schema import (
BASE_TRACE_EVENT,
TIMES... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/callbacks/utils.py | llama-index-core/llama_index/core/callbacks/utils.py | import asyncio
import functools
import logging
from typing import Any, Callable, cast
from llama_index.core.callbacks.base import CallbackManager
logger = logging.getLogger(__name__)
def trace_method(
trace_id: str, callback_manager_attr: str = "callback_manager"
) -> Callable[[Callable], Callable]:
"""
... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/callbacks/__init__.py | llama-index-core/llama_index/core/callbacks/__init__.py | from .base import CallbackManager
from .llama_debug import LlamaDebugHandler
from .schema import CBEvent, CBEventType, EventPayload
from .token_counting import TokenCountingHandler
from .pythonically_printing_base_handler import PythonicallyPrintingBaseHandler
from .utils import trace_method
__all__ = [
"CallbackM... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/callbacks/base.py | llama-index-core/llama_index/core/callbacks/base.py | import logging
import uuid
from abc import ABC
from collections import defaultdict
from contextlib import contextmanager
from contextvars import ContextVar
from typing import Any, Dict, Generator, List, Optional, cast, Type
from llama_index.core.callbacks.base_handler import BaseCallbackHandler
from llama_index.core.c... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/callbacks/simple_llm_handler.py | llama-index-core/llama_index/core/callbacks/simple_llm_handler.py | import logging
from typing import Any, Dict, List, Optional, cast
from llama_index.core.callbacks.pythonically_printing_base_handler import (
PythonicallyPrintingBaseHandler,
)
from llama_index.core.callbacks.schema import CBEventType, EventPayload
class SimpleLLMHandler(PythonicallyPrintingBaseHandler):
"""... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/callbacks/global_handlers.py | llama-index-core/llama_index/core/callbacks/global_handlers.py | from typing import Any, Optional
from llama_index.core.callbacks.base_handler import BaseCallbackHandler
from llama_index.core.callbacks.simple_llm_handler import SimpleLLMHandler
def set_global_handler(eval_mode: str, **eval_params: Any) -> None:
"""Set global eval handlers."""
import llama_index.core
h... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/llms/function_calling.py | llama-index-core/llama_index/core/llms/function_calling.py | import asyncio
from abc import abstractmethod
import functools
import inspect
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Sequence, Type, Union
from llama_index.core.base.llms.types import (
ChatMessage,
ChatResponse,
ChatResponseAsyncGen,
ChatResponseGen,
)
from llama_index.core.llms.... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/llms/callbacks.py | llama-index-core/llama_index/core/llms/callbacks.py | import asyncio
from contextlib import contextmanager
from typing import (
Any,
AsyncGenerator,
Callable,
Generator,
Sequence,
cast,
)
from llama_index.core.base.llms.types import (
ChatMessage,
ChatResponse,
ChatResponseAsyncGen,
ChatResponseGen,
CompletionResponse,
Comp... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/llms/llm.py | llama-index-core/llama_index/core/llms/llm.py | from collections import ChainMap
from typing import (
Any,
Dict,
List,
Generator,
AsyncGenerator,
Optional,
Protocol,
Sequence,
Union,
runtime_checkable,
TYPE_CHECKING,
Type,
)
from typing_extensions import Annotated
from llama_index.core.async_utils import asyncio_run
f... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/llms/structured_llm.py | llama-index-core/llama_index/core/llms/structured_llm.py | from typing import Any, Type, Sequence
from llama_index.core.base.llms.types import ChatMessage, MessageRole
from llama_index.core.llms.llm import LLM
from llama_index.core.base.llms.types import (
ChatMessage,
ChatResponse,
ChatResponseAsyncGen,
ChatResponseGen,
CompletionResponse,
CompletionR... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/llms/mock.py | llama-index-core/llama_index/core/llms/mock.py | from typing import (
Any,
Optional,
Sequence,
List,
Literal,
Generator,
AsyncGenerator,
Callable,
Optional,
Union,
TYPE_CHECKING,
)
from typing_extensions import TypeAlias
from base64 import b64decode
from json import JSONDecodeError
from llama_index.core.base.llms.types impo... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/llms/utils.py | llama-index-core/llama_index/core/llms/utils.py | from typing import TYPE_CHECKING, Optional, Union, Dict
import json
if TYPE_CHECKING:
from langchain.base_language import BaseLanguageModel # pants: no-infer-dep
import os
from llama_index.core.llms.callbacks import CallbackManager
from llama_index.core.llms.llm import LLM
LLMType = Union[str, LLM, "BaseLangua... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/llms/chatml_utils.py | llama-index-core/llama_index/core/llms/chatml_utils.py | from typing import List, Optional, Sequence
from llama_index.core.base.llms.types import ChatMessage, MessageRole
# Create a prompt that matches ChatML instructions
# <|im_start|>system
# You are Dolphin, a helpful AI assistant.<|im_end|>
# <|im_start|>user
# {prompt}<|im_end|>
# <|im_start|>assistant
B_SYS = "<|im... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/llms/loading.py | llama-index-core/llama_index/core/llms/loading.py | from typing import Dict, Type
from llama_index.core.llms.llm import LLM
from llama_index.core.llms.mock import MockLLM
RECOGNIZED_LLMS: Dict[str, Type[LLM]] = {
MockLLM.class_name(): MockLLM,
}
# Conditionals for llama-cloud support
try:
from llama_index.llms.openai import OpenAI # pants: no-infer-dep
... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/llms/__init__.py | llama-index-core/llama_index/core/llms/__init__.py | from llama_index.core.base.llms.types import (
ChatMessage,
ChatResponse,
ChatResponseAsyncGen,
ChatResponseGen,
CompletionResponse,
CompletionResponseAsyncGen,
CompletionResponseGen,
ImageBlock,
LLMMetadata,
MessageRole,
TextBlock,
AudioBlock,
VideoBlock,
Documen... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/llms/custom.py | llama-index-core/llama_index/core/llms/custom.py | from typing import Any, Sequence
from llama_index.core.base.llms.generic_utils import (
completion_response_to_chat_response,
stream_completion_response_to_chat_response,
)
from llama_index.core.base.llms.types import (
ChatMessage,
ChatResponse,
ChatResponseAsyncGen,
ChatResponseGen,
Compl... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/postprocessor/structured_llm_rerank.py | llama-index-core/llama_index/core/postprocessor/structured_llm_rerank.py | """LLM reranker."""
from typing import Callable, List, Optional, Tuple, Union
import logging
from llama_index.core.bridge.pydantic import (
BaseModel,
Field,
PrivateAttr,
SerializeAsAny,
)
from llama_index.core.indices.utils import (
default_format_node_batch_fn,
)
from llama_index.core.llms.llm i... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/postprocessor/llm_rerank.py | llama-index-core/llama_index/core/postprocessor/llm_rerank.py | """LLM reranker."""
from typing import Callable, List, Optional
from llama_index.core.bridge.pydantic import Field, PrivateAttr, SerializeAsAny
from llama_index.core.indices.utils import (
default_format_node_batch_fn,
default_parse_choice_select_answer_fn,
)
from llama_index.core.llms.llm import LLM
from lla... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/postprocessor/node.py | llama-index-core/llama_index/core/postprocessor/node.py | """Node postprocessor."""
import logging
from typing import Dict, List, Optional, cast
from llama_index.core.bridge.pydantic import (
Field,
field_validator,
SerializeAsAny,
ConfigDict,
)
from llama_index.core.llms import LLM
from llama_index.core.postprocessor.types import BaseNodePostprocessor
from ... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/postprocessor/optimizer.py | llama-index-core/llama_index/core/postprocessor/optimizer.py | """Optimization related classes and functions."""
import logging
from typing import Callable, List, Optional
from llama_index.core.base.embeddings.base import BaseEmbedding
from llama_index.core.bridge.pydantic import Field, PrivateAttr
from llama_index.core.indices.query.embedding_utils import get_top_k_embeddings
f... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/postprocessor/node_recency.py | llama-index-core/llama_index/core/postprocessor/node_recency.py | """Node recency post-processor."""
from datetime import datetime
from typing import List, Optional, Set
import numpy as np
# NOTE: currently not being used
# DEFAULT_INFER_RECENCY_TMPL = (
# "A question is provided.\n"
# "The goal is to determine whether the question requires finding the most recent "
# ... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/postprocessor/rankGPT_rerank.py | llama-index-core/llama_index/core/postprocessor/rankGPT_rerank.py | import logging
from typing import Any, Dict, List, Optional, Sequence
from llama_index.core.bridge.pydantic import Field, SerializeAsAny
from llama_index.core.llms import LLM, ChatMessage, ChatResponse
from llama_index.core.postprocessor.types import BaseNodePostprocessor
from llama_index.core.prompts import BasePromp... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/postprocessor/sbert_rerank.py | llama-index-core/llama_index/core/postprocessor/sbert_rerank.py | from typing import Any, List, Optional
from llama_index.core.bridge.pydantic import Field, PrivateAttr
from llama_index.core.callbacks import CBEventType, EventPayload
from llama_index.core.postprocessor.types import BaseNodePostprocessor
from llama_index.core.schema import MetadataMode, NodeWithScore, QueryBundle
fro... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/postprocessor/__init__.py | llama-index-core/llama_index/core/postprocessor/__init__.py | """Node PostProcessor module."""
from llama_index.core.postprocessor.llm_rerank import LLMRerank
from llama_index.core.postprocessor.structured_llm_rerank import (
StructuredLLMRerank,
DocumentWithRelevance,
)
from llama_index.core.postprocessor.metadata_replacement import (
MetadataReplacementPostProcesso... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/postprocessor/types.py | llama-index-core/llama_index/core/postprocessor/types.py | import asyncio
from abc import ABC, abstractmethod
from typing import List, Optional
from llama_index.core.bridge.pydantic import Field, ConfigDict
from llama_index.core.callbacks import CallbackManager
from llama_index.core.instrumentation import DispatcherSpanMixin
from llama_index.core.prompts.mixin import PromptDi... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/postprocessor/pii.py | llama-index-core/llama_index/core/postprocessor/pii.py | """PII postprocessor."""
import json
from copy import deepcopy
from typing import Callable, Dict, List, Optional, Tuple
from llama_index.core.llms.llm import LLM
from llama_index.core.postprocessor.types import BaseNodePostprocessor
from llama_index.core.prompts.base import PromptTemplate
from llama_index.core.schema... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/postprocessor/metadata_replacement.py | llama-index-core/llama_index/core/postprocessor/metadata_replacement.py | from typing import List, Optional
from llama_index.core.bridge.pydantic import Field
from llama_index.core.postprocessor.types import BaseNodePostprocessor
from llama_index.core.schema import MetadataMode, NodeWithScore, QueryBundle
class MetadataReplacementPostProcessor(BaseNodePostprocessor):
target_metadata_k... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/llama_pack/download.py | llama-index-core/llama_index/core/llama_pack/download.py | import json
import os
from typing import Optional, Type
from llama_index.core.download.integration import download_integration
from llama_index.core.download.pack import (
LLAMA_PACKS_CONTENTS_URL,
download_llama_pack_template,
track_download,
)
from llama_index.core.llama_pack.base import BaseLlamaPack
... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/llama_pack/__init__.py | llama-index-core/llama_index/core/llama_pack/__init__.py | """Init file."""
from llama_index.core.llama_pack.base import BaseLlamaPack
from llama_index.core.llama_pack.download import download_llama_pack
__all__ = [
"BaseLlamaPack",
"download_llama_pack",
]
| python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/llama_pack/base.py | llama-index-core/llama_index/core/llama_pack/base.py | """Llama pack class."""
from abc import abstractmethod
from typing import Any, Dict
class BaseLlamaPack:
@abstractmethod
def get_modules(self) -> Dict[str, Any]:
"""Get modules."""
@abstractmethod
def run(self, *args: Any, **kwargs: Any) -> Any:
"""Run."""
| python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/extractors/metadata_extractors.py | llama-index-core/llama_index/core/extractors/metadata_extractors.py | """
Metadata extractors for nodes.
Currently, only `TextNode` is supported.
Supported metadata:
Node-level:
- `SummaryExtractor`: Summary of each node, and pre and post nodes
- `QuestionsAnsweredExtractor`: Questions that the node can answer
- `KeywordsExtractor`: Keywords that uniquely identify the node
D... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/extractors/document_context.py | llama-index-core/llama_index/core/extractors/document_context.py | import asyncio
import logging
import random
from functools import lru_cache
from typing import (
Any,
ClassVar,
Coroutine,
Dict,
List,
Literal,
Optional,
Sequence,
Set,
Union,
cast,
)
from typing_extensions import TypeGuard
from llama_index.core import Settings
from llama_in... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/extractors/interface.py | llama-index-core/llama_index/core/extractors/interface.py | """Node parser interface."""
from abc import abstractmethod
from copy import deepcopy
from typing import Any, Dict, List, Optional, Sequence, cast
from llama_index.core.async_utils import asyncio_run
from llama_index.core.bridge.pydantic import Field
from llama_index.core.schema import (
BaseNode,
MetadataMod... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/extractors/loading.py | llama-index-core/llama_index/core/extractors/loading.py | from llama_index.core.extractors.metadata_extractors import (
BaseExtractor,
KeywordExtractor,
QuestionsAnsweredExtractor,
SummaryExtractor,
TitleExtractor,
)
def load_extractor(
data: dict,
) -> BaseExtractor:
if isinstance(data, BaseExtractor):
return data
extractor_name = d... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/extractors/__init__.py | llama-index-core/llama_index/core/extractors/__init__.py | from llama_index.core.extractors.interface import BaseExtractor
from llama_index.core.extractors.metadata_extractors import (
KeywordExtractor,
PydanticProgramExtractor,
QuestionsAnsweredExtractor,
SummaryExtractor,
TitleExtractor,
)
from llama_index.core.extractors.document_context import DocumentC... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/readers/download.py | llama-index-core/llama_index/core/readers/download.py | """
Download loader from Llama Hub.
NOTE: using `download_loader` is now deprecated.
Please do `pip install llama-index-reader-<reader_name>` instead.
"""
import json
import os
from typing import Optional, Type
from deprecated import deprecated
from llama_index.core.download.integration import download_integration... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/readers/loading.py | llama-index-core/llama_index/core/readers/loading.py | from typing import Any, Dict, Type
from llama_index.core.readers.base import BasePydanticReader
from llama_index.core.readers.string_iterable import StringIterableReader
ALL_READERS: Dict[str, Type[BasePydanticReader]] = {
StringIterableReader.class_name(): StringIterableReader,
}
def load_reader(data: Dict[str... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/readers/__init__.py | llama-index-core/llama_index/core/readers/__init__.py | """
Data Connectors for LlamaIndex.
This module contains the data connectors for LlamaIndex. Each connector inherits
from a `BaseReader` class, connects to a data source, and loads Document objects
from that data source.
You may also choose to construct Document objects manually, for instance
in our `Insert How-To Gu... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/readers/json.py | llama-index-core/llama_index/core/readers/json.py | """JSON Reader."""
import json
import re
import warnings
from typing import Any, Dict, Generator, List, Optional
from llama_index.core.readers.base import BaseReader
from llama_index.core.schema import Document
def _depth_first_yield(
json_data: Any,
levels_back: int,
collapse_length: Optional[int],
... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/readers/string_iterable.py | llama-index-core/llama_index/core/readers/string_iterable.py | """Simple reader that turns an iterable of strings into a list of Documents."""
from typing import List
from llama_index.core.readers.base import BasePydanticReader
from llama_index.core.schema import Document
class StringIterableReader(BasePydanticReader):
"""
String Iterable Reader.
Gets a list of do... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/readers/base.py | llama-index-core/llama_index/core/readers/base.py | """Base reader class."""
import asyncio
from abc import ABC, abstractmethod
from typing import (
TYPE_CHECKING,
Any,
Dict,
Iterable,
List,
)
if TYPE_CHECKING: # pragma: no cover
from llama_index.core.bridge.langchain import Document as LCDocument # type: ignore
from llama_index.core.bridge.p... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/readers/file/__init__.py | llama-index-core/llama_index/core/readers/file/__init__.py | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false | |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/readers/file/base.py | llama-index-core/llama_index/core/readers/file/base.py | """Simple reader that reads files of different formats from a directory."""
from __future__ import annotations
import asyncio
import logging
import mimetypes
import multiprocessing
import os
import warnings
from abc import ABC, abstractmethod
from datetime import datetime, timezone
from functools import partial
from ... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/prompts/prompts.py | llama-index-core/llama_index/core/prompts/prompts.py | """Subclasses from base prompt."""
from llama_index.core.prompts.base import PromptTemplate
# deprecated, kept for backward compatibility
"""Summary prompt.
PromptTemplate to summarize the provided `context_str`.
Required template variables: `context_str`
"""
SummaryPrompt = PromptTemplate
"""Tree Insert prompt.
... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/prompts/prompt_utils.py | llama-index-core/llama_index/core/prompts/prompt_utils.py | from typing import List
from llama_index.core.prompts.base import BasePromptTemplate
def get_empty_prompt_txt(prompt: BasePromptTemplate) -> str:
"""
Get empty prompt text.
Substitute empty strings in parts of the prompt that have
not yet been filled out. Skip variables that have already
been pa... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/prompts/rich.py | llama-index-core/llama_index/core/prompts/rich.py | from banks import Prompt
from banks.types import ContentBlockType as BanksContentBlockType
from copy import deepcopy
from typing import Any, Callable, Dict, List, Optional, Sequence
from llama_index.core.bridge.pydantic import Field
from llama_index.core.base.llms.base import BaseLLM
from llama_index.core.base.llms.ge... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/prompts/default_prompt_selectors.py | llama-index-core/llama_index/core/prompts/default_prompt_selectors.py | """Default prompt selectors."""
from llama_index.core.prompts import SelectorPromptTemplate
from llama_index.core.prompts.chat_prompts import (
CHAT_REFINE_PROMPT,
CHAT_REFINE_TABLE_CONTEXT_PROMPT,
CHAT_TEXT_QA_PROMPT,
CHAT_TREE_SUMMARIZE_PROMPT,
)
from llama_index.core.prompts.default_prompts import (... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/prompts/prompt_type.py | llama-index-core/llama_index/core/prompts/prompt_type.py | """Prompt types enum."""
from enum import Enum
class PromptType(str, Enum):
"""Prompt type."""
# summarization
SUMMARY = "summary"
# tree insert node
TREE_INSERT = "insert"
# tree select query prompt
TREE_SELECT = "tree_select"
# tree select query prompt (multiple)
TREE_SELECT_MU... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/prompts/system.py | llama-index-core/llama_index/core/prompts/system.py | # List of system prompts from Azure AI Studio
SHAKESPEARE_WRITING_ASSISTANT = """\
You are a Shakespearean writing assistant who speaks in a Shakespearean style. \
You help people come up with creative ideas and content like stories, poems, \
and songs that use Shakespearean style of writing style, including words lik... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/prompts/default_prompts.py | llama-index-core/llama_index/core/prompts/default_prompts.py | """Set of default prompts."""
from llama_index.core.prompts.base import PromptTemplate
from llama_index.core.prompts.prompt_type import PromptType
############################################
# Tree
############################################
DEFAULT_SUMMARY_PROMPT_TMPL = (
"Write a summary of the following. Tr... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/prompts/guidance_utils.py | llama-index-core/llama_index/core/prompts/guidance_utils.py | from typing import Optional, Type, TypeVar
from llama_index.core.bridge.pydantic import BaseModel
from llama_index.core.output_parsers.base import OutputParserException
from llama_index.core.output_parsers.utils import parse_json_markdown
def convert_to_handlebars(text: str) -> str:
"""
Convert a python form... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/prompts/utils.py | llama-index-core/llama_index/core/prompts/utils.py | from typing import Dict, List, Optional
import re
from llama_index.core.base.llms.base import BaseLLM
from llama_index.core.base.llms.types import ContentBlock, TextBlock
class SafeFormatter:
"""Safe string formatter that does not raise KeyError if key is missing."""
def __init__(self, format_dict: Optional... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/prompts/chat_prompts.py | llama-index-core/llama_index/core/prompts/chat_prompts.py | """Prompts for ChatGPT."""
from llama_index.core.base.llms.types import ChatMessage, MessageRole
from llama_index.core.prompts.base import ChatPromptTemplate
# text qa prompt
TEXT_QA_SYSTEM_PROMPT = ChatMessage(
content=(
"You are an expert Q&A system that is trusted around the world.\n"
"Always a... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/prompts/__init__.py | llama-index-core/llama_index/core/prompts/__init__.py | """Prompt class."""
from llama_index.core.base.llms.types import ChatMessage, MessageRole
from llama_index.core.prompts.base import (
BasePromptTemplate,
ChatPromptTemplate,
LangchainPromptTemplate,
Prompt,
PromptTemplate,
PromptType,
SelectorPromptTemplate,
)
from llama_index.core.prompts.... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/prompts/mixin.py | llama-index-core/llama_index/core/prompts/mixin.py | """Prompt Mixin."""
from abc import ABC, abstractmethod
from collections import defaultdict
from copy import deepcopy
from typing import Dict, Union
from llama_index.core.prompts.base import BasePromptTemplate
HasPromptType = Union["PromptMixin", BasePromptTemplate]
PromptDictType = Dict[str, BasePromptTemplate]
Pro... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/llama_index/core/prompts/base.py | llama-index-core/llama_index/core/prompts/base.py | """Prompts."""
from abc import ABC, abstractmethod
from copy import deepcopy
from typing import (
TYPE_CHECKING,
Any,
Callable,
Dict,
List,
Optional,
Sequence,
Tuple,
Union,
)
from typing_extensions import Annotated
from llama_index.core.bridge.pydantic import (
Field,
With... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.