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/prompts/test_base.py | llama-index-core/tests/prompts/test_base.py | """Test prompts."""
from typing import Any
import pytest
from llama_index.core.base.llms.types import ChatMessage, MessageRole
from llama_index.core.llms.mock import MockLLM
from llama_index.core.prompts import (
ChatPromptTemplate,
PromptTemplate,
SelectorPromptTemplate,
)
from llama_index.core.prompts.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/tests/prompts/test_guidance_utils.py | llama-index-core/tests/prompts/test_guidance_utils.py | from typing import List
from llama_index.core.bridge.pydantic import BaseModel
from llama_index.core.prompts.guidance_utils import (
convert_to_handlebars,
pydantic_to_guidance_output_template,
)
def test_convert_to_handlebars() -> None:
test_str = "This is a string with {variable} and {{key: value}}"
... | 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/__init__.py | llama-index-core/tests/prompts/__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/prompts/test_rich.py | llama-index-core/tests/prompts/test_rich.py | import platformdirs # noqa: F401
from datetime import datetime
from llama_index.core.prompts.rich import RichPromptTemplate
from llama_index.core.schema import TextNode
def test_basic_rich_prompt():
prompt = RichPromptTemplate("Hello, {{name}}!")
assert not prompt.is_chat_template
assert prompt.templat... | 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_mixin.py | llama-index-core/tests/prompts/test_mixin.py | """Test prompt mixin."""
from llama_index.core.prompts.base import PromptTemplate
from llama_index.core.prompts.mixin import (
PromptDictType,
PromptMixin,
PromptMixinType,
)
class MockObject2(PromptMixin):
def __init__(self) -> None:
self._prompt_dict_2 = {
"abc": PromptTemplate(... | 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/retrievers/test_composable_retriever.py | llama-index-core/tests/retrievers/test_composable_retriever.py | from llama_index.core.indices import SummaryIndex
from llama_index.core.schema import IndexNode, TextNode
def test_composable_retrieval() -> None:
"""Test composable retrieval."""
text_node = TextNode(text="This is a test text node.", id_="test_text_node")
index_node = IndexNode(
text="This is a 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/retrievers/__init__.py | llama-index-core/tests/retrievers/__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/vector_stores/test_utils.py | llama-index-core/tests/vector_stores/test_utils.py | from typing import Any
import pytest
from llama_index.core.schema import (
BaseNode,
Document,
MediaResource,
Node,
NodeRelationship,
TextNode,
ImageNode,
IndexNode,
)
from llama_index.core.vector_stores.utils import (
metadata_dict_to_node,
node_to_metadata_dict,
)
@pytest.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/tests/vector_stores/__init__.py | llama-index-core/tests/vector_stores/__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/vector_stores/test_simple.py | llama-index-core/tests/vector_stores/test_simple.py | import unittest
from pathlib import Path
from typing import List
import pytest
from llama_index.core import VectorStoreIndex, MockEmbedding
from llama_index.core.schema import (
NodeRelationship,
RelatedNodeInfo,
TextNode,
Document,
)
from llama_index.core.vector_stores import SimpleVectorStore
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/tests/graph_stores/test_simple_lpg.py | llama-index-core/tests/graph_stores/test_simple_lpg.py | from llama_index.core.graph_stores.simple_labelled import SimplePropertyGraphStore
from llama_index.core.graph_stores.types import (
EntityNode,
Relation,
)
from llama_index.core.schema import TextNode, NodeRelationship, RelatedNodeInfo
def test_add() -> None:
g = SimplePropertyGraphStore()
e1 = Enti... | 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/question_gen/__init__.py | llama-index-core/tests/question_gen/__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/question_gen/test_llm_generators.py | llama-index-core/tests/question_gen/test_llm_generators.py | from llama_index.core.question_gen.llm_generators import LLMQuestionGenerator
from llama_index.core.question_gen.types import SubQuestion
from llama_index.core.schema import QueryBundle
from llama_index.core.tools.types import ToolMetadata
def test_llm_question_gen(patch_llm_predictor, patch_token_text_splitter) -> 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/utilities/test_sql_wrapper.py | llama-index-core/tests/utilities/test_sql_wrapper.py | from typing import Generator
import pytest
from llama_index.core.utilities.sql_wrapper import SQLDatabase
from sqlalchemy import Column, Integer, MetaData, String, Table, create_engine
# Create a fixture for the database instance
@pytest.fixture()
def sql_database(request: pytest.FixtureRequest) -> Generator[SQLData... | 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/text_splitter/conftest.py | llama-index-core/tests/text_splitter/conftest.py | import pytest
@pytest.fixture()
def english_text() -> str:
return """\
A Curious Beginning
In a quaint little village, nestled deep within a lush, green valley, there lived a \
curious young girl named Lily! She had sparkling blue eyes that glimmered like the \
morning dew—yes, like tiny sapphires embedded in he... | 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/text_splitter/__init__.py | llama-index-core/tests/text_splitter/__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/text_splitter/test_sentence_splitter.py | llama-index-core/tests/text_splitter/test_sentence_splitter.py | from typing import List
import tiktoken
from llama_index.core.node_parser.text import SentenceSplitter
from llama_index.core.schema import Document, MetadataMode, TextNode
def test_paragraphs() -> None:
"""Test case of a string with multiple paragraphs."""
sentence_text_splitter = SentenceSplitter(chunk_size... | 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/text_splitter/test_token_splitter.py | llama-index-core/tests/text_splitter/test_token_splitter.py | """Test text splitter."""
from typing import List
import tiktoken
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 Document, MetadataMode, TextNode
def test_split_token() -> None:
"""Test split 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/text_splitter/test_code_splitter.py | llama-index-core/tests/text_splitter/test_code_splitter.py | """Test text splitter."""
import os
import pytest
from typing import List
try:
import tree_sitter_language_pack # noqa
from llama_index.core.text_splitter import CodeSplitter
SHOULD_SKIP = False
except ImportError:
SHOULD_SKIP = True
from llama_index.core.schema import Document, MetadataMode, Text... | 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/output_parsers/test_pydantic.py | llama-index-core/tests/output_parsers/test_pydantic.py | """Test pydantic output parser."""
import pytest
from llama_index.core.bridge.pydantic import BaseModel
from llama_index.core.output_parsers.pydantic import PydanticOutputParser
from llama_index.core.llms import ChatMessage, TextBlock, ImageBlock
class AttrDict(BaseModel):
test_attr: str
foo: int
class Tes... | 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/output_parsers/test_selection.py | llama-index-core/tests/output_parsers/test_selection.py | import pytest
from llama_index.core.output_parsers.base import StructuredOutput
from llama_index.core.output_parsers.selection import SelectionOutputParser
@pytest.fixture()
def output_parser() -> SelectionOutputParser:
return SelectionOutputParser()
def test_format(output_parser: SelectionOutputParser) -> None... | 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/output_parsers/test_utils.py | llama-index-core/tests/output_parsers/test_utils.py | from llama_index.core.output_parsers.utils import extract_json_str
def test_extract_json_str() -> None:
input = """\
Here is the valid JSON:
{
"title": "TestModel",
"attr_dict": {
"test_attr": "test_attr",
"foo": 2
}
}\
"""
expected = """\
{
"title": "TestModel",
"attr_dict... | 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/output_parsers/test_base.py | llama-index-core/tests/output_parsers/test_base.py | """Test Output parsers."""
import pytest
from llama_index.core.output_parsers.langchain import LangchainOutputParser
try:
import langchain # pants: no-infer-dep
from llama_index.core.bridge.langchain import (
BaseOutputParser as LCOutputParser,
)
from llama_index.core.bridge.langchain 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/output_parsers/__init__.py | llama-index-core/tests/output_parsers/__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/evaluation/test_metrics.py | llama-index-core/tests/evaluation/test_metrics.py | from math import log2
import pytest
from llama_index.core.evaluation.retrieval.metrics import (
AveragePrecision,
HitRate,
MRR,
NDCG,
Precision,
Recall,
)
# Test cases for the updated HitRate class using instance attribute
@pytest.mark.parametrize(
("expected_ids", "retrieved_ids", "use_g... | 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/evaluation/test_batch_runner.py | llama-index-core/tests/evaluation/test_batch_runner.py | from typing import Any, Optional, Sequence
from llama_index.core.base.response.schema import Response
from llama_index.core.evaluation import BaseEvaluator
from llama_index.core.evaluation.base import EvaluationResult
from llama_index.core.prompts.mixin import PromptDictType
from llama_index.core.evaluation.batch_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/tests/evaluation/test_platform_eval.py | llama-index-core/tests/evaluation/test_platform_eval.py | import os
import sys
import pytest
from llama_index.core.evaluation.eval_utils import upload_eval_dataset
base_url = os.environ.get("LLAMA_CLOUD_BASE_URL", None)
api_key = os.environ.get("LLAMA_CLOUD_API_KEY", None)
python_version = sys.version
@pytest.mark.skipif(
not base_url or not api_key, reason="No platfo... | 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/evaluation/test_base.py | llama-index-core/tests/evaluation/test_base.py | from typing import Any, Optional, Sequence
from llama_index.core.base.response.schema import NodeWithScore, Response
from llama_index.core.evaluation import BaseEvaluator
from llama_index.core.evaluation.base import EvaluationResult
from llama_index.core.prompts.mixin import PromptDictType
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/tests/evaluation/test_dataset_generation.py | llama-index-core/tests/evaluation/test_dataset_generation.py | """Test dataset generation."""
from llama_index.core.evaluation.dataset_generation import DatasetGenerator
from llama_index.core.prompts.base import PromptTemplate
from llama_index.core.prompts.prompt_type import PromptType
from llama_index.core.schema import TextNode
def test_dataset_generation(patch_llm_predictor)... | 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/embeddings/test_utils.py | llama-index-core/tests/embeddings/test_utils.py | from llama_index.core.embeddings.mock_embed_model import MockEmbedding
from llama_index.core.embeddings.utils import resolve_embed_model
from pytest import MonkeyPatch
def test_resolve_embed_model(monkeypatch: MonkeyPatch) -> None:
# Test None
embed_model = resolve_embed_model(None)
assert isinstance(embe... | 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/embeddings/test_base.py | llama-index-core/tests/embeddings/test_base.py | """Embeddings."""
from typing import Any, List
from unittest.mock import patch
from llama_index.core.base.embeddings.base import SimilarityMode, mean_agg
from llama_index.core.embeddings.mock_embed_model import MockEmbedding
def mock_get_text_embedding(text: str) -> List[float]:
"""Mock get text embedding."""
... | 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/embeddings/test_with_cache.py | llama-index-core/tests/embeddings/test_with_cache.py | import pytest
from llama_index.core import MockEmbedding
from llama_index.core.storage.kvstore import SimpleKVStore
from unittest.mock import patch
expected_embedding = [0.5, 0.5, 0.5, 0.5]
# Create unique embeddings for each text to verify order
def custom_embeddings(texts):
return [[float(ord(c)) for c in text... | 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/embeddings/__init__.py | llama-index-core/tests/embeddings/__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/embeddings/todo_hf_test_utils.py | llama-index-core/tests/embeddings/todo_hf_test_utils.py | from typing import Any, Dict
# pants: no-infer-dep
from llama_index.core.embeddings.mock_embed_model import MockEmbedding
from llama_index.core.embeddings.utils import resolve_embed_model
from llama_index.embeddings.huggingface import (
HuggingFaceEmbedding,
) # pants: no-infer-dep
from llama_index.embeddings.ope... | 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/agent/__init__.py | llama-index-core/tests/agent/__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/agent/memory/test_vector_memory.py | llama-index-core/tests/agent/memory/test_vector_memory.py | """Test vector memory."""
from typing import Any, List
from llama_index.core.memory import VectorMemory
from llama_index.core.embeddings.mock_embed_model import MockEmbedding
from unittest.mock import patch
from llama_index.core.llms import ChatMessage
def mock_get_text_embedding(text: str) -> List[float]:
"""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/agent/memory/test_simple_composable.py | llama-index-core/tests/agent/memory/test_simple_composable.py | """Test simple composable memory."""
import pytest
from typing import Any, List
from llama_index.core.memory import (
VectorMemory,
SimpleComposableMemory,
ChatMemoryBuffer,
)
from llama_index.core.embeddings.mock_embed_model import MockEmbedding
from unittest.mock import patch
from llama_index.core.llms 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/agent/utils/test_agent_utils.py | llama-index-core/tests/agent/utils/test_agent_utils.py | import pytest
from typing import Any, List, Type, Optional, Dict
from typing_extensions import override
from pydantic import BaseModel
from llama_index.core.llms import ChatMessage, TextBlock
from llama_index.core.types import Model
from llama_index.core.llms import (
LLMMetadata,
ChatMessage,
ChatResponse... | 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/agent/workflow/test_thinking_delta.py | llama-index-core/tests/agent/workflow/test_thinking_delta.py | """Tests for thinking_delta functionality in agents."""
import pytest
from typing import Any, AsyncGenerator, List
from unittest.mock import AsyncMock
from llama_index.core.base.llms.types import ChatMessage, ChatResponse, LLMMetadata
from llama_index.core.llms import MockLLM
from llama_index.core.agent.workflow 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/agent/workflow/test_react_agent.py | llama-index-core/tests/agent/workflow/test_react_agent.py | from llama_index.core.agent.workflow import ReActAgent
from llama_index.core.llms import MockLLM
from llama_index.core.prompts import PromptTemplate
def test_react_agent_prompts():
llm = MockLLM()
agent = ReActAgent(
llm=llm,
tools=[],
)
prompts = agent.get_prompts()
assert len(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/agent/workflow/test_code_act_agent.py | llama-index-core/tests/agent/workflow/test_code_act_agent.py | from dataclasses import dataclass
import pytest
from unittest.mock import AsyncMock, MagicMock
from typing import Any
from workflows import Workflow
from workflows.events import Event
from llama_index.core.agent.workflow.codeact_agent import CodeActAgent
from llama_index.core.agent.workflow.workflow_events import Age... | 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/agent/workflow/test_return_direct_e2e.py | llama-index-core/tests/agent/workflow/test_return_direct_e2e.py | import os
import pytest
CI = os.getenv("CI", "").lower() in ("1", "true", "yes")
try:
from llama_index.llms.openai import OpenAI # noqa: F401
has_openai = True
except ImportError:
has_openai = False
@pytest.mark.skipif(CI or not has_openai, reason="Skipping in CI environment")
@pytest.mark.asyncio
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/agent/workflow/test_function_call.py | llama-index-core/tests/agent/workflow/test_function_call.py | from unittest.mock import AsyncMock, MagicMock
import pytest
from llama_index.core.agent.workflow import BaseWorkflowAgent
from llama_index.core.agent.workflow.workflow_events import (
AgentInput,
AgentOutput,
ToolCallResult,
)
from llama_index.core.llms import ChatMessage
from llama_index.core.memory 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/agent/workflow/__init__.py | llama-index-core/tests/agent/workflow/__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/agent/workflow/test_multi_agent_workflow.py | llama-index-core/tests/agent/workflow/test_multi_agent_workflow.py | from typing import List
import pytest
from llama_index.core.agent.workflow import AgentInput
from llama_index.core.agent.workflow.function_agent import FunctionAgent
from llama_index.core.agent.workflow.multi_agent_workflow import AgentWorkflow
from llama_index.core.agent.workflow.react_agent import ReActAgent
from ll... | 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/agent/workflow/test_agent_with_structured_output.py | llama-index-core/tests/agent/workflow/test_agent_with_structured_output.py | import pytest
import os
from typing import Any, List, Type, Optional, Dict
from typing_extensions import override
from pydantic import BaseModel, Field
from llama_index.core.types import Model
from llama_index.core.llms import (
LLMMetadata,
ChatMessage,
ChatResponse,
ChatResponseAsyncGen,
LLM,
)
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/tests/agent/workflow/test_single_agent_workflow.py | llama-index-core/tests/agent/workflow/test_single_agent_workflow.py | from typing import List
import pytest
from llama_index.core.agent.workflow import FunctionAgent, ReActAgent, AgentInput
from llama_index.core.base.llms.types import (
ChatMessage,
MessageRole,
)
from llama_index.core.llms.mock import MockFunctionCallingLLM
from llama_index.core.llms.llm import ToolSelection
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/tests/agent/workflow/test_events.py | llama-index-core/tests/agent/workflow/test_events.py | import pytest
import json
from typing import Tuple
from llama_index.core.llms import ChatMessage
from llama_index.core.tools import ToolSelection
from llama_index.core.bridge.pydantic import BaseModel, ValidationError
from llama_index.core.agent.workflow.workflow_events import (
AgentWorkflowStartEvent,
AgentO... | 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/agent/react/__init__.py | llama-index-core/tests/agent/react/__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/agent/react/test_react_output_parser.py | llama-index-core/tests/agent/react/test_react_output_parser.py | from llama_index.core.agent.react.output_parser import (
extract_final_response,
extract_tool_use,
parse_action_reasoning_step,
)
def test_parse_action_reasoning_step() -> None:
mock_input_text = """\
Thought: Gotta use a tool.
Action: tool
Action Input: {'pages': ['coffee'] /* comment */, 'load_kwarg... | 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/agent/react/test_prompt_customization.py | llama-index-core/tests/agent/react/test_prompt_customization.py | from llama_index.core import PromptTemplate
from llama_index.core.agent.workflow import ReActAgent
from textwrap import dedent
def test_partial_formatted_system_prompt():
"""Partially formatted context should be preserved."""
agent = ReActAgent()
prompt = PromptTemplate(
dedent(
"""\... | 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/schema/test_media_resource.py | llama-index-core/tests/schema/test_media_resource.py | from pathlib import Path
from llama_index.core.bridge.pydantic import AnyUrl
from llama_index.core.schema import MediaResource
def test_defaults():
m = MediaResource()
assert m.data is None
assert m.embeddings is None
assert m.mimetype is None
assert m.path is None
assert m.url is None
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/schema/test_image_document.py | llama-index-core/tests/schema/test_image_document.py | import httpx
import pytest
from pathlib import Path
from llama_index.core.schema import ImageDocument
@pytest.fixture()
def image_url() -> str:
return "https://astrabert.github.io/hophop-science/images/whale_doing_science.png"
def test_real_image_path(tmp_path: Path, image_url: str) -> None:
content = http... | 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/schema/__init__.py | llama-index-core/tests/schema/__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/schema/test_schema.py | llama-index-core/tests/schema/test_schema.py | import base64
import httpx
import logging
from io import BytesIO
from pathlib import Path
from unittest import mock
import pytest
from llama_index.core.schema import (
Document,
ImageDocument,
ImageNode,
MediaResource,
NodeWithScore,
ObjectType,
TextNode,
)
@pytest.fixture()
def text_node... | 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/schema/test_base_component.py | llama-index-core/tests/schema/test_base_component.py | from typing import Callable
import pytest
from llama_index.core.schema import BaseComponent
from pydantic.fields import PrivateAttr
@pytest.fixture()
def my_component():
class MyComponent(BaseComponent):
foo: str = "bar"
return MyComponent
def test_identifiers():
assert BaseComponent.class_nam... | 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/schema/test_node.py | llama-index-core/tests/schema/test_node.py | from llama_index.core.schema import MediaResource, Node, ObjectType
def test_identifiers():
assert Node.class_name() == "Node"
assert Node.get_type() == ObjectType.MULTIMODAL
def test_get_content():
assert Node().get_content() == ""
def test_hash():
node = Node()
node.audio_resource = MediaRes... | 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/schema/test_base_node.py | llama-index-core/tests/schema/test_base_node.py | from typing import Any
import pytest
from llama_index.core.schema import (
BaseNode,
MetadataMode,
NodeRelationship,
ObjectType,
RelatedNodeInfo,
)
@pytest.fixture()
def MyNode():
class MyNode(BaseNode):
def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, ... | 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/objects/test_base.py | llama-index-core/tests/objects/test_base.py | """Test object index."""
from llama_index.core.indices.list.base import SummaryIndex
from llama_index.core.objects.base import ObjectIndex
from llama_index.core.objects.base_node_mapping import SimpleObjectNodeMapping
from llama_index.core.objects.tool_node_mapping import SimpleToolNodeMapping
from llama_index.core.to... | 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/objects/test_node_mapping.py | llama-index-core/tests/objects/test_node_mapping.py | """Test node mapping."""
from llama_index.core import SQLDatabase
from llama_index.core.bridge.pydantic import BaseModel
from llama_index.core.objects.base_node_mapping import SimpleObjectNodeMapping
from llama_index.core.objects.table_node_mapping import (
SQLTableNodeMapping,
SQLTableSchema,
)
from llama_ind... | 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/objects/__init__.py | llama-index-core/tests/objects/__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/playground/test_base.py | llama-index-core/tests/playground/test_base.py | """Test Playground."""
from typing import 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.indices.tree.base import TreeIndex
from llama_index.core.indices.vector_store.base import VectorStoreIndex
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/playground/__init__.py | llama-index-core/tests/playground/__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/mock_utils/mock_predict.py | llama-index-core/tests/mock_utils/mock_predict.py | """Mock predict."""
import json
from typing import Any, Dict
from llama_index.core.prompts.base import (
BasePromptTemplate,
)
from llama_index.core.prompts.prompt_type import PromptType
from tests.mock_utils.mock_utils import mock_extract_keywords_response
def _mock_summary_predict(prompt_args: 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/tests/mock_utils/mock_utils.py | llama-index-core/tests/mock_utils/mock_utils.py | """Mock utils."""
import re
from typing import List, Optional, Set
from llama_index.core.indices.keyword_table.utils import simple_extract_keywords
def mock_tokenizer(text: str) -> List[str]:
"""Mock tokenizer."""
tokens = re.split(r"[ \n]", text) # split by space or newline
result = []
for token 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/mock_utils/mock_prompts.py | llama-index-core/tests/mock_utils/mock_prompts.py | """Mock prompt utils."""
from llama_index.core.prompts.base import PromptTemplate
from llama_index.core.prompts.prompt_type import PromptType
MOCK_SUMMARY_PROMPT_TMPL = "{context_str}\n"
MOCK_SUMMARY_PROMPT = PromptTemplate(
MOCK_SUMMARY_PROMPT_TMPL, prompt_type=PromptType.SUMMARY
)
MOCK_INSERT_PROMPT_TMPL = "{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/mock_utils/__init__.py | llama-index-core/tests/mock_utils/__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/mock_utils/mock_text_splitter.py | llama-index-core/tests/mock_utils/mock_text_splitter.py | """Mock text splitter."""
from typing import Any, List, Optional
def patch_token_splitter_newline(
self: Any, text: str, metadata_str: Optional[str] = None
) -> List[str]:
"""Mock token splitter by newline."""
if text == "":
return []
return text.split("\n")
def mock_token_splitter_newline(... | 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/async_utils.py | llama-index-core/llama_index/core/async_utils.py | """Async utils."""
import asyncio
import contextvars
import concurrent.futures
from itertools import zip_longest
from typing import Any, Coroutine, Iterable, List, Optional, TypeVar
import llama_index.core.instrumentation as instrument
dispatcher = instrument.get_dispatcher(__name__)
def asyncio_module(show_progre... | 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/img_utils.py | llama-index-core/llama_index/core/img_utils.py | """Utils for manipulating images."""
import base64
from io import BytesIO
from typing import cast
from PIL import Image
from PIL.ImageFile import ImageFile
def img_2_b64(image: ImageFile, format: str = "JPEG") -> str:
"""
Convert a PIL.Image to a base64 encoded image string.
Args:
image (ImageF... | 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/constants.py | llama-index-core/llama_index/core/constants.py | """Set of constants."""
DEFAULT_TEMPERATURE = 0.1
DEFAULT_CONTEXT_WINDOW = 3900 # tokens
DEFAULT_NUM_OUTPUTS = 256 # tokens
DEFAULT_NUM_INPUT_FILES = 10 # files
DEFAULT_EMBED_BATCH_SIZE = 10
DEFAULT_CHUNK_SIZE = 1024 # tokens
DEFAULT_CHUNK_OVERLAP = 20 # tokens
DEFAULT_SIMILARITY_TOP_K = 2
DEFAULT_IMAGE_SIMILAR... | 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/schema.py | llama-index-core/llama_index/core/schema.py | """Base schema for data structures."""
from __future__ import annotations
import base64
import json
import logging
import pickle
import textwrap
import uuid
from abc import abstractmethod
from binascii import Error as BinasciiError
from dataclasses import dataclass
from enum import Enum, auto
from hashlib import sha2... | 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/service_context.py | llama-index-core/llama_index/core/service_context.py | from typing import Any, Optional
class ServiceContext:
"""
Service Context container.
NOTE: Deprecated, use llama_index.settings.Settings instead or pass in
modules to local functions/methods/interfaces.
"""
def __init__(self, **kwargs: Any) -> None:
raise ValueError(
"S... | 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/utils.py | llama-index-core/llama_index/core/utils.py | """General utils functions."""
import asyncio
import base64
import os
import random
import sys
import time
import traceback
import uuid
from binascii import Error as BinasciiError
from contextlib import contextmanager
from dataclasses import dataclass
from functools import partial, wraps
from io import BytesIO
from it... | 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/settings.py | llama-index-core/llama_index/core/settings.py | from dataclasses import dataclass
from typing import Any, Callable, List, Optional
from llama_index.core.base.embeddings.base import BaseEmbedding
from llama_index.core.callbacks.base import BaseCallbackHandler, CallbackManager
from llama_index.core.embeddings.utils import EmbedType, resolve_embed_model
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/__init__.py | llama-index-core/llama_index/core/__init__.py | """Top-level imports for LlamaIndex."""
import logging
from importlib.metadata import PackageNotFoundError, version
from logging import NullHandler
from typing import Callable, Optional
try:
__version__ = version("llama-index-core")
except PackageNotFoundError:
# This might happen when running tests or script... | 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/types.py | llama-index-core/llama_index/core/types.py | import threading
from abc import ABC, abstractmethod
from contextvars import copy_context
from enum import Enum
from functools import partial
from typing import (
Any,
AsyncGenerator,
Callable,
Dict,
Generator,
Generic,
List,
Optional,
TYPE_CHECKING,
Tuple,
Type,
TypeVar,... | 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/image_retriever.py | llama-index-core/llama_index/core/image_retriever.py | from abc import abstractmethod
from typing import List
from llama_index.core.indices.query.schema import QueryBundle, QueryType
from llama_index.core.instrumentation import DispatcherSpanMixin
from llama_index.core.prompts.mixin import PromptMixin
from llama_index.core.schema import NodeWithScore
class BaseImageRetr... | 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/bridge/pydantic_core.py | llama-index-core/llama_index/core/bridge/pydantic_core.py | import pydantic_core
from pydantic_core import CoreSchema, core_schema
__all__ = ["pydantic_core", "CoreSchema", "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/bridge/pydantic_settings.py | llama-index-core/llama_index/core/bridge/pydantic_settings.py | import pydantic_settings
from pydantic_settings import BaseSettings, SettingsConfigDict
__all__ = ["pydantic_settings", "BaseSettings", "SettingsConfigDict"]
| 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/bridge/__init__.py | llama-index-core/llama_index/core/bridge/__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/bridge/langchain.py | llama-index-core/llama_index/core/bridge/langchain.py | import langchain # pants: no-infer-dep
from langchain.agents import (
AgentExecutor,
AgentType,
initialize_agent,
) # pants: no-infer-dep
# agents and tools
from langchain.agents.agent_toolkits.base import BaseToolkit # pants: no-infer-dep
from langchain.base_language import BaseLanguageModel # pants: ... | 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/bridge/pydantic.py | llama-index-core/llama_index/core/bridge/pydantic.py | import pydantic
from pydantic import (
AnyUrl,
BaseModel,
BeforeValidator,
ConfigDict,
Field,
FilePath,
GetCoreSchemaHandler,
GetJsonSchemaHandler,
PlainSerializer,
PrivateAttr,
Secret,
SecretStr,
SerializationInfo,
SerializeAsAny,
SerializerFunctionWrapHandle... | 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/node_parser/node_utils.py | llama-index-core/llama_index/core/node_parser/node_utils.py | """General node utils."""
import logging
import uuid
from typing import List, Optional, Protocol, runtime_checkable
from llama_index.core.schema import (
BaseNode,
Document,
ImageDocument,
ImageNode,
NodeRelationship,
TextNode,
)
from llama_index.core.utils import truncate_text
logger = loggi... | 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/node_parser/interface.py | llama-index-core/llama_index/core/node_parser/interface.py | """Node parser interface."""
from abc import ABC, abstractmethod
from typing import Any, Callable, Dict, List, Sequence
from typing_extensions import Annotated
from llama_index.core.bridge.pydantic import (
Field,
WithJsonSchema,
BeforeValidator,
ConfigDict,
PlainSerializer,
)
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/node_parser/loading.py | llama-index-core/llama_index/core/node_parser/loading.py | from typing import Dict, Type
from llama_index.core.node_parser.file.html import HTMLNodeParser
from llama_index.core.node_parser.file.json import JSONNodeParser
from llama_index.core.node_parser.file.markdown import MarkdownNodeParser
from llama_index.core.node_parser.file.simple_file import SimpleFileNodeParser
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/node_parser/__init__.py | llama-index-core/llama_index/core/node_parser/__init__.py | """Node parsers."""
from llama_index.core.node_parser.file.html import HTMLNodeParser
from llama_index.core.node_parser.file.json import JSONNodeParser
from llama_index.core.node_parser.file.markdown import MarkdownNodeParser
from llama_index.core.node_parser.file.simple_file import SimpleFileNodeParser
from llama_ind... | 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/node_parser/file/html.py | llama-index-core/llama_index/core/node_parser/file/html.py | """HTML node parser."""
from typing import TYPE_CHECKING, Any, List, Optional, Sequence, Union
from llama_index.core.bridge.pydantic import Field
from llama_index.core.callbacks.base import CallbackManager
from llama_index.core.node_parser.interface import NodeParser
from llama_index.core.node_parser.node_utils 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/node_parser/file/markdown.py | llama-index-core/llama_index/core/node_parser/file/markdown.py | """Markdown node parser."""
import re
from typing import Any, List, Optional, Sequence
from llama_index.core.bridge.pydantic import Field
from llama_index.core.callbacks.base import CallbackManager
from llama_index.core.node_parser.interface import NodeParser
from llama_index.core.node_parser.node_utils import build_... | 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/node_parser/file/__init__.py | llama-index-core/llama_index/core/node_parser/file/__init__.py | from llama_index.core.node_parser.file.html import HTMLNodeParser
from llama_index.core.node_parser.file.json import JSONNodeParser
from llama_index.core.node_parser.file.markdown import MarkdownNodeParser
from llama_index.core.node_parser.file.simple_file import SimpleFileNodeParser
__all__ = [
"SimpleFileNodePar... | 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/node_parser/file/json.py | llama-index-core/llama_index/core/node_parser/file/json.py | """JSON node parser."""
import json
from typing import Any, Dict, Generator, List, Optional, Sequence
from llama_index.core.callbacks.base import CallbackManager
from llama_index.core.node_parser.interface import NodeParser
from llama_index.core.node_parser.node_utils import build_nodes_from_splits
from llama_index.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/node_parser/file/simple_file.py | llama-index-core/llama_index/core/node_parser/file/simple_file.py | """Simple file node parser."""
import os
from typing import Any, Dict, List, Optional, Sequence, Type
from llama_index.core.callbacks.base import CallbackManager
from llama_index.core.node_parser.node_utils import build_nodes_from_splits
from llama_index.core.node_parser.file.html import HTMLNodeParser
from llama_ind... | 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/node_parser/relational/utils.py | llama-index-core/llama_index/core/node_parser/relational/utils.py | from typing import Any
from io import StringIO
def md_to_df(md_str: str) -> Any:
"""Convert Markdown to dataframe."""
try:
import pandas as pd
except ImportError:
raise ImportError(
"You must install the `pandas` package to use this node parser."
)
# Replace " 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/llama_index/core/node_parser/relational/unstructured_element.py | llama-index-core/llama_index/core/node_parser/relational/unstructured_element.py | """Unstructured element node parser."""
from typing import Any, Callable, List, Optional, Dict
from llama_index.core.bridge.pydantic import Field
from llama_index.core.callbacks.base import CallbackManager
from llama_index.core.node_parser.relational.base_element import (
DEFAULT_SUMMARY_QUERY_STR,
BaseElem... | 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/node_parser/relational/hierarchical.py | llama-index-core/llama_index/core/node_parser/relational/hierarchical.py | """Hierarchical node parser."""
from typing import Any, Dict, List, Optional, Sequence
from llama_index.core.bridge.pydantic import Field
from llama_index.core.callbacks.base import CallbackManager
from llama_index.core.callbacks.schema import CBEventType, EventPayload
from llama_index.core.node_parser.interface 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/node_parser/relational/__init__.py | llama-index-core/llama_index/core/node_parser/relational/__init__.py | from llama_index.core.node_parser.relational.hierarchical import (
HierarchicalNodeParser,
)
from llama_index.core.node_parser.relational.markdown_element import (
MarkdownElementNodeParser,
)
from llama_index.core.node_parser.relational.unstructured_element import (
UnstructuredElementNodeParser,
)
from ll... | 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/node_parser/relational/markdown_element.py | llama-index-core/llama_index/core/node_parser/relational/markdown_element.py | from typing import Any, Callable, List, Optional
from llama_index.core.node_parser.relational.base_element import (
BaseElementNodeParser,
Element,
)
from llama_index.core.schema import BaseNode, TextNode, NodeRelationship
from llama_index.core.node_parser.relational.utils import md_to_df
class MarkdownEleme... | 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/node_parser/relational/base_element.py | llama-index-core/llama_index/core/node_parser/relational/base_element.py | import uuid
from abc import abstractmethod
from typing import Any, Dict, List, Optional, Sequence, Tuple, cast
from tqdm import tqdm
from llama_index.core.async_utils import DEFAULT_NUM_WORKERS, run_jobs, asyncio_run
from llama_index.core.base.response.schema import PydanticResponse
from llama_index.core.bridge.pydant... | 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/node_parser/relational/llama_parse_json_element.py | llama-index-core/llama_index/core/node_parser/relational/llama_parse_json_element.py | from typing import Any, Callable, List, Optional, Dict
from llama_index.core.node_parser.relational.base_element import (
BaseElementNodeParser,
Element,
)
from llama_index.core.schema import BaseNode, TextNode
from llama_index.core.node_parser.relational.utils import md_to_df
class LlamaParseJsonNodeParser(... | 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/node_parser/text/semantic_splitter.py | llama-index-core/llama_index/core/node_parser/text/semantic_splitter.py | from typing import Any, Callable, List, Optional, Sequence, TypedDict
from typing_extensions import Annotated
import numpy as np
from llama_index.core.base.embeddings.base import BaseEmbedding
from llama_index.core.bridge.pydantic import Field, SerializeAsAny, WithJsonSchema
from llama_index.core.callbacks.base import... | 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.