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-dev/llama_dev/release/changelog.py | llama-dev/llama_dev/release/changelog.py | import json
import re
import shlex
import subprocess
from datetime import date
from pathlib import Path
import click
from llama_dev.utils import find_all_packages, get_changed_packages, load_pyproject
CHANGELOG_PLACEHOLDER = "<!--- generated changelog --->"
def _run_command(command: str) -> str:
"""Helper to r... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-dev/llama_dev/pkg/bump.py | llama-dev/llama_dev/pkg/bump.py | import click
from llama_dev.utils import (
BumpType,
bump_version,
find_all_packages,
is_llama_index_package,
load_pyproject,
update_pyproject_version,
)
@click.command(short_help="Bump package version")
@click.argument("package_names", required=False, nargs=-1)
@click.option(
"--all",
... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-dev/llama_dev/pkg/__init__.py | llama-dev/llama_dev/pkg/__init__.py | import click
from .bump import bump
from .cmd_exec import cmd_exec
from .info import info
@click.group(short_help="Manage packages in the monorepo")
def pkg():
pass # pragma: no cover
pkg.add_command(info)
pkg.add_command(cmd_exec, name="exec")
pkg.add_command(bump)
| python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-dev/llama_dev/pkg/info.py | llama-dev/llama_dev/pkg/info.py | import json
import click
from rich.table import Table
from llama_dev.utils import find_all_packages, is_llama_index_package, load_pyproject
@click.command(short_help="Get package details")
@click.argument("package_names", required=False, nargs=-1)
@click.option(
"--all",
is_flag=True,
help="Get info 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-dev/llama_dev/pkg/cmd_exec.py | llama-dev/llama_dev/pkg/cmd_exec.py | import os
import subprocess
from pathlib import Path
import click
from llama_dev.utils import find_all_packages, is_llama_index_package
@click.command(short_help="Exec a command inside a package folder")
@click.option(
"--fail-fast",
is_flag=True,
default=False,
help="Exit the command at the first 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-dev/llama_dev/test/__init__.py | llama-dev/llama_dev/test/__init__.py | import concurrent.futures
import os
import subprocess
import sys
import time
from enum import Enum, auto
from pathlib import Path
import click
from rich.live import Live
from rich.table import Table
from llama_dev.utils import (
find_all_packages,
get_changed_files,
get_changed_packages,
get_dep_names... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-dev/tests/test_utils.py | llama-dev/tests/test_utils.py | from pathlib import Path
from unittest import mock
import pytest
from llama_dev.utils import (
find_all_packages,
find_integrations,
find_packs,
find_utils,
get_changed_files,
get_changed_packages,
get_dep_names,
get_dependants_packages,
is_python_version_compatible,
load_pyproj... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-dev/tests/test_cli.py | llama-dev/tests/test_cli.py | from click.testing import CliRunner
from llama_dev.cli import cli
def test_version():
runner = CliRunner()
with runner.isolated_filesystem():
result = runner.invoke(cli, ["--version"])
assert result.exit_code == 0
assert result.output.startswith("cli, version ")
| python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-dev/tests/conftest.py | llama-dev/tests/conftest.py | import sys
from pathlib import Path
from unittest.mock import MagicMock
import pytest
@pytest.fixture
def data_path():
return Path(__file__).parent / "data"
@pytest.fixture
def mock_current_version(monkeypatch):
"""Fixture to mock the current Python version."""
def _set_version(major, minor, micro):
... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-dev/tests/__init__.py | llama-dev/tests/__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-dev/tests/release/test_changelog.py | llama-dev/tests/release/test_changelog.py | import json
from datetime import date
from pathlib import Path
from unittest import mock
import pytest
from click.testing import CliRunner
from llama_dev.cli import cli
from llama_dev.release.changelog import (
CHANGELOG_PLACEHOLDER,
_extract_pr_data,
_get_changelog_text,
_get_latest_tag,
_get_pr_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-dev/tests/release/test_check.py | llama-dev/tests/release/test_check.py | import json
from unittest import mock
import click
import pytest
from llama_dev.cli import cli
from llama_dev.release.check import (
_get_current_branch_name,
_get_version_from_pypi,
_get_version_from_pyproject,
check,
)
def test_get_current_branch_name():
with mock.patch("subprocess.check_output... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-dev/tests/pkg/test_bump.py | llama-dev/tests/pkg/test_bump.py | import builtins
from unittest import mock
from click.testing import CliRunner
from llama_dev.cli import cli
from llama_dev.pkg.bump import BumpType, bump_version, update_pyproject_version
def test_bump_version():
assert bump_version("0.0", BumpType.PATCH) == "0.0.1"
assert bump_version("0.0", BumpType.MINOR)... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-dev/tests/pkg/test_cmd_exec.py | llama-dev/tests/pkg/test_cmd_exec.py | from unittest import mock
from click.testing import CliRunner
from llama_dev.cli import cli
def test_cmd_exec_no_package_no_all_flag():
runner = CliRunner()
result = runner.invoke(cli, ["pkg", "exec", "--cmd", "echo hello"])
assert result.exit_code != 0
assert "Either specify a package name or use th... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-dev/tests/pkg/test_info.py | llama-dev/tests/pkg/test_info.py | from pathlib import Path
from unittest import mock
import pytest
from click.testing import CliRunner
from llama_dev.cli import cli
@pytest.fixture
def mock_projects():
return {
"package1": {"project": {"name": "llama-index-package1", "version": "0.1.0"}},
"package2": {"project": {"name": "llama-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-dev/tests/test/test_test.py | llama-dev/tests/test/test_test.py | from pathlib import Path
from unittest import mock
import pytest
from click.testing import CliRunner
from llama_dev import test as llama_dev_test
from llama_dev.cli import cli
from llama_dev.test import ResultStatus, _pytest, _run_tests
def mocked_coverage_failed(*args, **kwargs):
return {
"package": Pat... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-finetuning/llama_index/finetuning/__init__.py | llama-index-finetuning/llama_index/finetuning/__init__.py | """Finetuning modules."""
from llama_index.finetuning.embeddings.adapter import (
EmbeddingAdapterFinetuneEngine,
)
from llama_index.finetuning.embeddings.common import (
EmbeddingQAFinetuneDataset,
generate_qa_embedding_pairs,
)
from llama_index.finetuning.embeddings.sentence_transformer import (
Sent... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-finetuning/llama_index/finetuning/types.py | llama-index-finetuning/llama_index/finetuning/types.py | """Finetuning Engine."""
from abc import ABC, abstractmethod
from typing import Any
from llama_index.core.base.embeddings.base import BaseEmbedding
from llama_index.core.llms.llm import LLM
from llama_index.core.postprocessor import SentenceTransformerRerank
from llama_index.postprocessor.cohere_rerank import CohereR... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-finetuning/llama_index/finetuning/openai/validate_json.py | llama-index-finetuning/llama_index/finetuning/openai/validate_json.py | # Validates training data and estimates token usage
# Copied from https://platform.openai.com/docs/guides/fine-tuning/preparing-your-dataset
# Usage:
# python validate_json.py <path_to_jsonl_file>
# We start by importing the required packages
import json
import os
import sys
from collections import defaultdict
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-finetuning/llama_index/finetuning/openai/__init__.py | llama-index-finetuning/llama_index/finetuning/openai/__init__.py | """Init params."""
from llama_index.finetuning.openai.base import OpenAIFinetuneEngine
__all__ = ["OpenAIFinetuneEngine"]
| python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-finetuning/llama_index/finetuning/openai/base.py | llama-index-finetuning/llama_index/finetuning/openai/base.py | """OpenAI Finetuning."""
import logging
import os
import time
from typing import Any, Optional
import openai
from openai import OpenAI as SyncOpenAI
from openai.types.fine_tuning import FineTuningJob
from llama_index.core.llms.llm import LLM
from llama_index.finetuning.callbacks.finetuning_handler import OpenAIFineT... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-finetuning/llama_index/finetuning/mistralai/utils.py | llama-index-finetuning/llama_index/finetuning/mistralai/utils.py | import json
import os
import random
import string
def reformat_jsonl(input_file):
output_file = input_file + ".tmp"
content_keys = ["content", "text"]
with open(input_file) as infile, open(output_file, "w") as outfile:
for idx, line in enumerate(infile):
data = json.loads(line)
... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-finetuning/llama_index/finetuning/mistralai/__init__.py | llama-index-finetuning/llama_index/finetuning/mistralai/__init__.py | """Init params."""
from llama_index.finetuning.mistralai.base import MistralAIFinetuneEngine
__all__ = ["MistralAIFinetuneEngine"]
| python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-finetuning/llama_index/finetuning/mistralai/base.py | llama-index-finetuning/llama_index/finetuning/mistralai/base.py | """MistralAI Finetuning."""
import logging
import os
import time
from typing import Any, Optional, Dict
import sys
from mistralai import Mistral
from mistralai.models import (
JobsAPIRoutesFineTuningGetFineTuningJobResponse,
WandbIntegration,
CompletionTrainingParametersIn,
)
from llama_index.core.llms.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-finetuning/llama_index/finetuning/callbacks/finetuning_handler.py | llama-index-finetuning/llama_index/finetuning/callbacks/finetuning_handler.py | import json
from abc import abstractmethod
from typing import Any, Dict, List, Optional
from llama_index.core.callbacks.base import BaseCallbackHandler
from llama_index.core.callbacks.schema import CBEventType, EventPayload
class BaseFinetuningHandler(BaseCallbackHandler):
"""
Callback handler for finetuning... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-finetuning/llama_index/finetuning/callbacks/__init__.py | llama-index-finetuning/llama_index/finetuning/callbacks/__init__.py | from llama_index.finetuning.callbacks.finetuning_handler import (
BaseFinetuningHandler,
OpenAIFineTuningHandler,
MistralAIFineTuningHandler,
)
__all__ = [
"BaseFinetuningHandler",
"OpenAIFineTuningHandler",
"MistralAIFineTuningHandler",
]
| python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-finetuning/llama_index/finetuning/azure_openai/__init__.py | llama-index-finetuning/llama_index/finetuning/azure_openai/__init__.py | """Init params."""
from llama_index.finetuning.azure_openai.base import AzureOpenAIFinetuneEngine
__all__ = ["AzureOpenAIFinetuneEngine"]
| python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-finetuning/llama_index/finetuning/azure_openai/base.py | llama-index-finetuning/llama_index/finetuning/azure_openai/base.py | """OpenAI Finetuning."""
import logging
import json
import os
import requests
from typing import Any, Optional
from openai import AzureOpenAI as SyncAzureOpenAI
from llama_index.core.llms.llm import LLM
from llama_index.finetuning.callbacks.finetuning_handler import OpenAIFineTuningHandler
from llama_index.finetunin... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-finetuning/llama_index/finetuning/embeddings/common.py | llama-index-finetuning/llama_index/finetuning/embeddings/common.py | import json
import re
import uuid
import warnings
from typing import Dict, List, Tuple
from tqdm import tqdm
from llama_index.core.bridge.pydantic import BaseModel
from llama_index.core.llms.utils import LLM
from llama_index.core.schema import MetadataMode, TextNode
class EmbeddingQAFinetuneDataset(BaseModel):
""... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-finetuning/llama_index/finetuning/embeddings/adapter_utils.py | llama-index-finetuning/llama_index/finetuning/embeddings/adapter_utils.py | """Adapter utils."""
from pathlib import Path
from typing import Any, Callable, Dict, List, Optional, Type
import torch
import transformers
from llama_index.core.utils import print_text
from llama_index.embeddings.adapter import BaseAdapter
from sentence_transformers.util import cos_sim
from torch import Tensor, nn
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-finetuning/llama_index/finetuning/embeddings/__init__.py | llama-index-finetuning/llama_index/finetuning/embeddings/__init__.py | """Init params."""
from llama_index.finetuning.embeddings.adapter import EmbeddingAdapterFinetuneEngine
from llama_index.finetuning.embeddings.sentence_transformer import (
SentenceTransformersFinetuneEngine,
)
__all__ = ["EmbeddingAdapterFinetuneEngine", "SentenceTransformersFinetuneEngine"]
| python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-finetuning/llama_index/finetuning/embeddings/sentence_transformer.py | llama-index-finetuning/llama_index/finetuning/embeddings/sentence_transformer.py | """Sentence Transformer Finetuning Engine."""
import os
from typing import Any, Optional
from llama_index.core.base.embeddings.base import BaseEmbedding
from llama_index.core.embeddings.utils import resolve_embed_model
from llama_index.finetuning.embeddings.common import EmbeddingQAFinetuneDataset
from llama_index.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-finetuning/llama_index/finetuning/embeddings/adapter.py | llama-index-finetuning/llama_index/finetuning/embeddings/adapter.py | """Sentence Transformer Finetuning Engine."""
import logging
from typing import Any, List, Optional, Tuple, Type, cast
from llama_index.core.base.embeddings.base import BaseEmbedding
from llama_index.core.utils import infer_torch_device
from llama_index.embeddings.adapter import AdapterEmbeddingModel
from llama_index... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-finetuning/llama_index/finetuning/cross_encoders/cross_encoder.py | llama-index-finetuning/llama_index/finetuning/cross_encoders/cross_encoder.py | """Cross Encoder Finetuning Engine."""
from typing import Any, List, Optional, Union
from llama_index.core.postprocessor import SentenceTransformerRerank
from llama_index.finetuning.cross_encoders.dataset_gen import (
CrossEncoderFinetuningDatasetSample,
)
from llama_index.finetuning.types import BaseCrossEncoder... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-finetuning/llama_index/finetuning/cross_encoders/__init__.py | llama-index-finetuning/llama_index/finetuning/cross_encoders/__init__.py | """Init params."""
from llama_index.finetuning.cross_encoders.cross_encoder import (
CrossEncoderFinetuneEngine,
)
__all__ = ["CrossEncoderFinetuneEngine"]
| python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-finetuning/llama_index/finetuning/cross_encoders/dataset_gen.py | llama-index-finetuning/llama_index/finetuning/cross_encoders/dataset_gen.py | """Dataset Generator for Cross Encoder Finetuning."""
import re
import warnings
from dataclasses import dataclass
from typing import List, Optional
from llama_index.core import VectorStoreIndex, get_tokenizer
from llama_index.core.llms import ChatMessage
from llama_index.core.llms.llm import LLM
from llama_index.core... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-finetuning/llama_index/finetuning/rerankers/cohere_reranker.py | llama-index-finetuning/llama_index/finetuning/rerankers/cohere_reranker.py | """Cohere Reranker Finetuning Engine."""
import importlib.util
import os
from typing import Optional
from llama_index.finetuning.types import BaseCohereRerankerFinetuningEngine
from llama_index.postprocessor.cohere_rerank import CohereRerank
class CohereRerankerFinetuneEngine(BaseCohereRerankerFinetuningEngine):
... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-finetuning/llama_index/finetuning/rerankers/__init__.py | llama-index-finetuning/llama_index/finetuning/rerankers/__init__.py | """Init params."""
from llama_index.finetuning.rerankers.cohere_reranker import (
CohereRerankerFinetuneEngine,
)
from llama_index.finetuning.rerankers.dataset_gen import CohereRerankerFinetuneDataset
__all__ = ["CohereRerankerFinetuneEngine", "CohereRerankerFinetuneDataset"]
| python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-finetuning/llama_index/finetuning/rerankers/dataset_gen.py | llama-index-finetuning/llama_index/finetuning/rerankers/dataset_gen.py | import random
from typing import Any, List, Optional, Tuple
from llama_index.core.bridge.pydantic import BaseModel
from llama_index.core.indices.query.embedding_utils import get_top_k_embeddings
from llama_index.finetuning import EmbeddingQAFinetuneDataset
class CohereRerankerFinetuneDataset(BaseModel):
"""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/test_utils.py | llama-index-core/tests/test_utils.py | """Test utils."""
from pathlib import Path
from typing import Optional, Type, Union
from unittest import mock
import pytest
from _pytest.capture import CaptureFixture
from llama_index.core.utils import (
_ANSI_COLORS,
_LLAMA_INDEX_COLORS,
ErrorToRetry,
_get_colored_text,
get_cache_dir,
get_col... | python | MIT | 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/conftest.py | llama-index-core/tests/conftest.py | # pants requires this import to recognize the dep
import pytest_asyncio # noqa: F401
import os
# import socket
from typing import List, Optional
import openai
import pytest
from llama_index.core.base.llms.types import LLMMetadata
from llama_index.core.llms.mock import MockLLM
from llama_index.core.node_parser.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/test_async_utils.py | llama-index-core/tests/test_async_utils.py | import asyncio
import contextvars
import pytest
from llama_index.core.async_utils import batch_gather, asyncio_run
def test_batch_gather_indivisible_task_list() -> None:
"""
Test that batch_gather works with an task list of a
length that is not cleanly divisible by the batch size.
"""
async def a... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/tests/__init__.py | llama-index-core/tests/__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/node_parser/test_hierarchical.py | llama-index-core/tests/node_parser/test_hierarchical.py | import pytest
from llama_index.core import Document
from llama_index.core.node_parser import (
HierarchicalNodeParser,
get_child_nodes,
get_deeper_nodes,
get_leaf_nodes,
get_root_nodes,
)
ROOT_NODES_LEN = 1
CHILDREN_NODES_LEN = 3
GRAND_CHILDREN_NODES_LEN = 7
@pytest.fixture(scope="module")
def 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/node_parser/test_unstructured.py | llama-index-core/tests/node_parser/test_unstructured.py | import pytest
from llama_index.core.llms.mock import MockLLM
from llama_index.core.node_parser.relational.unstructured_element import (
UnstructuredElementNodeParser,
)
from llama_index.core.schema import Document, IndexNode, TextNode
try:
from unstructured.partition.html import partition_html
except ImportErr... | python | MIT | 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/node_parser/test_file.py | llama-index-core/tests/node_parser/test_file.py | from llama_index.core.schema import Document
from llama_index.core.node_parser import (
SimpleFileNodeParser,
)
def test_unsupported_extension() -> None:
simple_file_node_parser = SimpleFileNodeParser()
nodes = simple_file_node_parser._parse_nodes(
[
Document(
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/node_parser/test_html.py | llama-index-core/tests/node_parser/test_html.py | import importlib.util
import pytest
from llama_index.core.node_parser.file.html import HTMLNodeParser
from llama_index.core.schema import Document
@pytest.mark.xfail(
raises=ImportError,
reason="Requires beautifulsoup4.",
condition=importlib.util.find_spec("bs4") is None,
)
def test_no_splits() -> 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/node_parser/test_semantic_splitter.py | llama-index-core/tests/node_parser/test_semantic_splitter.py | from typing import List
from llama_index.core.base.embeddings.base import BaseEmbedding
from llama_index.core.node_parser.text.semantic_splitter import (
SemanticSplitterNodeParser,
)
from llama_index.core.schema import Document
class MockEmbedding(BaseEmbedding):
@classmethod
def class_name(cls) -> 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/node_parser/test_json.py | llama-index-core/tests/node_parser/test_json.py | from llama_index.core.node_parser.file.json import JSONNodeParser
from llama_index.core.schema import Document
def test_split_empty_text() -> None:
json_splitter = JSONNodeParser()
input_text = Document(text="")
result = json_splitter.get_nodes_from_documents([input_text])
assert result == []
def te... | python | MIT | 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/node_parser/test_markdown.py | llama-index-core/tests/node_parser/test_markdown.py | from llama_index.core.node_parser.file.markdown import MarkdownNodeParser
from llama_index.core.schema import Document
def test_header_splits() -> None:
markdown_parser = MarkdownNodeParser()
splits = markdown_parser.get_nodes_from_documents(
[
Document(
text="""# Main Hea... | python | MIT | 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/node_parser/test_duplicate_text_positions.py | llama-index-core/tests/node_parser/test_duplicate_text_positions.py | """Test that node parsers assign unique positions to duplicate text."""
from llama_index.core.node_parser import MarkdownNodeParser, SentenceSplitter
from llama_index.core.schema import Document, TextNode, MetadataMode
def _validate_nodes(nodes: list[TextNode], doc: Document) -> None:
"""Validate node positions:... | python | MIT | 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/node_parser/test_node_parser.py | llama-index-core/tests/node_parser/test_node_parser.py | from typing import Any, List, Sequence
from llama_index.core.node_parser import NodeParser
from llama_index.core.schema import BaseNode, TextNode, Document, NodeRelationship
class _TestNodeParser(NodeParser):
def _parse_nodes(
self, nodes: Sequence[BaseNode], show_progress: bool = False, **kwargs: Any
... | python | MIT | 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/node_parser/test_markdown_element.py | llama-index-core/tests/node_parser/test_markdown_element.py | from llama_index.core.llms.mock import MockLLM
from llama_index.core.node_parser.relational.markdown_element import (
MarkdownElementNodeParser,
)
from llama_index.core.schema import Document, IndexNode, TextNode
def test_md_table_extraction() -> None:
test_data = Document(
text="""
# This is a test
... | 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/tests/node_parser/test_semantic_double_merging_splitter.py | llama-index-core/tests/node_parser/test_semantic_double_merging_splitter.py | import pytest
from llama_index.core.node_parser.text.semantic_double_merging_splitter import (
SemanticDoubleMergingSplitterNodeParser,
LanguageConfig,
)
from llama_index.core.schema import Document
doc = Document(
text="Warsaw: Warsaw, the capital city of Poland, is a bustling metropolis located on the b... | python | MIT | dd5b31109cc8eb64411caf9fc1fa0f51e584c325 | 2026-01-04T14:39:40.052063Z | false |
run-llama/llama_index | https://github.com/run-llama/llama_index/blob/dd5b31109cc8eb64411caf9fc1fa0f51e584c325/llama-index-core/tests/node_parser/sentence_window.py | llama-index-core/tests/node_parser/sentence_window.py | from llama_index.core.node_parser.text.sentence_window import (
SentenceWindowNodeParser,
)
from llama_index.core.schema import Document
def test_split_and_window() -> None:
document = Document(text="This is a test 1. This is a test 2. This is a test 3.")
node_parser = SentenceWindowNodeParser.from_defau... | python | MIT | 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/node_parser/metadata_extractor.py | llama-index-core/tests/node_parser/metadata_extractor.py | from typing import List
from llama_index.core.extractors import (
KeywordExtractor,
QuestionsAnsweredExtractor,
SummaryExtractor,
TitleExtractor,
)
from llama_index.core.ingestion import run_transformations
from llama_index.core.node_parser import SentenceSplitter
from llama_index.core.schema import 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/storage/test_storage_context.py | llama-index-core/tests/storage/test_storage_context.py | from llama_index.core.data_structs.data_structs import IndexDict
from llama_index.core.schema import TextNode
from llama_index.core.storage.storage_context import StorageContext
def test_storage_context_dict() -> None:
storage_context = StorageContext.from_defaults()
# add
node = TextNode(text="test", em... | python | MIT | 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/storage/conftest.py | llama-index-core/tests/storage/conftest.py | import pytest
from llama_index.core.storage.kvstore.simple_kvstore import SimpleKVStore
@pytest.fixture()
def simple_kvstore() -> SimpleKVStore:
return SimpleKVStore()
| python | MIT | 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/storage/__init__.py | llama-index-core/tests/storage/__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/storage/kvstore/test_simple_kvstore.py | llama-index-core/tests/storage/kvstore/test_simple_kvstore.py | from pathlib import Path
import pytest
from llama_index.core.storage.kvstore.simple_kvstore import SimpleKVStore
@pytest.fixture()
def kvstore_with_data(simple_kvstore: SimpleKVStore) -> SimpleKVStore:
test_key = "test_key"
test_blob = {"test_obj_key": "test_obj_val"}
simple_kvstore.put(test_key, test_bl... | python | MIT | 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/storage/kvstore/test_mutable_mapping_kvstore.py | llama-index-core/tests/storage/kvstore/test_mutable_mapping_kvstore.py | import pytest
from llama_index.core.storage.kvstore.types import MutableMappingKVStore
from llama_index.core.storage.kvstore.simple_kvstore import SimpleKVStore
def test_simple_kvstore():
kv_store = SimpleKVStore()
assert isinstance(kv_store, MutableMappingKVStore)
kv_store.put(key="foo", val={"foo": "ba... | python | MIT | 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/storage/index_store/test_simple_index_store.py | llama-index-core/tests/storage/index_store/test_simple_index_store.py | from llama_index.core.data_structs.data_structs import IndexGraph
from llama_index.core.storage.index_store.simple_index_store import (
SimpleIndexStore,
)
def test_simple_index_store_dict() -> None:
index_struct = IndexGraph()
index_store = SimpleIndexStore()
index_store.add_index_struct(index_struct... | python | MIT | 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/storage/chat_store/test_sql.py | llama-index-core/tests/storage/chat_store/test_sql.py | import json
import pytest
from llama_index.core.base.llms.types import ChatMessage
from llama_index.core.storage.chat_store.sql import (
SQLAlchemyChatStore,
MessageStatus,
)
@pytest.fixture()
def chat_store() -> SQLAlchemyChatStore:
"""Create a SQLAlchemyChatStore for testing."""
return SQLAlchemyCh... | python | MIT | 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/storage/chat_store/test_sql_schema.py | llama-index-core/tests/storage/chat_store/test_sql_schema.py | """Tests for SQLAlchemyChatStore schema functionality."""
import pytest
from unittest.mock import AsyncMock, MagicMock
from llama_index.core.base.llms.types import ChatMessage
from llama_index.core.storage.chat_store.sql import SQLAlchemyChatStore
class TestSQLAlchemyChatStoreSchema:
"""Test schema functionalit... | python | MIT | 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/storage/chat_store/test_simple_chat_store.py | llama-index-core/tests/storage/chat_store/test_simple_chat_store.py | from llama_index.core.llms import ChatMessage
from llama_index.core.storage.chat_store import SimpleChatStore
def test_add_messages() -> None:
"""Test adding messages to a chat store."""
chat_store = SimpleChatStore()
chat_store.add_message("user1", ChatMessage(role="user", content="hello"))
chat_sto... | python | MIT | 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/storage/chat_store/__init__.py | llama-index-core/tests/storage/chat_store/__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/storage/docstore/test_simple_docstore.py | llama-index-core/tests/storage/docstore/test_simple_docstore.py | """Test docstore."""
from pathlib import Path
import pytest
from llama_index.core.schema import Document, TextNode, NodeRelationship
from llama_index.core.storage.docstore import SimpleDocumentStore
from llama_index.core.storage.kvstore.simple_kvstore import SimpleKVStore
@pytest.fixture()
def simple_docstore(simpl... | python | MIT | 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/storage/docstore/__init__.py | llama-index-core/tests/storage/docstore/__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/query_engine/test_retriever_query_engine.py | llama-index-core/tests/query_engine/test_retriever_query_engine.py | from llama_index.core import Document, TreeIndex
from llama_index.core.indices.tree.select_leaf_retriever import TreeSelectLeafRetriever
from llama_index.core.query_engine.retriever_query_engine import RetrieverQueryEngine
from llama_index.core import Settings
def test_query_engine_falls_back_to_inheriting_retrievers... | python | MIT | 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/query_engine/test_cogniswitch_query_engine.py | llama-index-core/tests/query_engine/test_cogniswitch_query_engine.py | from typing import Any
from unittest.mock import patch
import pytest
from llama_index.core.base.response.schema import Response
from llama_index.core.query_engine.cogniswitch_query_engine import (
CogniswitchQueryEngine,
)
@pytest.fixture()
def query_engine() -> CogniswitchQueryEngine:
return CogniswitchQuer... | python | MIT | 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/response_synthesizers/test_refine.py | llama-index-core/tests/response_synthesizers/test_refine.py | from collections import OrderedDict
from typing import Any, Dict, Optional, Type, cast
import pytest
from llama_index.core.bridge.pydantic import BaseModel
from llama_index.core.response_synthesizers import Refine
from llama_index.core.response_synthesizers.refine import StructuredRefineResponse
from llama_index.core.... | python | MIT | 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/response_synthesizers/__init__.py | llama-index-core/tests/response_synthesizers/__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/response_synthesizers/test_generate.py | llama-index-core/tests/response_synthesizers/test_generate.py | import pytest
from llama_index.core.llms import MockLLM
from llama_index.core.response_synthesizers.generation import Generation
def test_synthesize() -> None:
synthesizer = Generation(llm=MockLLM())
response = synthesizer.synthesize(query="test", nodes=[])
assert str(response) == "test"
def test_synth... | python | MIT | 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/ingestion/test_pipeline.py | llama-index-core/tests/ingestion/test_pipeline.py | from multiprocessing import cpu_count
from typing import Sequence, Any
import pytest
from llama_index.core.embeddings.mock_embed_model import MockEmbedding
from llama_index.core.extractors import KeywordExtractor
from llama_index.core.ingestion.pipeline import IngestionPipeline
from llama_index.core.llms.mock import M... | python | MIT | 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/ingestion/test_data_sinks.py | llama-index-core/tests/ingestion/test_data_sinks.py | import sys
from unittest.mock import MagicMock
import pytest
from llama_index.core.ingestion.data_sinks import (
ConfigurableDataSinks,
ConfiguredDataSink,
)
try:
from llama_index.vector_store.weaviate import WeaviateVectorStore
except ImportError:
WeaviateVectorStore = None
@pytest.mark.parametrize... | python | MIT | 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/ingestion/test_cache.py | llama-index-core/tests/ingestion/test_cache.py | from typing import Any, List
from llama_index.core.ingestion import IngestionCache
from llama_index.core.ingestion.pipeline import get_transformation_hash
from llama_index.core.schema import BaseNode, TextNode, TransformComponent
class DummyTransform(TransformComponent):
def __call__(self, nodes: List[BaseNode],... | python | MIT | 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/ingestion/test_transformations.py | llama-index-core/tests/ingestion/test_transformations.py | import pytest
from llama_index.core.ingestion.transformations import (
ConfigurableTransformations,
ConfiguredTransformation,
)
from llama_index.core.node_parser.text import SentenceSplitter, TokenTextSplitter
@pytest.mark.parametrize(
"configurable_transformation_type", ConfigurableTransformations
)
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/ingestion/test_data_sources.py | llama-index-core/tests/ingestion/test_data_sources.py | import pytest
from llama_index.core.ingestion.data_sources import (
ConfigurableDataSources,
ConfiguredDataSource,
)
from llama_index.core.schema import Document
@pytest.mark.parametrize("configurable_data_source_type", ConfigurableDataSources)
def test_can_generate_schema_for_data_source_component_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/tools/test_query_engine_tool.py | llama-index-core/tests/tools/test_query_engine_tool.py | """Test tools."""
from typing import Type, cast
import pytest
from llama_index.core.bridge.pydantic import BaseModel
from llama_index.core.query_engine.custom import CustomQueryEngine
from llama_index.core.tools.query_engine import QueryEngineTool
class MockQueryEngine(CustomQueryEngine):
"""Custom query engine... | python | MIT | 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/tools/test_utils.py | llama-index-core/tests/tools/test_utils.py | """Test utils."""
from typing import List, Annotated
import datetime
from llama_index.core.bridge.pydantic import Field
from llama_index.core.tools.utils import create_schema_from_function
def test_create_schema_from_function() -> None:
"""Test create schema from function."""
def test_fn(x: int, y: int, z:... | python | MIT | 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/tools/test_base.py | llama-index-core/tests/tools/test_base.py | """Test tools."""
import json
from typing import List, Optional
import pytest
from llama_index.core.bridge.pydantic import BaseModel, Field
from llama_index.core.llms import TextBlock, ImageBlock
from llama_index.core.tools.function_tool import FunctionTool
from llama_index.core.schema import Document, TextNode
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/tools/test_types.py | llama-index-core/tests/tools/test_types.py | import pytest
from llama_index.core.bridge.pydantic import BaseModel
from llama_index.core.program.function_program import get_function_tool
from llama_index.core.tools.types import ToolMetadata
class Inner(BaseModel):
name: str
class Outer(BaseModel):
inner: Inner
def test_toolmetadata_openai_tool_descr... | python | MIT | 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/tools/conftest.py | llama-index-core/tests/tools/conftest.py | """Conftest."""
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
doc_text = (
"Hello world.\nThis is a test.\nThis is another test.\nThis is a test v2."
)
... | python | MIT | 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/tools/test_eval_query_engine_tool.py | llama-index-core/tests/tools/test_eval_query_engine_tool.py | """Test EvalQueryEngine tool."""
from typing import Optional, Sequence, Any
from unittest import IsolatedAsyncioTestCase
from unittest.mock import AsyncMock
from llama_index.core.evaluation import EvaluationResult
from llama_index.core.evaluation.base import BaseEvaluator
from llama_index.core.prompts.mixin import 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/tools/test_ondemand_loader.py | llama-index-core/tests/tools/test_ondemand_loader.py | """Test ad-hoc loader Tool."""
from typing import List
import pytest
try:
import langchain # pants: no-infer-dep
except ImportError:
langchain = None # type: ignore
from llama_index.core.bridge.pydantic import BaseModel
from llama_index.core.indices.vector_store.base import VectorStoreIndex
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/tools/__init__.py | llama-index-core/tests/tools/__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/tools/test_retriever_tool.py | llama-index-core/tests/tools/test_retriever_tool.py | """Test retriever tool."""
from typing import List, Optional
from llama_index.core.base.base_retriever import BaseRetriever
from llama_index.core.schema import NodeWithScore, TextNode, QueryBundle
from llama_index.core.tools import RetrieverTool
from llama_index.core.postprocessor.types import BaseNodePostprocessor
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/tools/tool_spec/test_load_and_search.py | llama-index-core/tests/tools/tool_spec/test_load_and_search.py | """Test load and search tool spec."""
from typing import Any, List
import pytest
from unittest.mock import MagicMock, patch
from llama_index.core.bridge.pydantic import BaseModel
from llama_index.core.indices.vector_store import VectorStoreIndex
from llama_index.core.schema import Document
from llama_index.core.tools... | python | MIT | 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/tools/tool_spec/test_base.py | llama-index-core/tests/tools/tool_spec/test_base.py | """Test tool spec."""
from typing import List, Tuple, Union
import pytest
from llama_index.core.bridge.pydantic import BaseModel
from llama_index.core.tools.tool_spec.base import BaseToolSpec
from llama_index.core.tools.types import ToolMetadata
from llama_index.core.workflow import Context
class FooSchema(BaseMode... | python | MIT | 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/tools/tool_spec/__init__.py | llama-index-core/tests/tools/tool_spec/__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/sparse_embeddings/test_mock_sparse_embeddings.py | llama-index-core/tests/sparse_embeddings/test_mock_sparse_embeddings.py | import pytest
from llama_index.core.sparse_embeddings.mock_sparse_embedding import MockSparseEmbedding
text_embedding_map = {
"hello": {0: 0.25},
"world": {1: 0.5},
"foo": {2: 0.75},
}
@pytest.fixture()
def mock_sparse_embedding():
return MockSparseEmbedding(text_to_embedding=text_embedding_map)
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/sparse_embeddings/__init__.py | llama-index-core/tests/sparse_embeddings/__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/base/__init__.py | llama-index-core/tests/base/__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/base/llms/test_types.py | llama-index-core/tests/base/llms/test_types.py | import base64
from io import BytesIO
from pathlib import Path
from unittest import mock
import pytest
import httpx
from llama_index.core.base.llms.types import (
ChatMessage,
ChatResponse,
CompletionResponse,
ImageBlock,
MessageRole,
TextBlock,
DocumentBlock,
VideoBlock,
AudioBlock,... | python | MIT | 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/base/llms/__init__.py | llama-index-core/tests/base/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/token_predictor/test_base.py | llama-index-core/tests/token_predictor/test_base.py | """Test token predictor."""
from typing import Any
from unittest.mock import patch
from llama_index.core.indices.keyword_table.base import KeywordTableIndex
from llama_index.core.indices.list.base import SummaryIndex
from llama_index.core.indices.tree.base import TreeIndex
from llama_index.core.node_parser import Tok... | python | MIT | 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/token_predictor/__init__.py | llama-index-core/tests/token_predictor/__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/chat_engine/test_multi_modal_context.py | llama-index-core/tests/chat_engine/test_multi_modal_context.py | import pytest
from llama_index.core import MockEmbedding
from llama_index.core.embeddings import MockMultiModalEmbedding
from llama_index.core.chat_engine.multi_modal_context import (
MultiModalContextChatEngine,
)
from llama_index.core.indices import MultiModalVectorStoreIndex
from llama_index.core.llms.mock 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/chat_engine/test_context.py | llama-index-core/tests/chat_engine/test_context.py | import pytest
from llama_index.core import MockEmbedding
from llama_index.core.chat_engine.context import (
ContextChatEngine,
)
from llama_index.core.indices import VectorStoreIndex
from llama_index.core.llms.mock import MockLLM
from llama_index.core.schema import Document, QueryBundle
SYSTEM_PROMPT = "Talk like... | python | MIT | 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/__init__.py | llama-index-core/tests/chat_engine/__init__.py | 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.