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/tests/chat_engine/test_condense_plus_context.py | llama-index-core/tests/chat_engine/test_condense_plus_context.py | import pytest
from llama_index.core import MockEmbedding
from llama_index.core.chat_engine.condense_plus_context import (
CondensePlusContextChatEngine,
)
from llama_index.core.indices import VectorStoreIndex
from llama_index.core.llms.mock import MockLLM
from llama_index.core.schema import Document
SYSTEM_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/tests/chat_engine/test_simple.py | llama-index-core/tests/chat_engine/test_simple.py | import gc
import asyncio
from llama_index.core.memory import ChatMemoryBuffer
from llama_index.core.base.llms.types import (
ChatMessage,
CompletionResponse,
CompletionResponseGen,
)
from typing import Any
from llama_index.core.llms.callbacks import llm_completion_callback
from llama_index.core.llms.mock 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/tests/chat_engine/test_condense_question.py | llama-index-core/tests/chat_engine/test_condense_question.py | from unittest.mock import Mock
from llama_index.core.base.base_query_engine import BaseQueryEngine
from llama_index.core.base.llms.types import ChatMessage, MessageRole
from llama_index.core.base.response.schema import Response
from llama_index.core.chat_engine.condense_question import (
CondenseQuestionChatEngine... | 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/tests/voice_agents/test_event_serialization.py | llama-index-core/tests/voice_agents/test_event_serialization.py | import pytest
from typing import Dict
from llama_index.core.voice_agents.events import BaseVoiceAgentEvent
@pytest.fixture()
def json_event() -> Dict[str, str]:
return {"type": "text"}
def test_event_serialization(json_event: Dict[str, str]) -> None:
assert BaseVoiceAgentEvent(type_t="text").model_dump(by_... | 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/tests/voice_agents/test_subclasses.py | llama-index-core/tests/voice_agents/test_subclasses.py | import pytest
from typing import List, Any, Union, Optional, Iterable, AsyncIterable
from llama_index.core.voice_agents import (
BaseVoiceAgent,
BaseVoiceAgentInterface,
BaseVoiceAgentWebsocket,
BaseVoiceAgentEvent,
)
from llama_index.core.llms import ChatMessage
# Try to import websockets dependency
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/tests/voice_agents/__init__.py | llama-index-core/tests/voice_agents/__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/tests/multi_modal_llms/test_base_multi_modal_llm_metadata.py | llama-index-core/tests/multi_modal_llms/test_base_multi_modal_llm_metadata.py | """Unit tests for `llama_index.core.multi_modal_llms.MultiModalLLMMetadata`."""
from llama_index.core.multi_modal_llms import MultiModalLLMMetadata
class TestMultiModalLLMMetadata:
def test_default_values(self):
metadata = MultiModalLLMMetadata()
assert metadata.model_name == "unknown"
as... | 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/tests/multi_modal_llms/test_generic_utils.py | llama-index-core/tests/multi_modal_llms/test_generic_utils.py | """Unit tests for `llama_index.core.multi_modal_llms.generic_utils`."""
import pytest
import base64
import httpx
from pathlib import Path
from unittest.mock import mock_open, patch, MagicMock
from llama_index.core.schema import ImageDocument
from llama_index.core.multi_modal_llms.generic_utils import (
load_imag... | 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/tests/program/test_streaming_utils.py | llama-index-core/tests/program/test_streaming_utils.py | """Test streaming utilities."""
from typing import List, Optional
from llama_index.core.bridge.pydantic import BaseModel, Field
from llama_index.core.base.llms.types import ChatMessage, ChatResponse, MessageRole
from llama_index.core.program.streaming_utils import (
process_streaming_content_incremental,
_extr... | 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/tests/program/test_multi_modal_llm_program.py | llama-index-core/tests/program/test_multi_modal_llm_program.py | """Test LLM program."""
import json
import pytest
from typing import Sequence
from unittest.mock import MagicMock
from llama_index.core.bridge.pydantic import BaseModel
from llama_index.core.llms import LLMMetadata
from llama_index.core.output_parsers.pydantic import PydanticOutputParser
from llama_index.core.program... | 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/tests/program/test_llm_program.py | llama-index-core/tests/program/test_llm_program.py | """Test LLM program."""
import json
from unittest.mock import MagicMock
from llama_index.core.base.llms.types import (
ChatMessage,
ChatResponse,
CompletionResponse,
LLMMetadata,
MessageRole,
)
from llama_index.core.bridge.pydantic import BaseModel
from llama_index.core.output_parsers.pydantic imp... | 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/tests/program/test_utils.py | llama-index-core/tests/program/test_utils.py | """Test program utils."""
import pytest
from typing import List, Optional
from llama_index.core.bridge.pydantic import BaseModel, Field
from llama_index.core.base.llms.types import ChatMessage, ChatResponse, MessageRole
from llama_index.core.program.utils import (
_repair_incomplete_json,
process_streaming_obj... | 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/tests/program/test_function_program.py | llama-index-core/tests/program/test_function_program.py | """Test LLM program."""
from unittest.mock import MagicMock
import pytest
from llama_index.core.base.llms.types import (
ChatMessage,
LLMMetadata,
)
from llama_index.core.bridge.pydantic import BaseModel
from llama_index.core.bridge.pydantic import BaseModel
from typing import List, Optional, Union, Any
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/tests/program/__init__.py | llama-index-core/tests/program/__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/tests/indices/test_utils.py | llama-index-core/tests/indices/test_utils.py | """Test indices/utils.py."""
import pytest
from llama_index.core.indices.utils import expand_tokens_with_subtokens
def test_expand_tokens_with_subtokens() -> None:
"""Test expand tokens."""
tokens = {"foo bar", "baz", "hello hello world bye"}
keywords = expand_tokens_with_subtokens(tokens)
assert 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/tests/indices/test_loading.py | llama-index-core/tests/indices/test_loading.py | from pathlib import Path
from typing import List
import pytest
from llama_index.core.indices.list.base import SummaryIndex
from llama_index.core.indices.loading import (
load_index_from_storage,
load_indices_from_storage,
)
from llama_index.core.indices.vector_store.base import VectorStoreIndex
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/tests/indices/test_loading_graph.py | llama-index-core/tests/indices/test_loading_graph.py | from pathlib import Path
from typing import List
from llama_index.core.indices.composability.graph import ComposableGraph
from llama_index.core.indices.list.base import SummaryIndex
from llama_index.core.indices.loading import load_graph_from_storage
from llama_index.core.indices.vector_store.base import VectorStoreIn... | 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/tests/indices/conftest.py | llama-index-core/tests/indices/conftest.py | from typing import List
import pytest
from llama_index.core.schema import (
Document,
NodeRelationship,
RelatedNodeInfo,
TextNode,
)
@pytest.fixture()
def documents() -> List[Document]:
"""Get documents."""
# NOTE: one document for now
doc_text = (
"Hello world.\nThis is a test.\n... | 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/tests/indices/__init__.py | llama-index-core/tests/indices/__init__.py | """Init file."""
| 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/tests/indices/test_prompt_helper.py | llama-index-core/tests/indices/test_prompt_helper.py | """Test PromptHelper."""
from typing import Optional, Type, Union
import pytest
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.llms import ChatMessage
from llama_index.core.node_parser.text.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/tests/indices/empty/test_base.py | llama-index-core/tests/indices/empty/test_base.py | """Test empty index."""
from llama_index.core.data_structs.data_structs import EmptyIndexStruct
from llama_index.core.indices.empty.base import EmptyIndex
def test_empty() -> None:
"""Test build list."""
empty_index = EmptyIndex()
assert isinstance(empty_index.index_struct, EmptyIndexStruct)
retriev... | 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/tests/indices/empty/__init__.py | llama-index-core/tests/indices/empty/__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/tests/indices/struct_store/test_sql_query.py | llama-index-core/tests/indices/struct_store/test_sql_query.py | from typing import Any, Dict, Tuple
import pytest
from llama_index.core.async_utils import asyncio_run
from llama_index.core.indices.vector_store import VectorStoreIndex
from llama_index.core.indices.struct_store.base import default_output_parser
from llama_index.core.indices.struct_store.sql import SQLStructStoreInde... | 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/tests/indices/struct_store/test_base.py | llama-index-core/tests/indices/struct_store/test_base.py | """Test struct store indices."""
from typing import Any, Dict, List, Tuple
from llama_index.core.indices.list.base import SummaryIndex
from llama_index.core.indices.struct_store.sql import (
SQLContextContainerBuilder,
SQLStructStoreIndex,
)
from llama_index.core.indices.struct_store.sql_query import (
NL... | 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/tests/indices/struct_store/conftest.py | llama-index-core/tests/indices/struct_store/conftest.py | import re
from typing import Any, Dict, Optional, Tuple
import pytest
from tests.mock_utils.mock_prompts import (
MOCK_REFINE_PROMPT,
MOCK_SCHEMA_EXTRACT_PROMPT,
MOCK_TEXT_QA_PROMPT,
)
def _mock_output_parser(output: str) -> Optional[Dict[str, Any]]:
"""
Mock output parser.
Split via commas ... | 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/tests/indices/struct_store/__init__.py | llama-index-core/tests/indices/struct_store/__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/tests/indices/struct_store/test_json_query.py | llama-index-core/tests/indices/struct_store/test_json_query.py | """Test json index."""
import json
from typing import Any, Dict, cast
from unittest.mock import patch
import pytest
from llama_index.core.async_utils import asyncio_run
from llama_index.core.base.response.schema import Response
from llama_index.core.indices.struct_store.json_query import (
JSONQueryEngine,
JS... | 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/tests/indices/query/test_compose.py | llama-index-core/tests/indices/query/test_compose.py | """Test composing indices."""
from typing import Dict, List
from llama_index.core.indices.composability.graph import ComposableGraph
from llama_index.core.indices.keyword_table.simple_base import (
SimpleKeywordTableIndex,
)
from llama_index.core.indices.list.base import SummaryIndex
from llama_index.core.indices... | 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/tests/indices/query/test_embedding_utils.py | llama-index-core/tests/indices/query/test_embedding_utils.py | """Test embedding utility functions."""
import numpy as np
from llama_index.core.indices.query.embedding_utils import (
get_top_k_embeddings,
get_top_k_mmr_embeddings,
)
def test_get_top_k_mmr_embeddings() -> None:
"""Test Maximum Marginal Relevance."""
# Results score should follow from the mmr algo... | 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/tests/indices/query/conftest.py | llama-index-core/tests/indices/query/conftest.py | from typing import Dict, List
import pytest
from llama_index.core.data_structs.struct_type import IndexStructType
from llama_index.core.schema import Document
from tests.mock_utils.mock_prompts import (
MOCK_INSERT_PROMPT,
MOCK_KEYWORD_EXTRACT_PROMPT,
MOCK_QUERY_KEYWORD_EXTRACT_PROMPT,
MOCK_QUERY_PROMP... | 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/tests/indices/query/__init__.py | llama-index-core/tests/indices/query/__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/tests/indices/query/test_compose_vector.py | llama-index-core/tests/indices/query/test_compose_vector.py | """Test recursive queries."""
from typing import Any, Dict, List
from llama_index.core.async_utils import asyncio_run
from llama_index.core.base.embeddings.base import BaseEmbedding
from llama_index.core.data_structs.data_structs import IndexStruct
from llama_index.core.indices.composability.graph import ComposableGr... | 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/tests/indices/query/test_query_bundle.py | llama-index-core/tests/indices/query/test_query_bundle.py | """Test query bundle."""
from typing import Dict, List
import pytest
from llama_index.core.base.embeddings.base import BaseEmbedding
from llama_index.core.indices.list.base import SummaryIndex
from llama_index.core.schema import Document, QueryBundle
@pytest.fixture()
def documents() -> List[Document]:
"""Get 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/tests/indices/query/query_transform/test_base.py | llama-index-core/tests/indices/query/query_transform/test_base.py | """Test query transform."""
from llama_index.core.indices.query.query_transform.base import (
DecomposeQueryTransform,
)
from tests.indices.query.query_transform.mock_utils import MOCK_DECOMPOSE_PROMPT
def test_decompose_query_transform(patch_llm_predictor) -> None:
"""Test decompose query transform."""
... | 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/tests/indices/query/query_transform/mock_utils.py | llama-index-core/tests/indices/query/query_transform/mock_utils.py | """Mock utils for query transform."""
from llama_index.core.indices.query.query_transform.prompts import (
DecomposeQueryTransformPrompt,
)
from llama_index.core.prompts.prompt_type import PromptType
MOCK_DECOMPOSE_TMPL = "{context_str}\n{query_str}"
MOCK_DECOMPOSE_PROMPT = DecomposeQueryTransformPrompt(
MOCK... | 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/tests/indices/query/query_transform/__init__.py | llama-index-core/tests/indices/query/query_transform/__init__.py | """Init file."""
from tests.indices.query.query_transform.mock_utils import MOCK_DECOMPOSE_PROMPT
__all__ = ["MOCK_DECOMPOSE_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/tests/indices/document_summary/test_index.py | llama-index-core/tests/indices/document_summary/test_index.py | """Test document summary index."""
from typing import List
import pytest
from llama_index.core.indices.document_summary.base import DocumentSummaryIndex
from llama_index.core.schema import Document
def test_build_index(
docs: List[Document],
index: DocumentSummaryIndex,
) -> None:
"""Test build tree."""... | 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/tests/indices/document_summary/conftest.py | llama-index-core/tests/indices/document_summary/conftest.py | from typing import List
import pytest
from llama_index.core.indices.document_summary.base import DocumentSummaryIndex
from llama_index.core.response_synthesizers import get_response_synthesizer
from llama_index.core.schema import Document
from tests.mock_utils.mock_prompts import MOCK_REFINE_PROMPT, MOCK_TEXT_QA_PROMP... | 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/tests/indices/document_summary/__init__.py | llama-index-core/tests/indices/document_summary/__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/tests/indices/document_summary/test_retrievers.py | llama-index-core/tests/indices/document_summary/test_retrievers.py | """Test document summary retrievers."""
from llama_index.core.indices.document_summary.base import (
DocumentSummaryIndex,
DocumentSummaryRetrieverMode,
)
from llama_index.core.indices.document_summary.retrievers import (
DocumentSummaryIndexEmbeddingRetriever,
DocumentSummaryIndexLLMRetriever,
)
def... | 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/tests/indices/list/test_index.py | llama-index-core/tests/indices/list/test_index.py | """Test summary index."""
from typing import List
from llama_index.core.base.base_retriever import BaseRetriever
from llama_index.core.indices.list.base import ListRetrieverMode, SummaryIndex
from llama_index.core.schema import Document
def test_build_list(documents: List[Document], patch_token_text_splitter) -> No... | 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/tests/indices/list/__init__.py | llama-index-core/tests/indices/list/__init__.py | """List-based data structures."""
| 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/tests/indices/list/test_retrievers.py | llama-index-core/tests/indices/list/test_retrievers.py | from typing import Any, Dict, List, Tuple
from unittest.mock import patch
from llama_index.core.indices.list.base import SummaryIndex
from llama_index.core.indices.list.retrievers import SummaryIndexEmbeddingRetriever
from llama_index.core.llms.mock import MockLLM
from llama_index.core.prompts import BasePromptTemplat... | 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/tests/indices/property_graph/__init__.py | llama-index-core/tests/indices/property_graph/__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/tests/indices/property_graph/test_property_graph.py | llama-index-core/tests/indices/property_graph/test_property_graph.py | from unittest.mock import MagicMock
from typing import Any, List
from llama_index.core import PropertyGraphIndex, Document, MockEmbedding
from llama_index.core.graph_stores.simple_labelled import SimplePropertyGraphStore
from llama_index.core.graph_stores.types import (
EntityNode,
Relation,
KG_NODES_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/tests/indices/vector_store/mock_services.py | llama-index-core/tests/indices/vector_store/mock_services.py | from typing import List
from llama_index.core.base.embeddings.base import BaseEmbedding
class MockEmbedding(BaseEmbedding):
@classmethod
def class_name(cls) -> str:
return "MockEmbedding"
async def _aget_query_embedding(self, query: str) -> List[float]:
del query
return [0, 0, 1,... | 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/tests/indices/vector_store/test_simple_async.py | llama-index-core/tests/indices/vector_store/test_simple_async.py | import pytest
from typing import List
from llama_index.core.indices.vector_store.base import VectorStoreIndex
from llama_index.core.schema import Document
from llama_index.core.vector_stores.simple import SimpleVectorStore
@pytest.mark.asyncio
async def test_simple_insertion(
documents: List[Document],
patch_... | 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/tests/indices/vector_store/__init__.py | llama-index-core/tests/indices/vector_store/__init__.py | """Init file."""
| 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/tests/indices/vector_store/test_simple.py | llama-index-core/tests/indices/vector_store/test_simple.py | """Test vector store indexes."""
import pickle
from typing import Any, List, cast
from llama_index.core.indices.loading import load_index_from_storage
from llama_index.core.indices.vector_store.base import VectorStoreIndex
from llama_index.core.schema import Document
from llama_index.core.storage.storage_context 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/tests/indices/vector_store/test_retrievers.py | llama-index-core/tests/indices/vector_store/test_retrievers.py | from typing import List, cast
import pytest
from llama_index.core.indices.vector_store.retrievers.retriever import (
VectorIndexRetriever,
)
from llama_index.core.vector_stores.types import VectorStoreQueryResult
from llama_index.core.indices.vector_store.base import VectorStoreIndex
from llama_index.core.vector_st... | 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/tests/indices/vector_store/auto_retriever/test_output_parser.py | llama-index-core/tests/indices/vector_store/auto_retriever/test_output_parser.py | from typing import cast
from llama_index.core.indices.vector_store.retrievers.auto_retriever.output_parser import (
VectorStoreQueryOutputParser,
)
from llama_index.core.output_parsers.base import StructuredOutput
from llama_index.core.vector_stores.types import (
ExactMatchFilter,
VectorStoreQuerySpec,
)
... | 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/tests/indices/vector_store/auto_retriever/__init__.py | llama-index-core/tests/indices/vector_store/auto_retriever/__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/tests/indices/knowledge_graph/test_base.py | llama-index-core/tests/indices/knowledge_graph/test_base.py | """Test knowledge graph index."""
from typing import Any, Dict, List, Tuple
from unittest.mock import patch
import pytest
from llama_index.core.base.embeddings.base import BaseEmbedding
from llama_index.core.indices.knowledge_graph.base import KnowledgeGraphIndex
from llama_index.core.schema import Document, TextNode... | 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/tests/indices/knowledge_graph/conftest.py | llama-index-core/tests/indices/knowledge_graph/conftest.py | from typing import List
import pytest
from llama_index.core.schema import Document
@pytest.fixture()
def documents() -> List[Document]:
"""Get documents."""
# NOTE: one document for now
# NOTE: in this unit test, document text == triplets
doc_text = "(foo, is, bar)\n(hello, is not, world)\n(Jane, is ... | 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/tests/indices/knowledge_graph/__init__.py | llama-index-core/tests/indices/knowledge_graph/__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/tests/indices/knowledge_graph/test_retrievers.py | llama-index-core/tests/indices/knowledge_graph/test_retrievers.py | from typing import Any, List, Tuple
from unittest.mock import patch
from llama_index.core.graph_stores import SimpleGraphStore
from llama_index.core.embeddings import BaseEmbedding
from llama_index.core.indices.knowledge_graph.base import KnowledgeGraphIndex
from llama_index.core.indices.knowledge_graph.retrievers imp... | 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/tests/indices/keyword_table/test_utils.py | llama-index-core/tests/indices/keyword_table/test_utils.py | """Test utils."""
from llama_index.core.indices.keyword_table.utils import (
extract_keywords_given_response,
)
def test_expand_tokens_with_subtokens() -> None:
"""Test extract keywords given response."""
response = "foo bar, baz, Hello hello wOrld bye"
keywords = extract_keywords_given_response(resp... | 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/tests/indices/keyword_table/test_base.py | llama-index-core/tests/indices/keyword_table/test_base.py | """Test keyword table index."""
from typing import Any, List
from unittest.mock import patch
import pytest
from llama_index.core.indices.keyword_table.simple_base import (
SimpleKeywordTableIndex,
)
from llama_index.core.schema import Document
from tests.mock_utils.mock_utils import mock_extract_keywords
@pytes... | 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/tests/indices/keyword_table/__init__.py | llama-index-core/tests/indices/keyword_table/__init__.py | """Init file."""
| 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/tests/indices/keyword_table/test_retrievers.py | llama-index-core/tests/indices/keyword_table/test_retrievers.py | from typing import List
from unittest.mock import patch
from llama_index.core.indices.keyword_table.simple_base import (
SimpleKeywordTableIndex,
)
from llama_index.core.schema import Document, QueryBundle
from tests.mock_utils.mock_utils import mock_extract_keywords
@patch(
"llama_index.core.indices.keyword... | 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/tests/indices/response/test_response_builder.py | llama-index-core/tests/indices/response/test_response_builder.py | """Test response utils."""
from typing import List
from llama_index.core.async_utils import asyncio_run
from llama_index.core.constants import DEFAULT_CONTEXT_WINDOW, DEFAULT_NUM_OUTPUTS
from llama_index.core.indices.prompt_helper import PromptHelper
from llama_index.core.prompts.base import PromptTemplate
from llama... | 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/tests/indices/response/test_tree_summarize.py | llama-index-core/tests/indices/response/test_tree_summarize.py | """Test tree summarize."""
from typing import Any, List, Sequence, Optional
from unittest.mock import Mock, patch
import pytest
from llama_index.core.bridge.pydantic import BaseModel
from llama_index.core.indices.prompt_helper import PromptHelper
from llama_index.core.llms.mock import MockLLM
from llama_index.core.pr... | 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/tests/indices/tree/test_index.py | llama-index-core/tests/indices/tree/test_index.py | """Test tree index."""
from typing import Any, Dict, List, Optional
from unittest.mock import patch
from llama_index.core.data_structs.data_structs import IndexGraph
from llama_index.core.indices.tree.base import TreeIndex
from llama_index.core.schema import BaseNode, Document
from llama_index.core.storage.docstore 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/tests/indices/tree/test_embedding_retriever.py | llama-index-core/tests/indices/tree/test_embedding_retriever.py | """Test embedding functionalities."""
from collections import defaultdict
from typing import Any, Dict, List
from unittest.mock import patch
import pytest
from llama_index.core.indices.tree.base import TreeIndex
from llama_index.core.indices.tree.select_leaf_embedding_retriever import (
TreeSelectLeafEmbeddingRet... | 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/tests/indices/tree/conftest.py | llama-index-core/tests/indices/tree/conftest.py | from typing import Dict, List, Tuple
import pytest
from llama_index.core.schema import Document
from tests.mock_utils.mock_prompts import (
MOCK_INSERT_PROMPT,
MOCK_QUERY_PROMPT,
MOCK_REFINE_PROMPT,
MOCK_SUMMARY_PROMPT,
MOCK_TEXT_QA_PROMPT,
)
@pytest.fixture()
def documents() -> List[Document]:
... | 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/tests/indices/tree/__init__.py | llama-index-core/tests/indices/tree/__init__.py | """Init file."""
| 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/tests/indices/tree/test_retrievers.py | llama-index-core/tests/indices/tree/test_retrievers.py | from typing import Dict, List
from llama_index.core.indices.tree.base import TreeIndex
from llama_index.core.schema import Document
def test_query(
documents: List[Document],
patch_llm_predictor,
patch_token_text_splitter,
struct_kwargs: Dict,
) -> None:
"""Test query."""
index_kwargs, query_... | 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/tests/memory/test_memory_base.py | llama-index-core/tests/memory/test_memory_base.py | import pytest
from llama_index.core.base.llms.types import (
ChatMessage,
ImageBlock,
AudioBlock,
VideoBlock,
)
from llama_index.core.memory.memory import Memory
from llama_index.core.storage.chat_store.sql import MessageStatus
@pytest.fixture()
def memory():
"""Create a basic memory instance for... | 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/tests/memory/test_chat_memory_buffer.py | llama-index-core/tests/memory/test_chat_memory_buffer.py | import pickle
import pytest
from llama_index.core.llms import ChatMessage, MessageRole
from llama_index.core.memory.chat_memory_buffer import ChatMemoryBuffer
from llama_index.core.utils import get_tokenizer
tokenizer = get_tokenizer()
USER_CHAT_MESSAGE = ChatMessage(role=MessageRole.USER, content="first message")
U... | 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/tests/memory/test_chat_summary_memory_buffer.py | llama-index-core/tests/memory/test_chat_summary_memory_buffer.py | from typing import List, Sequence, Any
import pickle
import pytest
from llama_index.core.bridge.pydantic import PrivateAttr
from llama_index.core.base.llms.types import ChatResponse
from llama_index.core.llms import ChatMessage, MessageRole, MockLLM
from llama_index.core.memory.chat_summary_memory_buffer 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/tests/memory/test_memory_blocks_base.py | llama-index-core/tests/memory/test_memory_blocks_base.py | import pytest
from typing import List, Any, Optional, Union
from llama_index.core.base.llms.types import ChatMessage, TextBlock, ContentBlock
from llama_index.core.memory.memory import Memory, BaseMemoryBlock, InsertMethod
class TextMemoryBlock(BaseMemoryBlock[str]):
"""Memory block that returns text content."""... | 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/tests/memory/test_memory_schema.py | llama-index-core/tests/memory/test_memory_schema.py | """Tests for Memory class schema functionality."""
import pytest
from llama_index.core.base.llms.types import ChatMessage
from llama_index.core.memory.memory import Memory
from llama_index.core.storage.chat_store.sql import SQLAlchemyChatStore
class TestMemorySchema:
"""Test schema functionality in Memory class... | 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/tests/memory/blocks/test_vector.py | llama-index-core/tests/memory/blocks/test_vector.py | import pytest
from typing import Any, Dict, List, Sequence
from llama_index.core.base.llms.types import ChatMessage
from llama_index.core.embeddings import MockEmbedding
from llama_index.core.memory.memory_blocks.vector import VectorMemoryBlock
from llama_index.core.postprocessor.types import BaseNodePostprocessor
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/tests/memory/blocks/test_static.py | llama-index-core/tests/memory/blocks/test_static.py | import pytest
from llama_index.core.base.llms.types import (
ChatMessage,
MessageRole,
TextBlock,
)
from llama_index.core.memory.memory_blocks.static import StaticMemoryBlock
@pytest.fixture
def sample_messages():
"""Create sample chat messages."""
return [
ChatMessage(role=MessageRole.US... | 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/tests/memory/blocks/test_fact.py | llama-index-core/tests/memory/blocks/test_fact.py | import pytest
from typing import List
from llama_index.core.memory.memory_blocks.fact import (
FactExtractionMemoryBlock,
DEFAULT_FACT_EXTRACT_PROMPT,
DEFAULT_FACT_CONDENSE_PROMPT,
)
from llama_index.core.base.llms.types import ChatMessage, MessageRole
from llama_index.core.base.llms.types import ChatRespo... | 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/tests/selectors/test_llm_selectors.py | llama-index-core/tests/selectors/test_llm_selectors.py | from unittest.mock import patch
from llama_index.core.llms import CompletionResponse
from llama_index.core.selectors.llm_selectors import LLMMultiSelector, LLMSingleSelector
from llama_index.core import Settings
from tests.mock_utils.mock_predict import _mock_single_select
def test_llm_single_selector(mock_llm, mon... | 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/tests/callbacks/test_token_counter.py | llama-index-core/tests/callbacks/test_token_counter.py | """Embeddings."""
from llama_index.core.callbacks.schema import CBEventType
from llama_index.core.callbacks.token_counting import TokenCountingHandler
TEST_PAYLOAD = {"chunks": ["one"], "formatted_prompt": "two", "response": "three"}
TEST_ID = "my id"
def test_on_event_start() -> None:
"""Test event start."""
... | 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/tests/callbacks/__init__.py | llama-index-core/tests/callbacks/__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/tests/callbacks/test_llama_debug.py | llama-index-core/tests/callbacks/test_llama_debug.py | """Embeddings."""
from llama_index.core.callbacks.base import CallbackManager
from llama_index.core.callbacks.llama_debug import LlamaDebugHandler
from llama_index.core.callbacks.schema import CBEventType
TEST_PAYLOAD = {"one": 1, "two": 2}
TEST_ID = "my id"
def test_on_event_start() -> None:
"""Test event star... | 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/tests/llms/test_function_calling.py | llama-index-core/tests/llms/test_function_calling.py | from typing import Any, AsyncGenerator, Coroutine, Dict, List, Optional, Sequence, Union
from unittest.mock import patch
import pytest
from llama_index.core.base.llms.types import (
ChatMessage,
ChatResponse,
ChatResponseGen,
CompletionResponse,
LLMMetadata,
)
from llama_index.core.llms.function_ca... | 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/tests/llms/test_custom.py | llama-index-core/tests/llms/test_custom.py | from typing import Any
from llama_index.core.base.llms.types import (
ChatMessage,
CompletionResponse,
CompletionResponseGen,
LLMMetadata,
)
from llama_index.core.llms.custom import CustomLLM
class TestLLM(CustomLLM):
__test__ = False
def __init__(self) -> None:
super().__init__(call... | 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/tests/llms/test_predict_and_call.py | llama-index-core/tests/llms/test_predict_and_call.py | from llama_index.core.llms.mock import MockLLM
from llama_index.core.base.llms.types import ChatMessage, MessageRole, ChatResponse
from llama_index.core.program.function_program import FunctionTool
from llama_index.core.agent.react.formatter import ReActChatFormatter
from llama_index.core.agent.react.output_parser 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/tests/llms/test_mock.py | llama-index-core/tests/llms/test_mock.py | import pytest
import json
from typing import Optional
from llama_index.core.llms import MockLLM
from llama_index.core.llms.mock import MockFunctionCallingLLM, BlockToContentCallback
from llama_index.core.llms.llm import ToolSelection
from llama_index.core.base.llms.types import (
ChatMessage,
TextBlock,
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/tests/llms/test_callbacks.py | llama-index-core/tests/llms/test_callbacks.py | import pytest
from llama_index.core.base.llms.types import ChatMessage
from llama_index.core.llms.llm import LLM
from llama_index.core.llms.mock import MockLLM
from llama_index.core.llms.mock import MockLLMWithNonyieldingChatStream
@pytest.fixture()
def nonyielding_llm() -> LLM:
return MockLLMWithNonyieldingChatS... | 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/tests/llms/__init__.py | llama-index-core/tests/llms/__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/tests/postprocessor/test_rankgpt_rerank.py | llama-index-core/tests/postprocessor/test_rankgpt_rerank.py | from typing import Any
from unittest.mock import patch
import asyncio
import pytest
from llama_index.core.base.llms.types import ChatResponse, ChatMessage, MessageRole
from llama_index.core.llms.mock import MockLLM
from llama_index.core.postprocessor.rankGPT_rerank import RankGPTRerank
from llama_index.core.schema imp... | 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/tests/postprocessor/test_optimizer.py | llama-index-core/tests/postprocessor/test_optimizer.py | """Test optimization."""
from typing import Any, List
from unittest.mock import patch
from llama_index.core.embeddings.mock_embed_model import MockEmbedding
from llama_index.core.postprocessor.optimizer import SentenceEmbeddingOptimizer
from llama_index.core.schema import NodeWithScore, QueryBundle, TextNode
def mo... | 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/tests/postprocessor/test_base.py | llama-index-core/tests/postprocessor/test_base.py | """Node postprocessor tests."""
from importlib.util import find_spec
from pathlib import Path
from typing import Dict, cast
import pytest
from llama_index.core.postprocessor.node import (
KeywordNodePostprocessor,
PrevNextNodePostprocessor,
)
from llama_index.core.postprocessor.node_recency import (
Embed... | 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/tests/postprocessor/test_metadata_replacement.py | llama-index-core/tests/postprocessor/test_metadata_replacement.py | from llama_index.core.postprocessor import MetadataReplacementPostProcessor
from llama_index.core.schema import NodeWithScore, TextNode
def test_metadata_replacement() -> None:
node = TextNode(
text="This is a test 1.", metadata={"key": "This is a another test."}
)
nodes = [NodeWithScore(node=nod... | 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/tests/postprocessor/__init__.py | llama-index-core/tests/postprocessor/__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/tests/postprocessor/test_structured_llm_rerank.py | llama-index-core/tests/postprocessor/test_structured_llm_rerank.py | """Test LLM reranker."""
from typing import Any, List
from unittest.mock import patch
import pytest
from llama_index.core.base.llms.types import LLMMetadata
from llama_index.core.llms.mock import MockLLM
from llama_index.core.postprocessor.structured_llm_rerank import (
StructuredLLMRerank,
DocumentWithReleva... | 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/tests/postprocessor/test_llm_rerank.py | llama-index-core/tests/postprocessor/test_llm_rerank.py | """Test LLM reranker."""
from typing import Any, List
from unittest.mock import patch
from llama_index.core.llms.mock import MockLLM
from llama_index.core.postprocessor.llm_rerank import LLMRerank
from llama_index.core.prompts import BasePromptTemplate
from llama_index.core.schema import BaseNode, NodeWithScore, Quer... | 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/tests/extractors/test_document_context_extractor.py | llama-index-core/tests/extractors/test_document_context_extractor.py | import pytest
from llama_index.core.extractors import DocumentContextExtractor
from llama_index.core.llms import ChatMessage, ChatResponse, MockLLM
from llama_index.core.schema import Document, NodeRelationship, TextNode
from llama_index.core.storage.docstore.simple_docstore import SimpleDocumentStore
@pytest.fixtur... | 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/tests/readers/test_string_iterable.py | llama-index-core/tests/readers/test_string_iterable.py | """Test String Iterable Reader."""
from llama_index.core.readers.string_iterable import StringIterableReader
def test_load() -> None:
"""Test loading data into StringIterableReader."""
reader = StringIterableReader()
documents = reader.load_data(texts=["I went to the store", "I bought an apple"])
ass... | 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/tests/readers/test_json.py | llama-index-core/tests/readers/test_json.py | """Test file reader."""
import json
import sys
from tempfile import TemporaryDirectory
import pytest
from llama_index.core.readers.json import JSONReader
def test_basic() -> None:
"""Test JSON reader in basic mode."""
with TemporaryDirectory() as tmp_dir:
file_name = f"{tmp_dir}/test1.json"
... | 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/tests/readers/test_load_reader.py | llama-index-core/tests/readers/test_load_reader.py | from typing import cast
import pytest
from llama_index.core.readers.loading import load_reader
from llama_index.core.readers.string_iterable import StringIterableReader
def test_loading_readers() -> None:
string_iterable = StringIterableReader()
assert load_reader(string_iterable) == string_iterable # type:... | 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/tests/readers/__init__.py | llama-index-core/tests/readers/__init__.py | """Init file."""
| 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/tests/readers/file/test_base.py | llama-index-core/tests/readers/file/test_base.py | from pathlib import Path
from unittest import mock
import pytest
from fsspec.implementations.local import LocalFileSystem
from llama_index.core import Document
from llama_index.core.readers.file.base import (
SimpleDirectoryReader,
_DefaultFileMetadataFunc,
_format_file_timestamp,
default_file_metadata... | 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/tests/readers/file/__init__.py | llama-index-core/tests/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/tests/prompts/test_utils.py | llama-index-core/tests/prompts/test_utils.py | from llama_index.core.prompts.utils import get_template_vars
def test_get_template_vars() -> None:
template = "hello {text} {foo}"
template_vars = get_template_vars(template)
assert template_vars == ["text", "foo"]
| 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.