sample_id stringlengths 21 196 | text stringlengths 105 936k | metadata dict | category stringclasses 6
values |
|---|---|---|---|
run-llama/llama_index:llama-index-integrations/tools/llama-index-tools-jira-issue/tests/test_tools_jira_issue.py | """Unit tests for JiraIssueToolSpec."""
from unittest.mock import Mock, patch
import pytest
from llama_index.core.tools.tool_spec.base import BaseToolSpec
from llama_index.tools.jira_issue.base import JiraIssueToolSpec
def test_class():
names_of_base_classes = [b.__name__ for b in JiraIssueToolSpec.__mro__]
... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/tools/llama-index-tools-jira-issue/tests/test_tools_jira_issue.py",
"license": "MIT License",
"lines": 220,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"temp... | test |
run-llama/llama_index:llama-index-integrations/readers/llama-index-readers-web/tests/test_async_web.py | import pytest
from llama_index.readers.web import AsyncWebPageReader
@pytest.fixture()
def url() -> str:
return "https://llamaindex.ai/"
def test_async_web_reader(url: str) -> None:
documents = AsyncWebPageReader().load_data(urls=[url])
assert len(documents) > 0
assert isinstance(documents[0].id_, ... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/readers/llama-index-readers-web/tests/test_async_web.py",
"license": "MIT License",
"lines": 11,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
run-llama/llama_index:llama-index-integrations/vector_stores/llama-index-vector-stores-s3/llama_index/vector_stores/s3/base.py | """
S3 vector store index.
An index that is built on top of an existing S3Vectors collection.
"""
import asyncio
import boto3
import logging
import time
from typing import Any, List, Optional, Tuple
from llama_index.core.bridge.pydantic import Field, PrivateAttr
from llama_index.core.schema import BaseNode, TextNod... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/vector_stores/llama-index-vector-stores-s3/llama_index/vector_stores/s3/base.py",
"license": "MIT License",
"lines": 508,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition... | function_complex |
run-llama/llama_index:llama-index-integrations/vector_stores/llama-index-vector-stores-s3/tests/test_s3_vector_store.py | import boto3
import os
from llama_index.core.vector_stores.types import VectorStoreQuery
import pytest
import uuid
from typing import List
from llama_index.core.schema import TextNode
from llama_index.core.vector_stores.types import MetadataFilters, MetadataFilter
from llama_index.vector_stores.s3 import S3VectorStore... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/vector_stores/llama-index-vector-stores-s3/tests/test_s3_vector_store.py",
"license": "MIT License",
"lines": 132,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
... | test |
run-llama/llama_index:llama-index-integrations/readers/llama-index-readers-service-now/llama_index/readers/service_now/base.py | import logging
import os
from typing import Callable, Dict, List, Optional
import uuid
from llama_index.core.readers.base import BaseReader
from llama_index.core.schema import Document
from llama_index.core.instrumentation import get_dispatcher
from pysnc import GlideRecord, ServiceNowClient
from pysnc.auth import Serv... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/readers/llama-index-readers-service-now/llama_index/readers/service_now/base.py",
"license": "MIT License",
"lines": 636,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition... | function_complex |
run-llama/llama_index:llama-index-integrations/readers/llama-index-readers-service-now/llama_index/readers/service_now/event.py | from llama_index.core.instrumentation.events.base import BaseEvent
from typing import Dict, Any
from enum import Enum
from llama_index.core.schema import Document
from pydantic import Field
class FileType(Enum):
IMAGE = "image"
DOCUMENT = "document"
TEXT = "text"
HTML = "html"
CSV = "csv"
MARK... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/readers/llama-index-readers-service-now/llama_index/readers/service_now/event.py",
"license": "MIT License",
"lines": 74,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition... | function_simple |
run-llama/llama_index:llama-index-integrations/readers/llama-index-readers-service-now/tests/test_snow_kb_reader.py | """Tests for ServiceNow Knowledge Base Reader."""
import sys
from unittest.mock import MagicMock, patch
import pytest
from llama_index.core.schema import Document
from llama_index.core.readers.base import BaseReader
class MockCustomParser(BaseReader):
"""Mock custom parser for testing."""
def load_data(self... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/readers/llama-index-readers-service-now/tests/test_snow_kb_reader.py",
"license": "MIT License",
"lines": 505,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"t... | test |
run-llama/llama_index:llama-index-integrations/llms/llama-index-llms-cloudflare-ai-gateway/llama_index/llms/cloudflare_ai_gateway/base.py | """
Cloudflare AI Gateway LLM integration.
This module provides integration with Cloudflare AI Gateway, allowing you to
use multiple AI models from different providers with automatic fallback.
"""
import json
from typing import Any, Dict, List, Optional, Sequence, Union
import logging
import httpx
from llama_index.c... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/llms/llama-index-llms-cloudflare-ai-gateway/llama_index/llms/cloudflare_ai_gateway/base.py",
"license": "MIT License",
"lines": 439,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
... | function_complex |
run-llama/llama_index:llama-index-integrations/llms/llama-index-llms-cloudflare-ai-gateway/tests/test_cloudflare_ai_gateway.py | import os
import pytest
from dotenv import load_dotenv
from llama_index.core.llms import ChatMessage
from llama_index.llms.cloudflare_ai_gateway import CloudflareAIGateway
# Load .env file
load_dotenv()
@pytest.mark.skipif(
not all(
[
os.getenv("OPENAI_API_KEY"),
os.getenv("ANTHRO... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/llms/llama-index-llms-cloudflare-ai-gateway/tests/test_cloudflare_ai_gateway.py",
"license": "MIT License",
"lines": 344,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition... | test |
run-llama/llama_index:llama-index-integrations/readers/llama-index-readers-confluence/llama_index/readers/confluence/event.py | from enum import Enum
from llama_index.core.schema import Document
from llama_index.core.instrumentation.events.base import BaseEvent
class FileType(Enum):
IMAGE = "image"
DOCUMENT = "document"
TEXT = "text"
HTML = "html"
CSV = "csv"
MARKDOWN = "md"
SPREADSHEET = "spreadsheet"
PRESENTA... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/readers/llama-index-readers-confluence/llama_index/readers/confluence/event.py",
"license": "MIT License",
"lines": 93,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition":... | function_simple |
run-llama/llama_index:llama-index-integrations/readers/llama-index-readers-confluence/tests/run_basic_tests.py | #!/usr/bin/env python3
"""
Simple test runner to verify the new ConfluenceReader features.
Run this script to test the new functionality without requiring pytest installation.
"""
import sys
import os
import traceback
from unittest.mock import MagicMock
# Add the package to the path
sys.path.insert(0, os.path.join(os... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/readers/llama-index-readers-confluence/tests/run_basic_tests.py",
"license": "MIT License",
"lines": 146,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"templa... | test |
run-llama/llama_index:llama-index-integrations/readers/llama-index-readers-confluence/tests/test_integration.py | """Integration test demonstrating all new ConfluenceReader features working together."""
from unittest.mock import MagicMock, patch
import tempfile
from llama_index.readers.confluence import ConfluenceReader
from llama_index.readers.confluence.event import (
FileType,
TotalPagesToProcessEvent,
PageDataFet... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/readers/llama-index-readers-confluence/tests/test_integration.py",
"license": "MIT License",
"lines": 214,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"templ... | test |
run-llama/llama_index:llama-index-integrations/readers/llama-index-readers-confluence/tests/test_new_features.py | """Tests for new ConfluenceReader features: callbacks, custom parsers, event system."""
from unittest.mock import Mock, MagicMock, patch
import pytest
import os
from llama_index.readers.confluence import ConfluenceReader
from llama_index.readers.confluence.event import (
FileType,
PageDataFetchStartedEvent,
... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/readers/llama-index-readers-confluence/tests/test_new_features.py",
"license": "MIT License",
"lines": 385,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"temp... | test |
run-llama/llama_index: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... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-core/tests/agent/workflow/test_function_call.py",
"license": "MIT License",
"lines": 386,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
run-llama/llama_index: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... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-core/tests/agent/workflow/test_return_direct_e2e.py",
"license": "MIT License",
"lines": 64,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
run-llama/llama_index:llama-index-integrations/vector_stores/llama-index-vector-stores-moorcheh/llama_index/vector_stores/moorcheh/base.py | # Importing required libraries and modules
import logging
from typing import Any, List, Optional, Callable, ClassVar, Literal
import uuid
import os
# LlamaIndex internals for schema and vector store support
from llama_index.core.schema import BaseNode, MetadataMode, TextNode
from llama_index.core.llms import LLM
from ... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/vector_stores/llama-index-vector-stores-moorcheh/llama_index/vector_stores/moorcheh/base.py",
"license": "MIT License",
"lines": 400,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
... | function_complex |
run-llama/llama_index:llama-index-integrations/vector_stores/llama-index-vector-stores-moorcheh/llama_index/vector_stores/moorcheh/utils.py | from collections import Counter
from typing import Callable, List
from llama_index.core.bridge.pydantic import Field
from llama_index.core.base.embeddings.base_sparse import (
BaseSparseEmbedding,
SparseEmbedding,
)
def get_default_tokenizer() -> Callable:
try:
from transformers import BertTokeni... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/vector_stores/llama-index-vector-stores-moorcheh/llama_index/vector_stores/moorcheh/utils.py",
"license": "MIT License",
"lines": 54,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
... | function_simple |
run-llama/llama_index:llama-index-integrations/vector_stores/llama-index-vector-stores-moorcheh/tests/test_vector_stores_moorcheh.py | # Test.py
import os
import pytest
import time
import uuid
from typing import List
from llama_index.core import StorageContext, VectorStoreIndex
from llama_index.core.embeddings import MockEmbedding
from llama_index.core.schema import TextNode
from llama_index.core.vector_stores.types import (
BasePydanticVectorSt... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/vector_stores/llama-index-vector-stores-moorcheh/tests/test_vector_stores_moorcheh.py",
"license": "MIT License",
"lines": 427,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repe... | test |
run-llama/llama_index:llama-index-integrations/readers/llama-index-readers-web/tests/test_simple_webreader.py | import pytest
from llama_index.readers.web import SimpleWebPageReader
@pytest.fixture()
def url() -> str:
return "https://docs.llamaindex.ai/en/stable/module_guides/workflow/"
def test_simple_web_reader(url: str) -> None:
documents = SimpleWebPageReader().load_data(urls=[url])
assert len(documents) > 0... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/readers/llama-index-readers-web/tests/test_simple_webreader.py",
"license": "MIT License",
"lines": 11,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template... | test |
run-llama/llama_index: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... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-core/tests/agent/utils/test_agent_utils.py",
"license": "MIT License",
"lines": 156,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
run-llama/llama_index: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... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-core/tests/agent/workflow/test_agent_with_structured_output.py",
"license": "MIT License",
"lines": 345,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
run-llama/llama_index: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... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-core/tests/vector_stores/test_utils.py",
"license": "MIT License",
"lines": 77,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
run-llama/llama_index:llama-index-integrations/postprocessor/llama-index-postprocessor-flashrank-rerank/llama_index/postprocessor/flashrank_rerank/base.py | from typing import Any
from typing_extensions import override
from flashrank import Ranker, RerankRequest
import llama_index.core.instrumentation as instrument
from llama_index.core.bridge.pydantic import Field, PrivateAttr
from llama_index.core.postprocessor.types import BaseNodePostprocessor
from llama_index.core.s... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/postprocessor/llama-index-postprocessor-flashrank-rerank/llama_index/postprocessor/flashrank_rerank/base.py",
"license": "MIT License",
"lines": 79,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_... | function_simple |
run-llama/llama_index:llama-index-integrations/postprocessor/llama-index-postprocessor-flashrank-rerank/tests/test_postprocessor_flashrank_rerank.py | from llama_index.core.schema import (
MediaResource,
Node,
NodeWithScore,
QueryBundle,
)
from llama_index.postprocessor.flashrank_rerank import FlashRankRerank
def test_init():
reranker = FlashRankRerank()
assert reranker is not None
def test_postprocess_nodes():
reranker = FlashRankRera... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/postprocessor/llama-index-postprocessor-flashrank-rerank/tests/test_postprocessor_flashrank_rerank.py",
"license": "MIT License",
"lines": 48,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_patter... | test |
run-llama/llama_index:llama-index-integrations/storage/docstore/llama-index-storage-docstore-duckdb/llama_index/storage/docstore/duckdb/base.py | from typing import Optional
from llama_index.core.storage.docstore.keyval_docstore import KVDocumentStore
from llama_index.core.storage.docstore.types import DEFAULT_BATCH_SIZE
from llama_index.storage.kvstore.duckdb import DuckDBKVStore
class DuckDBDocumentStore(KVDocumentStore):
"""
DuckDB Document (Node) ... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/storage/docstore/llama-index-storage-docstore-duckdb/llama_index/storage/docstore/duckdb/base.py",
"license": "MIT License",
"lines": 22,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "... | function_simple |
run-llama/llama_index:llama-index-integrations/storage/docstore/llama-index-storage-docstore-duckdb/tests/test_storage_docstore_duckdb.py | from llama_index.core.storage.docstore.keyval_docstore import KVDocumentStore
from llama_index.storage.docstore.duckdb import DuckDBDocumentStore
def test_class():
names_of_base_classes = [b.__name__ for b in DuckDBDocumentStore.__mro__]
assert KVDocumentStore.__name__ in names_of_base_classes
| {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/storage/docstore/llama-index-storage-docstore-duckdb/tests/test_storage_docstore_duckdb.py",
"license": "MIT License",
"lines": 5,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"r... | test |
run-llama/llama_index:llama-index-integrations/storage/index_store/llama-index-storage-index-store-duckdb/llama_index/storage/index_store/duckdb/base.py | from typing import Optional
from llama_index.core.storage.index_store.keyval_index_store import (
KVIndexStore,
DEFAULT_COLLECTION_SUFFIX,
)
from llama_index.storage.kvstore.duckdb import DuckDBKVStore
class DuckDBIndexStore(KVIndexStore):
"""
DuckDB Index store.
Args:
duckdb_kvstore (Du... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/storage/index_store/llama-index-storage-index-store-duckdb/llama_index/storage/index_store/duckdb/base.py",
"license": "MIT License",
"lines": 26,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pa... | function_simple |
run-llama/llama_index:llama-index-integrations/storage/index_store/llama-index-storage-index-store-duckdb/tests/test_storage_index_store_duckdb.py | from llama_index.core.storage.index_store.keyval_index_store import KVIndexStore
from llama_index.storage.index_store.duckdb import DuckDBIndexStore
def test_class():
names_of_base_classes = [b.__name__ for b in DuckDBIndexStore.__mro__]
assert KVIndexStore.__name__ in names_of_base_classes
| {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/storage/index_store/llama-index-storage-index-store-duckdb/tests/test_storage_index_store_duckdb.py",
"license": "MIT License",
"lines": 5,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern":... | test |
run-llama/llama_index:llama-index-integrations/storage/kvstore/llama-index-storage-kvstore-duckdb/llama_index/storage/kvstore/duckdb/base.py | import asyncio
import json
import logging
import threading
from pathlib import Path
from typing import Any, Optional
from typing_extensions import override
import duckdb
import pyarrow
from duckdb import (
ColumnExpression,
ConstantExpression,
Expression,
)
from llama_index.core.storage.kvstore.types impor... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/storage/kvstore/llama-index-storage-kvstore-duckdb/llama_index/storage/kvstore/duckdb/base.py",
"license": "MIT License",
"lines": 269,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",... | function_complex |
run-llama/llama_index:llama-index-integrations/storage/kvstore/llama-index-storage-kvstore-duckdb/tests/test_storage_kvstore_duckdb.py | import os
from llama_index.core.storage.kvstore.types import BaseKVStore
from llama_index.storage.kvstore.duckdb import DuckDBKVStore
from llama_index.vector_stores.duckdb.base import DuckDBVectorStore
import pytest
def test_class():
names_of_base_classes = [b.__name__ for b in DuckDBKVStore.__mro__]
assert B... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/storage/kvstore/llama-index-storage-kvstore-duckdb/tests/test_storage_kvstore_duckdb.py",
"license": "MIT License",
"lines": 105,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"re... | test |
run-llama/llama_index:llama-index-integrations/llms/llama-index-llms-nvidia/tests/test_unknown_models.py | import pytest
from unittest.mock import patch, MagicMock
from llama_index.llms.nvidia import NVIDIA
@pytest.mark.parametrize("is_chat_model", [True, False])
def test_unknown_model_is_chat_model_parameter(is_chat_model) -> None:
"""Test that is_chat_model parameter is respected for unknown models."""
mock_mode... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/llms/llama-index-llms-nvidia/tests/test_unknown_models.py",
"license": "MIT License",
"lines": 35,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""... | test |
run-llama/llama_index: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... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-core/tests/agent/workflow/test_events.py",
"license": "MIT License",
"lines": 107,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
run-llama/llama_index:llama-index-integrations/indices/llama-index-indices-managed-lancedb/llama_index/indices/managed/lancedb/base.py | import lancedb
import json
import polars as pl
import pandas as pd
import pyarrow as pa
import warnings
import httpx
from lancedb.pydantic import LanceModel, Vector
from pydantic import Field
from lancedb import DBConnection, AsyncConnection
from lancedb.table import Table, AsyncTable
from lancedb.rerankers import Rer... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/indices/llama-index-indices-managed-lancedb/llama_index/indices/managed/lancedb/base.py",
"license": "MIT License",
"lines": 696,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"re... | function_complex |
run-llama/llama_index:llama-index-integrations/indices/llama-index-indices-managed-lancedb/llama_index/indices/managed/lancedb/query_engine.py | import os
from PIL import Image
from llama_index.core.query_engine.retriever_query_engine import (
RetrieverQueryEngine,
)
from llama_index.core.response_synthesizers import BaseSynthesizer
from llama_index.core.postprocessor.types import BaseNodePostprocessor
from llama_index.core.callbacks.schema import CBEvent... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/indices/llama-index-indices-managed-lancedb/llama_index/indices/managed/lancedb/query_engine.py",
"license": "MIT License",
"lines": 130,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "... | function_simple |
run-llama/llama_index:llama-index-integrations/indices/llama-index-indices-managed-lancedb/llama_index/indices/managed/lancedb/retriever.py | import os
from lancedb.table import Table, AsyncTable
from PIL import Image
from dataclasses import dataclass
from .utils import query_multimodal, query_text, aquery_multimodal, aquery_text
from llama_index.core.llms import ImageBlock
from llama_index.core.schema import ImageDocument
from llama_index.core.retrievers i... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/indices/llama-index-indices-managed-lancedb/llama_index/indices/managed/lancedb/retriever.py",
"license": "MIT License",
"lines": 147,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
... | function_complex |
run-llama/llama_index:llama-index-integrations/indices/llama-index-indices-managed-lancedb/llama_index/indices/managed/lancedb/utils.py | from lancedb.embeddings import get_registry, EmbeddingFunction
from lancedb.table import Table, AsyncTable
from lancedb.index import IvfPq, IvfFlat, HnswPq, HnswSq, BTree, Bitmap, LabelList, FTS
import httpx
from PIL import Image
import io
import os
from llama_index.core.bridge.pydantic import BaseModel, Field, model_... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/indices/llama-index-indices-managed-lancedb/llama_index/indices/managed/lancedb/utils.py",
"license": "MIT License",
"lines": 335,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"r... | function_complex |
run-llama/llama_index:llama-index-integrations/indices/llama-index-indices-managed-lancedb/tests/test_index.py | import pytest
import shutil
import os
import requests
import uuid
from lancedb import AsyncConnection, DBConnection
from lancedb.table import AsyncTable, Table
from typing import Generator
import pandas as pd
from llama_index.indices.managed.lancedb.retriever import LanceDBRetriever
from llama_index.indices.managed.la... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/indices/llama-index-indices-managed-lancedb/tests/test_index.py",
"license": "MIT License",
"lines": 138,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"templa... | test |
run-llama/llama_index:llama-index-integrations/voice_agents/llama-index-voice-agents-elevenlabs/llama_index/voice_agents/elevenlabs/events.py | from llama_index.core.voice_agents import BaseVoiceAgentEvent
from llama_index.core.bridge.pydantic import ConfigDict
from typing import Union, Any
class ConversationInitEvent(BaseVoiceAgentEvent):
model_config = ConfigDict(extra="allow")
conversation_id: str
class AudioEvent(BaseVoiceAgentEvent):
mode... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/voice_agents/llama-index-voice-agents-elevenlabs/llama_index/voice_agents/elevenlabs/events.py",
"license": "MIT License",
"lines": 28,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",... | function_simple |
run-llama/llama_index:llama-index-integrations/voice_agents/llama-index-voice-agents-elevenlabs/llama_index/voice_agents/elevenlabs/interface.py | from llama_index.core.voice_agents.interface import BaseVoiceAgentInterface
from elevenlabs.conversational_ai.default_audio_interface import DefaultAudioInterface
class ElevenLabsVoiceAgentInterface(DefaultAudioInterface, BaseVoiceAgentInterface):
def __init__(self, *args, **kwargs):
super().__init__()
... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/voice_agents/llama-index-voice-agents-elevenlabs/llama_index/voice_agents/elevenlabs/interface.py",
"license": "MIT License",
"lines": 12,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": ... | function_simple |
run-llama/llama_index:llama-index-integrations/voice_agents/llama-index-voice-agents-elevenlabs/tests/test_events.py | from llama_index.voice_agents.elevenlabs.events import (
PingEvent,
AudioEvent,
AgentResponseEvent,
AgentResponseCorrectionEvent,
UserTranscriptionEvent,
InterruptionEvent,
ConversationInitEvent,
ClientToolCallEvent,
)
from llama_index.core.voice_agents import BaseVoiceAgentEvent
def t... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/voice_agents/llama-index-voice-agents-elevenlabs/tests/test_events.py",
"license": "MIT License",
"lines": 40,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"t... | test |
run-llama/llama_index:llama-index-core/llama_index/core/chat_ui/events.py | from typing import Any, List
from llama_index.core.chat_ui.models.artifact import Artifact
from llama_index.core.schema import NodeWithScore
from llama_index.core.workflow.events import Event
class UIEvent(Event):
type: str
data: Any
class SourceNodesEvent(Event):
nodes: List[NodeWithScore]
class Art... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-core/llama_index/core/chat_ui/events.py",
"license": "MIT License",
"lines": 12,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
run-llama/llama_index:llama-index-core/llama_index/core/chat_ui/models/artifact.py | from enum import Enum
from typing import List, Literal, Optional, Union
from pydantic import BaseModel
class ArtifactType(str, Enum):
CODE = "code"
DOCUMENT = "document"
class CodeArtifactData(BaseModel):
file_name: str
code: str
language: str
class DocumentArtifactSource(BaseModel):
id: ... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-core/llama_index/core/chat_ui/models/artifact.py",
"license": "MIT License",
"lines": 21,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
run-llama/llama_index:llama-index-core/llama_index/core/voice_agents/base.py | from typing import Optional, Any, Callable, List
from abc import ABC, abstractmethod
from .websocket import BaseVoiceAgentWebsocket
from .interface import BaseVoiceAgentInterface
from .events import BaseVoiceAgentEvent
from llama_index.core.llms import ChatMessage
from llama_index.core.tools import BaseTool
... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-core/llama_index/core/voice_agents/base.py",
"license": "MIT License",
"lines": 130,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | documentation |
run-llama/llama_index:llama-index-core/llama_index/core/voice_agents/events.py | from llama_index.core.bridge.pydantic import BaseModel, Field
class BaseVoiceAgentEvent(BaseModel):
"""
Base class to represent events in Voice Agents conversations.
Attributes:
type_t (str): Event type (serialized as 'type')
"""
type_t: str = Field(serialization_alias="type... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-core/llama_index/core/voice_agents/events.py",
"license": "MIT License",
"lines": 8,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | documentation |
run-llama/llama_index:llama-index-core/llama_index/core/voice_agents/interface.py | from typing import Any
from abc import ABC, abstractmethod
class BaseVoiceAgentInterface(ABC):
"""
Abstract base class for a voice agent audio input/output interface.
"""
@abstractmethod
def __init__(self, *args: Any, **kwargs: Any) -> None:
"""Please implement this method by i... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-core/llama_index/core/voice_agents/interface.py",
"license": "MIT License",
"lines": 86,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | documentation |
run-llama/llama_index:llama-index-core/llama_index/core/voice_agents/websocket.py | from abc import ABC, abstractmethod
from typing import Optional, Any, TYPE_CHECKING
if TYPE_CHECKING:
from websockets.asyncio.client import ClientConnection
class BaseVoiceAgentWebsocket(ABC):
"""
Abstract base class for a voice agent websocket.
Attributes:
uri (str): URL of the ... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-core/llama_index/core/voice_agents/websocket.py",
"license": "MIT License",
"lines": 57,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | documentation |
run-llama/llama_index:llama-index-core/tests/voice_agents/test_event_serialization.py | import pytest
from typing import Dict
from llama_index.core.voice_agents.events import BaseVoiceAgentEvent
@pytest.fixture()
def json_event() -> Dict[str, str]:
return {"type": "text"}
def test_event_serialization(json_event: Dict[str, str]) -> None:
assert BaseVoiceAgentEvent(type_t="text").mo... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-core/tests/voice_agents/test_event_serialization.py",
"license": "MIT License",
"lines": 8,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
run-llama/llama_index:llama-index-core/tests/voice_agents/test_subclasses.py | import pytest
from typing import List, Any, Union, Optional, Iterable, AsyncIterable
from llama_index.core.voice_agents import (
BaseVoiceAgent,
BaseVoiceAgentInterface,
BaseVoiceAgentWebsocket,
BaseVoiceAgentEvent,
)
from llama_index.core.llms import ChatMessage
# Try to import websockets de... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-core/tests/voice_agents/test_subclasses.py",
"license": "MIT License",
"lines": 186,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
run-llama/llama_index:llama-index-integrations/voice_agents/llama-index-voice-agents-openai/llama_index/voice_agents/openai/audio_interface.py | import pyaudio
import queue
import time
import logging
import threading
import asyncio
from typing import Callable, Optional, Any, Tuple, Union
from llama_index.core.voice_agents import BaseVoiceAgentInterface
logging.basicConfig(
level=logging.INFO, format="%(asctime)s [%(levelname)s] %(message)s"
)
... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/voice_agents/llama-index-voice-agents-openai/llama_index/voice_agents/openai/audio_interface.py",
"license": "MIT License",
"lines": 106,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "... | function_simple |
run-llama/llama_index:llama-index-integrations/voice_agents/llama-index-voice-agents-openai/llama_index/voice_agents/openai/base.py | import base64
import logging
import os
import threading
from typing import List, Optional, Dict, Any
from .types import (
ConversationInputEvent,
ConversationDeltaEvent,
ConversationDoneEvent,
ConversationSessionUpdate,
ConversationSession,
ConversationTool,
ToolParameters,
... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/voice_agents/llama-index-voice-agents-openai/llama_index/voice_agents/openai/base.py",
"license": "MIT License",
"lines": 261,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repet... | function_complex |
run-llama/llama_index:llama-index-integrations/voice_agents/llama-index-voice-agents-openai/llama_index/voice_agents/openai/types.py | import base64
import binascii
import json
from typing import Union, List, Dict, Literal, Optional, Any
from typing_extensions import Self
from llama_index.core.voice_agents import BaseVoiceAgentEvent
from llama_index.core.bridge.pydantic import BaseModel, Field, model_validator
class ConversationVAD(BaseMo... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/voice_agents/llama-index-voice-agents-openai/llama_index/voice_agents/openai/types.py",
"license": "MIT License",
"lines": 86,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repet... | function_simple |
run-llama/llama_index:llama-index-integrations/voice_agents/llama-index-voice-agents-openai/llama_index/voice_agents/openai/utils.py | from llama_index.core.tools import BaseTool
from typing import List, Union
def get_tool_by_name(tools: List[BaseTool], name: str) -> Union[BaseTool, None]:
for tool in tools:
if tool.metadata.get_name() == name:
return tool
return None
| {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/voice_agents/llama-index-voice-agents-openai/llama_index/voice_agents/openai/utils.py",
"license": "MIT License",
"lines": 7,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repeti... | function_simple |
run-llama/llama_index:llama-index-integrations/voice_agents/llama-index-voice-agents-openai/llama_index/voice_agents/openai/websocket.py | import threading
import json
import logging
import asyncio
import websockets
from websockets import ConnectionClosedError
from typing import Optional, Callable, Any
from llama_index.core.voice_agents import BaseVoiceAgentWebsocket
logging.basicConfig(
level=logging.INFO, format="%(asctime)s [%(levelnam... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/voice_agents/llama-index-voice-agents-openai/llama_index/voice_agents/openai/websocket.py",
"license": "MIT License",
"lines": 105,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"... | function_complex |
run-llama/llama_index:llama-index-integrations/voice_agents/llama-index-voice-agents-openai/tests/test_serialization.py | import pytest
from llama_index.voice_agents.openai.types import (
ConversationDeltaEvent,
ConversationDoneEvent,
ConversationSession,
ConversationSessionUpdate,
)
@pytest.fixture()
def session_json() -> dict:
return {
"modalities": ["text", "audio"],
"instructions": ... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/voice_agents/llama-index-voice-agents-openai/tests/test_serialization.py",
"license": "MIT License",
"lines": 64,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
... | test |
run-llama/llama_index:llama-index-integrations/voice_agents/llama-index-voice-agents-openai/tests/test_utils.py | import pytest
from llama_index.voice_agents.openai.utils import get_tool_by_name
from llama_index.core.tools import FunctionTool
from typing import List
@pytest.fixture()
def function_tools() -> List[FunctionTool]:
def add(i: int, j: int) -> int:
return i + j
def greet(name: str) -> str:
ret... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/voice_agents/llama-index-voice-agents-openai/tests/test_utils.py",
"license": "MIT License",
"lines": 28,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"templa... | test |
run-llama/llama_index:llama-index-integrations/vector_stores/llama-index-vector-stores-db2/llama_index/vector_stores/db2/base.py | # OopCompanion:suppressRename
from __future__ import annotations
import functools
import json
import logging
import math
import os
from enum import Enum
from typing import (
TYPE_CHECKING,
Any,
Callable,
Dict,
List,
Optional,
Type,
TypeVar,
cast,
)
from llama_index.core.schema impo... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/vector_stores/llama-index-vector-stores-db2/llama_index/vector_stores/db2/base.py",
"license": "MIT License",
"lines": 371,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetiti... | function_complex |
run-llama/llama_index:llama-index-integrations/vector_stores/llama-index-vector-stores-db2/tests/test_vector_stores_db2.py | from llama_index.core.vector_stores.types import BasePydanticVectorStore
from llama_index.vector_stores.db2 import (
DB2LlamaVS,
create_table,
table_exists,
drop_table,
DistanceStrategy,
)
from llama_index.core.schema import NodeRelationship, RelatedNodeInfo, TextNode
from llama_index.core.vector_s... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/vector_stores/llama-index-vector-stores-db2/tests/test_vector_stores_db2.py",
"license": "MIT License",
"lines": 407,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -... | test |
run-llama/llama_index:llama-index-integrations/tools/llama-index-tools-hive/examples/hive_demo.py | from llama_index.tools.hive import HiveToolSpec, HiveSearchMessage
hive_tool = HiveToolSpec(api_key="add_your_hive_api_key")
# Simple prompt query
results = hive_tool.search(
prompt="What is the current price of Ethereum?",
include_data_sources=True
)
print("results ", results)
# Chat-style conversation
cha... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/tools/llama-index-tools-hive/examples/hive_demo.py",
"license": "MIT License",
"lines": 19,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
run-llama/llama_index:llama-index-integrations/tools/llama-index-tools-hive/llama_index/tools/hive/base.py | from typing import Optional, List
from llama_index.core.tools.tool_spec.base import BaseToolSpec
from hive_intelligence.client import HiveSearchClient
from hive_intelligence.types import (
HiveSearchRequest,
HiveSearchMessage,
HiveSearchResponse,
)
from hive_intelligence.errors import HiveSearchAPIError
c... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/tools/llama-index-tools-hive/llama_index/tools/hive/base.py",
"license": "MIT License",
"lines": 51,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ... | function_simple |
run-llama/llama_index:llama-index-integrations/vector_stores/llama-index-vector-stores-openGauss/llama_index/vector_stores/openGauss/base.py | import logging
from llama_index.vector_stores.postgres.base import PGVectorStore
from typing import (
Any,
NamedTuple,
Type,
Optional,
Union,
Set,
Dict,
List,
Tuple,
Literal,
)
from llama_index.core.vector_stores.types import (
MetadataFilters,
)
import sqlalchemy
_logger = ... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/vector_stores/llama-index-vector-stores-openGauss/llama_index/vector_stores/openGauss/base.py",
"license": "MIT License",
"lines": 413,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",... | function_complex |
run-llama/llama_index:llama-index-integrations/vector_stores/llama-index-vector-stores-openGauss/tests/test_opengauss.py | import pytest
from typing import Any, Dict, Generator, List, Union
import asyncio
from llama_index.core.schema import TextNode, NodeRelationship, RelatedNodeInfo
from llama_index.core.vector_stores.types import (
VectorStoreQuery,
VectorStoreQueryMode,
)
from llama_index.vector_stores.openGauss import OpenGauss... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/vector_stores/llama-index-vector-stores-openGauss/tests/test_opengauss.py",
"license": "MIT License",
"lines": 191,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,... | test |
run-llama/llama_index:llama-index-integrations/vector_stores/llama-index-vector-stores-openGauss/tests/test_vector_stores_opengauss.py | from llama_index.core.vector_stores.types import BasePydanticVectorStore
from llama_index.vector_stores.openGauss import OpenGaussStore
def test_class():
names_of_base_classes = [b.__name__ for b in OpenGaussStore.__mro__]
assert BasePydanticVectorStore.__name__ in names_of_base_classes
| {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/vector_stores/llama-index-vector-stores-openGauss/tests/test_vector_stores_opengauss.py",
"license": "MIT License",
"lines": 5,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repe... | test |
run-llama/llama_index:llama-index-integrations/protocols/llama-index-protocols-ag-ui/llama_index/protocols/ag_ui/agent.py | import json
import uuid
from typing import Any, Callable, Dict, List, Optional, Union
from ag_ui.core import RunAgentInput
from llama_index.core import Settings
from llama_index.core.llms import ChatMessage, ChatResponse, TextBlock
from llama_index.core.llms.function_calling import FunctionCallingLLM
from llama_index... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/protocols/llama-index-protocols-ag-ui/llama_index/protocols/ag_ui/agent.py",
"license": "MIT License",
"lines": 283,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1... | function_complex |
run-llama/llama_index:llama-index-integrations/protocols/llama-index-protocols-ag-ui/llama_index/protocols/ag_ui/events.py | # Converts ag_ui events to llama_index workflow events
from ag_ui.core.events import (
EventType,
TextMessageStartEvent,
TextMessageContentEvent,
TextMessageChunkEvent,
TextMessageEndEvent,
ToolCallStartEvent,
ToolCallArgsEvent,
ToolCallChunkEvent,
ToolCallEndEvent,
StateSnapsho... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/protocols/llama-index-protocols-ag-ui/llama_index/protocols/ag_ui/events.py",
"license": "MIT License",
"lines": 59,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1... | function_simple |
run-llama/llama_index:llama-index-integrations/protocols/llama-index-protocols-ag-ui/llama_index/protocols/ag_ui/utils.py | import datetime
import re
import uuid
from ag_ui.core import (
Message,
SystemMessage,
UserMessage,
AssistantMessage,
ToolMessage,
DeveloperMessage,
ToolCall,
FunctionCall,
)
from ag_ui.encoder import EventEncoder
from typing import Union, Callable
from llama_index.core.llms import Chat... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/protocols/llama-index-protocols-ag-ui/llama_index/protocols/ag_ui/utils.py",
"license": "MIT License",
"lines": 134,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1... | function_complex |
run-llama/llama_index:llama-index-core/llama_index/core/agent/workflow/prompts.py | DEFAULT_HANDOFF_PROMPT = """Useful for handing off to another agent.
If you are currently not equipped to handle the user's request, or another agent is better suited to handle the request, please hand off to the appropriate agent.
Currently available agents:
{agent_info}
"""
DEFAULT_STATE_PROMPT = """Current state:
... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-core/llama_index/core/agent/workflow/prompts.py",
"license": "MIT License",
"lines": 14,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | documentation |
run-llama/llama_index:llama-index-instrumentation/src/llama_index_instrumentation/base/event.py | from datetime import datetime
from typing import Any, Dict, Optional
from uuid import uuid4
from pydantic import BaseModel, ConfigDict, Field
from llama_index_instrumentation.span import active_span_id
class BaseEvent(BaseModel):
model_config = ConfigDict(
arbitrary_types_allowed=True,
# copy_on... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-instrumentation/src/llama_index_instrumentation/base/event.py",
"license": "MIT License",
"lines": 25,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
run-llama/llama_index:llama-index-instrumentation/src/llama_index_instrumentation/base/handler.py | from abc import ABC, abstractmethod
class BaseInstrumentationHandler(ABC):
@classmethod
@abstractmethod
def init(cls) -> None:
"""Initialize the instrumentation handler."""
| {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-instrumentation/src/llama_index_instrumentation/base/handler.py",
"license": "MIT License",
"lines": 6,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
run-llama/llama_index:llama-index-instrumentation/src/llama_index_instrumentation/dispatcher.py | import asyncio
import inspect
import logging
import uuid
from contextlib import contextmanager
from contextvars import Context, ContextVar, Token, copy_context
from functools import partial
from typing import Any, Callable, Dict, Generator, List, Optional, Protocol, TypeVar
import wrapt
from deprecated import deprecat... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-instrumentation/src/llama_index_instrumentation/dispatcher.py",
"license": "MIT License",
"lines": 381,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
run-llama/llama_index:llama-index-instrumentation/src/llama_index_instrumentation/event_handlers/base.py | from abc import abstractmethod
from typing import Any
from pydantic import BaseModel, ConfigDict
from llama_index_instrumentation.base import BaseEvent
class BaseEventHandler(BaseModel):
"""Base callback handler that can be used to track event starts and ends."""
model_config = ConfigDict(arbitrary_types_a... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-instrumentation/src/llama_index_instrumentation/event_handlers/base.py",
"license": "MIT License",
"lines": 16,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""... | function_simple |
run-llama/llama_index:llama-index-instrumentation/src/llama_index_instrumentation/event_handlers/null.py | from typing import Any
from llama_index_instrumentation.base import BaseEvent
from .base import BaseEventHandler
class NullEventHandler(BaseEventHandler):
@classmethod
def class_name(cls) -> str:
"""Class name."""
return "NullEventHandler"
def handle(self, event: BaseEvent, **kwargs: An... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-instrumentation/src/llama_index_instrumentation/event_handlers/null.py",
"license": "MIT License",
"lines": 11,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""... | function_simple |
run-llama/llama_index:llama-index-instrumentation/src/llama_index_instrumentation/events/span.py | from llama_index_instrumentation.base import BaseEvent
class SpanDropEvent(BaseEvent):
"""
SpanDropEvent.
Args:
err_str (str): Error string.
"""
err_str: str
@classmethod
def class_name(cls) -> str:
"""Class name."""
return "SpanDropEvent"
| {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-instrumentation/src/llama_index_instrumentation/events/span.py",
"license": "MIT License",
"lines": 12,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | documentation |
run-llama/llama_index:llama-index-instrumentation/src/llama_index_instrumentation/span/base.py | from typing import Any, Dict, Optional
from uuid import uuid4
from pydantic import BaseModel, ConfigDict, Field
class BaseSpan(BaseModel):
"""Base data class representing a span."""
model_config = ConfigDict(arbitrary_types_allowed=True)
id_: str = Field(default_factory=lambda: str(uuid4()), description... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-instrumentation/src/llama_index_instrumentation/span/base.py",
"license": "MIT License",
"lines": 9,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
run-llama/llama_index:llama-index-instrumentation/src/llama_index_instrumentation/span/simple.py | from datetime import datetime
from typing import Dict, Optional
from pydantic import Field
from .base import BaseSpan
class SimpleSpan(BaseSpan):
"""Simple span class."""
start_time: datetime = Field(default_factory=lambda: datetime.now())
end_time: Optional[datetime] = Field(default=None)
duration... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-instrumentation/src/llama_index_instrumentation/span/simple.py",
"license": "MIT License",
"lines": 10,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
run-llama/llama_index:llama-index-instrumentation/src/llama_index_instrumentation/span_handlers/base.py | import inspect
import threading
from abc import abstractmethod
from contextvars import copy_context
from functools import partial
from typing import Any, Callable, Dict, Generic, List, Optional, Tuple, TypeVar
from pydantic import BaseModel, ConfigDict, Field, PrivateAttr
from llama_index_instrumentation.span.base im... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-instrumentation/src/llama_index_instrumentation/span_handlers/base.py",
"license": "MIT License",
"lines": 175,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""... | function_complex |
run-llama/llama_index:llama-index-instrumentation/src/llama_index_instrumentation/span_handlers/null.py | import inspect
from typing import Any, Dict, Optional
from llama_index_instrumentation.span.base import BaseSpan
from .base import BaseSpanHandler
class NullSpanHandler(BaseSpanHandler[BaseSpan]):
@classmethod
def class_name(cls) -> str:
"""Class name."""
return "NullSpanHandler"
def sp... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-instrumentation/src/llama_index_instrumentation/span_handlers/null.py",
"license": "MIT License",
"lines": 61,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
... | function_simple |
run-llama/llama_index:llama-index-instrumentation/src/llama_index_instrumentation/span_handlers/simple.py | import inspect
import warnings
from datetime import datetime
from functools import reduce
from typing import TYPE_CHECKING, Any, Dict, List, Optional, cast
from llama_index_instrumentation.span.simple import SimpleSpan
from .base import BaseSpanHandler
if TYPE_CHECKING:
from treelib import Tree
class SimpleSpa... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-instrumentation/src/llama_index_instrumentation/span_handlers/simple.py",
"license": "MIT License",
"lines": 127,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ... | function_complex |
run-llama/llama_index:llama-index-instrumentation/tests/test_dispatcher.py | import asyncio
import inspect
import threading
import time
from abc import abstractmethod
from asyncio import (
AbstractEventLoop,
CancelledError,
Queue,
gather,
get_event_loop,
sleep,
)
from collections import Counter
from concurrent.futures import ThreadPoolExecutor
from random import random
f... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-instrumentation/tests/test_dispatcher.py",
"license": "MIT License",
"lines": 976,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
run-llama/llama_index:llama-index-instrumentation/tests/test_manager.py | import llama_index_instrumentation as instrument
def test_root_manager_add_dispatcher():
# arrange
root_manager = instrument.root_manager
# act
dispatcher = instrument.get_dispatcher("test")
# assert
assert "root" in root_manager.dispatchers
assert "test" in root_manager.dispatchers
| {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-instrumentation/tests/test_manager.py",
"license": "MIT License",
"lines": 9,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
run-llama/llama_index:llama-index-integrations/tools/llama-index-tools-artifact-editor/llama_index/tools/artifact_editor/base.py | from typing import Any, Dict, List, Optional, Type, TypeVar, Union
from llama_index.core.bridge.pydantic import BaseModel, Field, ValidationError
from llama_index.core.tools import BaseTool, FunctionTool
from llama_index.core.tools.tool_spec.base import BaseToolSpec
T = TypeVar("T", bound=BaseModel)
class PatchOpe... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/tools/llama-index-tools-artifact-editor/llama_index/tools/artifact_editor/base.py",
"license": "MIT License",
"lines": 357,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetiti... | function_complex |
run-llama/llama_index:llama-index-integrations/tools/llama-index-tools-artifact-editor/llama_index/tools/artifact_editor/memory_block.py | from typing import List, Optional, Any
from llama_index.core.bridge.pydantic import Field
from llama_index.core.llms import ChatMessage
from llama_index.core.memory import BaseMemoryBlock
from llama_index.tools.artifact_editor.base import ArtifactEditorToolSpec
class ArtifactMemoryBlock(BaseMemoryBlock[str]):
""... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/tools/llama-index-tools-artifact-editor/llama_index/tools/artifact_editor/memory_block.py",
"license": "MIT License",
"lines": 21,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"r... | function_simple |
run-llama/llama_index:llama-index-integrations/tools/llama-index-tools-artifact-editor/tests/test_artifact_editor.py | import pytest
from typing import List, Optional
from pydantic import BaseModel
from llama_index.tools.artifact_editor.base import (
ArtifactEditorToolSpec,
JsonPatch,
PatchOperation,
)
# Test models for testing purposes
class Address(BaseModel):
"""Address model for testing nested objects."""
st... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/tools/llama-index-tools-artifact-editor/tests/test_artifact_editor.py",
"license": "MIT License",
"lines": 374,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"... | test |
run-llama/llama_index:llama-index-integrations/voice_agents/llama-index-voice-agents-elevenlabs/llama_index/voice_agents/elevenlabs/base.py | import base64
import json
import threading
import warnings
from llama_index.core.voice_agents import (
BaseVoiceAgent,
BaseVoiceAgentInterface,
BaseVoiceAgentEvent,
)
from statistics import mean
from websockets.sync.client import Connection
from typing import Optional, Callable, Dict, List, Any... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/voice_agents/llama-index-voice-agents-elevenlabs/llama_index/voice_agents/elevenlabs/base.py",
"license": "MIT License",
"lines": 269,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
... | function_complex |
run-llama/llama_index:llama-index-integrations/voice_agents/llama-index-voice-agents-elevenlabs/llama_index/voice_agents/elevenlabs/utils.py | from pydantic import BaseModel
from inspect import Signature, Parameter
from typing import Any, Dict, Optional, List, Callable
from llama_index.core.llms import ChatMessage, AudioBlock, TextBlock, MessageRole
from llama_index.core.tools import BaseTool
def make_function_from_tool_model(
model_cls: type[... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/voice_agents/llama-index-voice-agents-elevenlabs/llama_index/voice_agents/elevenlabs/utils.py",
"license": "MIT License",
"lines": 116,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",... | function_complex |
run-llama/llama_index:llama-index-integrations/voice_agents/llama-index-voice-agents-elevenlabs/tests/test_utils.py | import pytest
from typing import Dict, List
from llama_index.core.llms import ChatMessage, MessageRole, TextBlock, AudioBlock
from llama_index.voice_agents.elevenlabs.utils import (
callback_agent_message,
callback_agent_message_correction,
callback_latency_measurement,
callback_user_message,
... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/voice_agents/llama-index-voice-agents-elevenlabs/tests/test_utils.py",
"license": "MIT License",
"lines": 114,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"t... | test |
run-llama/llama_index:llama-index-integrations/graph_stores/llama-index-graph-stores-ApertureDB/llama_index/graph_stores/ApertureDB/property_graph.py | import logging
from typing import Any, Dict, List, Optional
from llama_index.core.graph_stores.types import (
LabelledNode,
PropertyGraphStore,
EntityNode,
Relation,
ChunkNode,
Triplet,
)
query_executor = None
query_builder = None
# Prefix for properties that are in the client metadata
PROPERTY... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/graph_stores/llama-index-graph-stores-ApertureDB/llama_index/graph_stores/ApertureDB/property_graph.py",
"license": "MIT License",
"lines": 390,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_patt... | function_complex |
run-llama/llama_index:llama-index-integrations/graph_stores/llama-index-graph-stores-ApertureDB/tests/test_pg_stores_ApertureDB.py | import aperturedb.CommonLibrary
from llama_index.core.graph_stores.types import Relation, EntityNode
from llama_index.graph_stores.ApertureDB import ApertureDBGraphStore
import aperturedb
import json
import pytest
@pytest.fixture
def create_store(monkeypatch):
class MockConnector:
def __init__(self, ex... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/graph_stores/llama-index-graph-stores-ApertureDB/tests/test_pg_stores_ApertureDB.py",
"license": "MIT License",
"lines": 170,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repeti... | test |
run-llama/llama_index:llama-index-core/llama_index/core/program/streaming_utils.py | """
Simplified streaming utilities for processing structured outputs from message content.
This module provides utilities for processing streaming responses that contain
structured data directly in the message content (not in function calls).
"""
from typing import Optional, Type, Union
from pydantic import Validati... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-core/llama_index/core/program/streaming_utils.py",
"license": "MIT License",
"lines": 129,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
run-llama/llama_index:llama-index-core/tests/program/test_streaming_utils.py | """Test streaming utilities."""
from typing import List, Optional
from llama_index.core.bridge.pydantic import BaseModel, Field
from llama_index.core.base.llms.types import ChatMessage, ChatResponse, MessageRole
from llama_index.core.program.streaming_utils import (
process_streaming_content_incremental,
_extr... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-core/tests/program/test_streaming_utils.py",
"license": "MIT License",
"lines": 211,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
run-llama/llama_index: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={"... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-core/tests/storage/kvstore/test_mutable_mapping_kvstore.py",
"license": "MIT License",
"lines": 30,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
run-llama/llama_index: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:
c... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-core/tests/schema/test_image_document.py",
"license": "MIT License",
"lines": 25,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
run-llama/llama_index:llama-index-integrations/tools/llama-index-tools-measurespace/examples/example.py | from llama_index.tools.measurespace import MeasureSpaceToolSpec
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI
from dotenv import load_dotenv
import os
load_dotenv()
api_keys = {
'hourly_weather': os.getenv('HOURLY_WEATHER_API_KEY'),
'daily_weather': os.ge... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/tools/llama-index-tools-measurespace/examples/example.py",
"license": "MIT License",
"lines": 24,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
... | function_simple |
run-llama/llama_index:llama-index-integrations/tools/llama-index-tools-measurespace/llama_index/tools/measurespace/base.py | """Measure Space tool spec."""
from typing import List, Dict
from llama_index.core.schema import Document
from llama_index.core.tools.tool_spec.base import BaseToolSpec
class MeasureSpaceToolSpec(BaseToolSpec):
"""Measure Space tool spec."""
spec_functions = [
"get_hourly_weather_forecast",
... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/tools/llama-index-tools-measurespace/llama_index/tools/measurespace/base.py",
"license": "MIT License",
"lines": 216,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -... | function_complex |
run-llama/llama_index:llama-index-integrations/llms/llama-index-llms-ibm/tests/test_tool_required.py | from unittest.mock import MagicMock, patch
from llama_index.core.tools import FunctionTool
from llama_index.llms.ibm import WatsonxLLM
def search(query: str) -> str:
"""Search for information about a query."""
return f"Results for {query}"
calculator_tool = FunctionTool.from_defaults(
fn=lambda a, b: a ... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/llms/llama-index-llms-ibm/tests/test_tool_required.py",
"license": "MIT License",
"lines": 125,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
run-llama/llama_index:llama-index-integrations/llms/llama-index-llms-vertex/tests/test_tool_required.py | from unittest.mock import Mock, patch
from llama_index.core.tools import FunctionTool
from llama_index.llms.vertex import Vertex
from vertexai.generative_models import ToolConfig
def search(query: str) -> str:
"""Search for information about a query."""
return f"Results for {query}"
def calculate(a: int, b... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/llms/llama-index-llms-vertex/tests/test_tool_required.py",
"license": "MIT License",
"lines": 165,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""... | test |
run-llama/llama_index: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... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-core/tests/embeddings/test_with_cache.py",
"license": "MIT License",
"lines": 100,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
run-llama/llama_index:llama-index-integrations/llms/llama-index-llms-sarvam/tests/test_llms_servam.py | from llama_index.core.base.llms.base import BaseLLM
from llama_index.llms.sarvam import Sarvam
def test_llm_class():
names_of_base_classes = [b.__name__ for b in Sarvam.__mro__]
assert BaseLLM.__name__ in names_of_base_classes
| {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/llms/llama-index-llms-sarvam/tests/test_llms_servam.py",
"license": "MIT License",
"lines": 5,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
run-llama/llama_index:llama-index-integrations/tools/llama-index-tools-mcp/tests/server.py | import asyncio
import random
import time
from contextlib import asynccontextmanager
from collections.abc import AsyncIterator
from datetime import datetime
from typing import Dict, Optional
from mcp.server.fastmcp import FastMCP, Context, Image
from mcp.server.fastmcp.prompts import base
from PIL import Image as PILIm... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/tools/llama-index-tools-mcp/tests/server.py",
"license": "MIT License",
"lines": 197,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
run-llama/llama_index:llama-index-integrations/tools/llama-index-tools-mcp/tests/test_client.py | import os
from httpx import AsyncClient
import pytest
from llama_index.tools.mcp import BasicMCPClient
from llama_index.tools.mcp.client import enable_sse
from mcp import types
# Path to the test server script - adjust as needed
SERVER_SCRIPT = os.path.join(os.path.dirname(__file__), "server.py")
@pytest.fixture(s... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/tools/llama-index-tools-mcp/tests/test_client.py",
"license": "MIT License",
"lines": 206,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
run-llama/llama_index:llama-index-integrations/observability/llama-index-observability-otel/llama_index/observability/otel/base.py | import inspect
from datetime import datetime
from typing import Any, Dict, List, Literal, Mapping, Optional, Sequence, Union, cast
import llama_index_instrumentation as instrument
from llama_index.observability.otel.utils import flatten_dict
from llama_index_instrumentation.base.event import BaseEvent
from llama_index... | {
"repo_id": "run-llama/llama_index",
"file_path": "llama-index-integrations/observability/llama-index-observability-otel/llama_index/observability/otel/base.py",
"license": "MIT License",
"lines": 260,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repeti... | function_complex |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.