id int64 0 190k | prompt stringlengths 21 13.4M | docstring stringlengths 1 12k ⌀ |
|---|---|---|
36,308 | import asyncio
import os
import time
from abc import ABC, abstractmethod
from typing import List, Optional, Tuple
from llama_index.readers.github.repository.github_client import (
GitBlobResponseModel,
GithubClient,
GitTreeResponseModel,
)
The provided code snippet includes necessary dependencies for imple... | Log message if verbose is True. |
36,309 | import asyncio
import os
import time
from abc import ABC, abstractmethod
from typing import List, Optional, Tuple
from llama_index.readers.github.repository.github_client import (
GitBlobResponseModel,
GithubClient,
GitTreeResponseModel,
)
The provided code snippet includes necessary dependencies for imple... | Get file extension. |
36,310 | import asyncio
import base64
import binascii
import enum
import logging
import os
import pathlib
import tempfile
from typing import Any, Callable, Dict, List, Optional, Tuple
from llama_index.core.readers.base import BaseReader
from llama_index.core.readers.file.base import _try_loading_included_file_formats
from llama... | Time a function. |
36,311 | import asyncio
import base64
import binascii
import enum
import logging
import os
import pathlib
import tempfile
from typing import Any, Callable, Dict, List, Optional, Tuple
from llama_index.core.readers.base import BaseReader
from llama_index.core.readers.file.base import _try_loading_included_file_formats
from llama... | Load data from a commit. |
36,312 | import asyncio
import base64
import binascii
import enum
import logging
import os
import pathlib
import tempfile
from typing import Any, Callable, Dict, List, Optional, Tuple
from llama_index.core.readers.base import BaseReader
from llama_index.core.readers.file.base import _try_loading_included_file_formats
from llama... | Load data from a branch. |
36,313 | import asyncio
import enum
import logging
from typing import Dict, List
from llama_index.core.readers.base import BaseReader
from llama_index.core.schema import Document
from llama_index.readers.github.collaborators.github_client import (
BaseGitHubCollaboratorsClient,
GitHubCollaboratorsClient,
)
The provided... | Log message if verbose is True. |
36,314 | import asyncio
import enum
import logging
from typing import Dict, List, Optional, Tuple
from llama_index.core.readers.base import BaseReader
from llama_index.core.schema import Document
from llama_index.readers.github.issues.github_client import (
BaseGitHubIssuesClient,
GitHubIssuesClient,
)
The provided cod... | Log message if verbose is True. |
36,315 | import logging
from typing import Any, List, Optional
import clickhouse_connect
from llama_index.core.readers.base import BaseReader
from llama_index.core.schema import Document
def escape_str(value: str) -> str:
BS = "\\"
must_escape = (BS, "'")
return (
"".join(f"{BS}{c}" if c in must_escape else... | null |
36,316 | import logging
from typing import Any, List, Optional
import clickhouse_connect
from llama_index.core.readers.base import BaseReader
from llama_index.core.schema import Document
def format_list_to_string(lst: List) -> str:
return "[" + ",".join(str(item) for item in lst) + "]" | null |
36,317 | import json
import re
from datetime import datetime
from typing import List
import requests
from tenacity import retry, stop_after_attempt, wait_random_exponential
def correct_date(yr, dt):
"""Some transcripts have incorrect date, correcting it.
Args:
yr (int): actual
dt (datetime): given date
... | Get the earnings transcripts. Args: quarter (str) ticker (str) year (int) |
36,318 | from typing import Dict, List
import requests
def get_pdb_publications_from_rcsb(pdb_id: str) -> List[Dict]:
base_url = "https://data.rcsb.org/rest/v1/core/"
pubmed_query = f"{base_url}pubmed/{pdb_id}"
entry_query = f"{base_url}entry/{pdb_id}"
pubmed_response = requests.get(pubmed_query)
entry_respo... | null |
36,321 | from typing import List, Optional, Union
import numpy as np
from llama_index.core.readers.base import BaseReader
from llama_index.core.schema import Document
distance_metric_map = {
"l2": lambda a, b: np.linalg.norm(a - b, axis=1, ord=2),
"l1": lambda a, b: np.linalg.norm(a - b, axis=1, ord=1),
"max": lambd... | Naive search for nearest neighbors args: query_vector: Union[List, np.ndarray] data_vectors: np.ndarray limit (int): number of nearest neighbors distance_metric: distance function 'L2' for Euclidean, 'L1' for Nuclear, 'Max' l-infinity distance, 'cos' for cosine similarity, 'dot' for dot product returns: nearest_indices... |
36,322 | import time
from collections import namedtuple
from pathlib import Path
from typing import List
import requests
from requests.adapters import HTTPAdapter
from urllib3.util.retry import Retry
SEC_EDGAR_RATE_LIMIT_SLEEP_INTERVAL = 0.1
SEC_EDGAR_SEARCH_API_ENDPOINT = "https://efts.sec.gov/LATEST/search-index"
retries = Re... | Get the filings URL to download the data. Returns: List[FilingMetadata]: Filing metadata from SEC |
36,323 | import logging
import os
from fastapi import FastAPI, Request, status
from .section import router as section_router
def healthcheck(request: Request):
return {"healthcheck": "HEALTHCHECK STATUS: EVERYTHING OK!"} | null |
36,324 | import gzip
import io
import json
import mimetypes
import os
import secrets
from base64 import b64encode
from typing import List, Mapping, Optional, Union
from fastapi import (
APIRouter,
FastAPI,
File,
Form,
HTTPException,
Request,
UploadFile,
status,
)
from fastapi.responses import Str... | null |
36,325 | import re
import sys
from functools import partial
from typing import Any, Iterable, Iterator, List, Optional, Tuple
from collections import defaultdict
import numpy as np
import numpy.typing as npt
The provided code snippet includes necessary dependencies for implementing the `get_narrative_texts` function. Write a P... | Returns a list of NarrativeText or ListItem from document, with option to return narrative texts only up to next Title element. |
36,326 | import re
import sys
from functools import partial
from typing import Any, Iterable, Iterator, List, Optional, Tuple
from collections import defaultdict
import numpy as np
import numpy.typing as npt
REPORT_TYPES: Final[List[str]] = ["10-K", "10-Q", "10-K/A", "10-Q/A"]
def _raise_for_invalid_filing_type(filing_type: Opt... | Checks to see if a text element matches the section title for a given filing type. |
36,327 | import re
import sys
from functools import partial
from typing import Any, Iterable, Iterator, List, Optional, Tuple
from collections import defaultdict
import numpy as np
import numpy.typing as npt
REPORT_TYPES: Final[List[str]] = ["10-K", "10-Q", "10-K/A", "10-Q/A"]
S1_TYPES: Final[List[str]] = ["S-1", "S-1/A"]
def i... | Determines if a title corresponds to an item heading. |
36,328 | import re
import sys
from functools import partial
from typing import Any, Iterable, Iterator, List, Optional, Tuple
from collections import defaultdict
import numpy as np
import numpy.typing as npt
The provided code snippet includes necessary dependencies for implementing the `is_toc_title` function. Write a Python f... | Checks to see if the title matches the pattern for the table of contents. |
36,329 | import re
import sys
from functools import partial
from typing import Any, Iterable, Iterator, List, Optional, Tuple
from collections import defaultdict
import numpy as np
import numpy.typing as npt
The provided code snippet includes necessary dependencies for implementing the `to_sklearn_format` function. Write a Pyt... | The input to clustering needs to be locations in euclidean space, so we need to interpret the locations of Titles within the sequence of elements as locations in 1d space. |
36,330 | import re
import sys
from functools import partial
from typing import Any, Iterable, Iterator, List, Optional, Tuple
from collections import defaultdict
import numpy as np
import numpy.typing as npt
The provided code snippet includes necessary dependencies for implementing the `cluster_num_to_indices` function. Write ... | Keeping in mind the input to clustering was indices in a list of elements interpreted as location in 1-d space, this function gives back the original indices of elements that are members of the cluster with the given number. |
36,331 | import re
import sys
from functools import partial
from typing import Any, Iterable, Iterator, List, Optional, Tuple
from collections import defaultdict
import numpy as np
import numpy.typing as npt
REPORT_TYPES: Final[List[str]] = ["10-K", "10-Q", "10-K/A", "10-Q/A"]
S1_TYPES: Final[List[str]] = ["S-1", "S-1/A"]
def _... | Get element from Element list whose text approximately matches title. |
36,332 | import json
import os
import re
import sys
from typing import List, Optional, Tuple, Union
import requests
import webbrowser
def fake_decorator(*args, **kwargs):
def inner(func):
return func
return inner | null |
36,333 | import json
import os
import re
import sys
from typing import List, Optional, Tuple, Union
import requests
import webbrowser
def _get_filing(
session: requests.Session, cik: Union[str, int], accession_number: Union[str, int]
) -> str:
"""Wrapped so filings can be retrieved with an existing session."""
url =... | Fetches the specified filing from the SEC EDGAR Archives. Conforms to the rate limits specified on the SEC website. ref: https://www.sec.gov/os/accessing-edgar-data. |
36,334 | import json
import os
import re
import sys
from typing import List, Optional, Tuple, Union
import requests
import webbrowser
def _get_recent_acc_num_by_cik(
session: requests.Session, cik: Union[str, int], form_types: List[str]
) -> Tuple[str, str]:
"""Returns accession number and form type for the most recent ... | Returns (accession_number, retrieved_form_type) for the given cik and form_type. The retrieved_form_type may be an amended version of requested form_type, e.g. 10-Q/A for 10-Q. |
36,335 | import json
import os
import re
import sys
from typing import List, Optional, Tuple, Union
import requests
import webbrowser
def get_cik_by_ticker(session: requests.Session, ticker: str) -> str:
"""Gets a CIK number from a stock ticker by running a search on the SEC website."""
cik_re = re.compile(r".*CIK=(\d{1... | Returns (cik, accession_number, retrieved_form_type) for the given ticker and form_type. The retrieved_form_type may be an amended version of requested form_type, e.g. 10-Q/A for 10-Q. |
36,336 | import json
import os
import re
import sys
from typing import List, Optional, Tuple, Union
import requests
import webbrowser
def get_cik_by_ticker(session: requests.Session, ticker: str) -> str:
"""Gets a CIK number from a stock ticker by running a search on the SEC website."""
cik_re = re.compile(r".*CIK=(\d{1... | For a given ticker, gets the most recent form of a given form_type. |
36,337 | import json
import os
import re
import sys
from typing import List, Optional, Tuple, Union
import requests
import webbrowser
def get_cik_by_ticker(session: requests.Session, ticker: str) -> str:
"""Gets a CIK number from a stock ticker by running a search on the SEC website."""
cik_re = re.compile(r".*CIK=(\d{1... | For a given ticker, opens the index page in default browser for the most recent form of a given form_type. |
36,338 | from typing import Any, Dict, List
import re
import signal
from datetime import date
from enum import Enum
from typing import Optional
import requests
import os
def fake_decorator(*args, **kwargs):
def inner(func):
return func
return inner | null |
36,339 | from typing import Any, Dict, List
import re
import signal
from datetime import date
from enum import Enum
from typing import Optional
import requests
import os
try:
from unstructured.staging.base import convert_to_isd
except Exception:
class Element:
pass
The provided code snippet includes necessary d... | Represents the document elements as an Initial Structured Document (ISD). |
36,340 | from typing import Any, Dict, List
import re
import signal
from datetime import date
from enum import Enum
from typing import Optional
import requests
import os
The provided code snippet includes necessary dependencies for implementing the `get_regex_enum` function. Write a Python function `def get_regex_enum(section_... | Get sections using regular expression. Args: section_regex (str): regular expression for the section name Returns: CustomSECSection.CUSTOM: Custom regex section name |
36,341 | import json
import re
from typing import Any, Dict, Generator, List, Optional
from llama_index.core.readers.base import BaseReader
from llama_index.core.schema import Document
The provided code snippet includes necessary dependencies for implementing the `_depth_first_yield` function. Write a Python function `def _dep... | Do depth first yield of all of the leaf nodes of a JSON. Combines keys in the JSON tree using spaces. If levels_back is set to 0, prints all levels. If collapse_length is not None and the json_data is <= that number of characters, then we collapse it into one line. |
36,342 | import asyncio
import logging
import os
from typing import List, Optional
from llama_index.core.readers.base import BasePydanticReader
from llama_index.core.schema import Document
logger = logging.getLogger(__name__)
class Document(TextNode):
"""Generic interface for a data document.
This document connects to... | Async read channel. Note: This is our hack to create a synchronous interface to the async discord.py API. We use the `asyncio` module to run this function with `asyncio.get_event_loop().run_until_complete`. |
36,343 | import logging
import os
import re
import warnings
from typing import List
from urllib.parse import urlparse
import requests
from bs4 import BeautifulSoup
from llama_index.core.readers.base import BaseReader
from llama_index.core.schema import Document
def is_url(text: str) -> bool:
"""
Checks if the given text... | Checks if the given content is a valid HTML document. |
36,344 | import logging
import os
import re
import warnings
from typing import List
from urllib.parse import urlparse
import requests
from bs4 import BeautifulSoup
from llama_index.core.readers.base import BaseReader
from llama_index.core.schema import Document
def clean_html(text: str) -> str:
"""
Cleans HTML content b... | Cleans a value by checking if it's a URL and fetching its content using the WordLift Inspect API. |
36,345 | import logging
import os
import re
import warnings
from typing import List
from urllib.parse import urlparse
import requests
from bs4 import BeautifulSoup
from llama_index.core.readers.base import BaseReader
from llama_index.core.schema import Document
The provided code snippet includes necessary dependencies for impl... | Retrieves the metadata value from the nested item based on field keys. |
36,346 | import logging
import os
import re
import warnings
from typing import List
from urllib.parse import urlparse
import requests
from bs4 import BeautifulSoup
from llama_index.core.readers.base import BaseReader
from llama_index.core.schema import Document
The provided code snippet includes necessary dependencies for impl... | Flattens a nested list. |
36,347 | import datetime
import json
from typing import List, Optional
import requests
from llama_index.core.readers.base import BaseReader
from llama_index.core.schema import Document
The provided code snippet includes necessary dependencies for implementing the `_get_readwise_data` function. Write a Python function `def _get... | Uses Readwise's export API to export all highlights, optionally after a specified date. See https://readwise.io/api_deets for details. Args: updated_after (datetime.datetime): The datetime to load highlights after. Useful for updating indexes over time. |
36,348 | import json
import logging
import os
import threading
import time
from dataclasses import dataclass
from datetime import datetime
from functools import wraps
from typing import List, Optional
import requests
from llama_index.core.readers.base import BaseReader
from llama_index.core.schema import Document
def rate_limi... | null |
36,349 | import json
import logging
import os
import threading
import time
from dataclasses import dataclass
from datetime import datetime
from functools import wraps
from typing import List, Optional
import requests
from llama_index.core.readers.base import BaseReader
from llama_index.core.schema import Document
logger = loggi... | https://api.stackoverflowteams.com/docs/throttle https://api.stackexchange.com/docs/throttle Every application is subject to an IP based concurrent request throttle. If a single IP is making more than 30 requests a second, new requests will be dropped. The exact ban period is subject to change, but will be on the order... |
36,350 | import logging
from typing import Any, Callable, Dict, List, Optional, Tuple
from urllib.parse import urljoin
from llama_index.core.bridge.pydantic import PrivateAttr
from llama_index.core.readers.base import BasePydanticReader
from llama_index.core.schema import Document
The provided code snippet includes necessary d... | Extract text from Substack blog post. |
36,351 | import logging
from typing import Any, Callable, Dict, List, Optional, Tuple
from urllib.parse import urljoin
from llama_index.core.bridge.pydantic import PrivateAttr
from llama_index.core.readers.base import BasePydanticReader
from llama_index.core.schema import Document
The provided code snippet includes necessary d... | Extract text from a ReadTheDocs documentation site. |
36,352 | import logging
from typing import Any, Callable, Dict, List, Optional, Tuple
from urllib.parse import urljoin
from llama_index.core.bridge.pydantic import PrivateAttr
from llama_index.core.readers.base import BasePydanticReader
from llama_index.core.schema import Document
logger = logging.getLogger(__name__)
The provi... | Extract text from a ReadMe documentation site. |
36,353 | import logging
from typing import Any, Callable, Dict, List, Optional, Tuple
from urllib.parse import urljoin
from llama_index.core.bridge.pydantic import PrivateAttr
from llama_index.core.readers.base import BasePydanticReader
from llama_index.core.schema import Document
logger = logging.getLogger(__name__)
The provi... | Extract text from a ReadMe documentation site. |
36,354 | import unicodedata
from pathlib import Path
from typing import Any, Callable, Dict, List, Literal, Optional, cast
from llama_index.core.node_parser.interface import TextSplitter
from llama_index.core.readers.base import BaseReader
from llama_index.core.schema import Document
def nfkc_normalize(text: str) -> str:
r... | null |
36,355 | import fnmatch
import os
from typing import List, Optional
from llama_index.core.readers.base import BaseReader
from llama_index.core.schema import Document
def get_ignore_list(ignore_file_path) -> List[str]:
ignore_list = []
with open(ignore_file_path) as ignore_file:
for line in ignore_file:
... | null |
36,356 | import fnmatch
import os
from typing import List, Optional
from llama_index.core.readers.base import BaseReader
from llama_index.core.schema import Document
def should_ignore(file_path, ignore_list) -> bool:
for pattern in ignore_list:
if fnmatch.fnmatch(file_path, pattern):
return True
retu... | Process repository. |
36,357 | import re
import xml.etree.ElementTree as ET
from pathlib import Path
from typing import Dict, List, Optional
from llama_index.core.readers.base import BaseReader
from llama_index.core.schema import Document
The provided code snippet includes necessary dependencies for implementing the `_get_leaf_nodes_up_to_level` fu... | Get collection of nodes up to certain level including leaf nodes. Args: root (ET.Element): XML Root Element level (int): Levels to traverse in the tree Returns: List[ET.Element]: List of target nodes |
36,358 | import asyncio
import json
import logging
import time
from typing import Any, Dict, List, Optional, Tuple, Union, cast
from llama_index.agent.openai.utils import get_function_by_name
from llama_index.core.agent.types import BaseAgent
from llama_index.core.base.llms.types import ChatMessage, MessageRole
from llama_index... | From OpenAI thread messages. |
36,359 | import asyncio
import json
import logging
import time
from typing import Any, Dict, List, Optional, Tuple, Union, cast
from llama_index.agent.openai.utils import get_function_by_name
from llama_index.core.agent.types import BaseAgent
from llama_index.core.base.llms.types import ChatMessage, MessageRole
from llama_index... | Call a function and return the output as a string. |
36,360 | import asyncio
import json
import logging
import time
from typing import Any, Dict, List, Optional, Tuple, Union, cast
from llama_index.agent.openai.utils import get_function_by_name
from llama_index.core.agent.types import BaseAgent
from llama_index.core.base.llms.types import ChatMessage, MessageRole
from llama_index... | Call an async function and return the output as a string. |
36,361 | import asyncio
import json
import logging
import time
from typing import Any, Dict, List, Optional, Tuple, Union, cast
from llama_index.agent.openai.utils import get_function_by_name
from llama_index.core.agent.types import BaseAgent
from llama_index.core.base.llms.types import ChatMessage, MessageRole
from llama_index... | Process files. |
36,362 | import asyncio
import json
import logging
import uuid
from functools import partial
from threading import Thread
from typing import Any, Dict, List, Optional, Tuple, Union, cast, get_args
from llama_index.agent.openai.utils import resolve_tool_choice
from llama_index.core.agent.types import (
BaseAgentWorker,
T... | Call a function and return the output as a string. |
36,363 | import asyncio
import json
import logging
import uuid
from functools import partial
from threading import Thread
from typing import Any, Dict, List, Optional, Tuple, Union, cast, get_args
from llama_index.agent.openai.utils import resolve_tool_choice
from llama_index.core.agent.types import (
BaseAgentWorker,
T... | Call a function and return the output as a string. |
36,364 | import asyncio
import json
import logging
from abc import abstractmethod
from threading import Thread
from typing import Any, Dict, List, Optional, Tuple, Type, Union, cast, get_args
from llama_index.agent.openai_legacy.utils import get_function_by_name
from llama_index.core.agent.types import BaseAgent
from llama_inde... | Call a function and return the output as a string. |
36,365 | import asyncio
import json
import logging
from abc import abstractmethod
from threading import Thread
from typing import Any, Dict, List, Optional, Tuple, Type, Union, cast, get_args
from llama_index.agent.openai_legacy.utils import get_function_by_name
from llama_index.core.agent.types import BaseAgent
from llama_inde... | Call a function and return the output as a string. |
36,366 | import asyncio
import json
import logging
from abc import abstractmethod
from threading import Thread
from typing import Any, Dict, List, Optional, Tuple, Type, Union, cast, get_args
from llama_index.agent.openai_legacy.utils import get_function_by_name
from llama_index.core.agent.types import BaseAgent
from llama_inde... | Resolve tool choice. If tool_choice is a function name string, return the appropriate dict. |
36,367 | from typing import List, Union
from llama_index.core.tools import BaseTool
The provided code snippet includes necessary dependencies for implementing the `resolve_tool_choice` function. Write a Python function `def resolve_tool_choice(tool_choice: Union[str, dict] = "auto") -> Union[str, dict]` to solve the following ... | Resolve tool choice. If tool_choice is a function name string, return the appropriate dict. |
36,368 | import logging
import os
from string import Template
from typing import Any, Dict, List, Optional
from llama_index.core.graph_stores.types import GraphStore
from nebula3.common import ttypes
from nebula3.Config import SessionPoolConfig
from nebula3.Exception import IOErrorException
from nebula3.fbthrift.transport.TTran... | null |
36,369 | import logging
import os
from string import Template
from typing import Any, Dict, List, Optional
from llama_index.core.graph_stores.types import GraphStore
from nebula3.common import ttypes
from nebula3.Config import SessionPoolConfig
from nebula3.Exception import IOErrorException
from nebula3.fbthrift.transport.TTran... | Prepare parameters for query. |
36,370 | import logging
import os
from string import Template
from typing import Any, Dict, List, Optional
from llama_index.core.graph_stores.types import GraphStore
from nebula3.common import ttypes
from nebula3.Config import SessionPoolConfig
from nebula3.Exception import IOErrorException
from nebula3.fbthrift.transport.TTran... | Escape String for NebulaGraph Query. |
36,373 | from __future__ import annotations
import os
from decimal import Decimal
from typing import Any, Dict, List, Set, Tuple
import boto3
from boto3.dynamodb.conditions import Key
from llama_index.core.storage.kvstore.types import DEFAULT_COLLECTION, BaseKVStore
def parse_schema(table: Any) -> Tuple[str, str]:
key_hash... | null |
36,374 | from __future__ import annotations
import os
from decimal import Decimal
from typing import Any, Dict, List, Set, Tuple
import boto3
from boto3.dynamodb.conditions import Key
from llama_index.core.storage.kvstore.types import DEFAULT_COLLECTION, BaseKVStore
def convert_float_to_decimal(obj: Any) -> Any:
if isinsta... | null |
36,375 | from __future__ import annotations
import os
from decimal import Decimal
from typing import Any, Dict, List, Set, Tuple
import boto3
from boto3.dynamodb.conditions import Key
from llama_index.core.storage.kvstore.types import DEFAULT_COLLECTION, BaseKVStore
def convert_decimal_to_int_or_float(obj: Any) -> Any:
if ... | null |
36,376 | import json
import logging
import sys
from typing import Any, List, Optional
from urllib.parse import urlparse
from llama_index.core.bridge.pydantic import Field
from llama_index.core.llms import ChatMessage
from llama_index.core.storage.chat_store.base import BaseChatStore
import redis
from redis import Redis
from red... | null |
36,377 | import json
import logging
import sys
from typing import Any, List, Optional
from urllib.parse import urlparse
from llama_index.core.bridge.pydantic import Field
from llama_index.core.llms import ChatMessage
from llama_index.core.storage.chat_store.base import BaseChatStore
import redis
from redis import Redis
from red... | null |
36,378 | import importlib
import json
import logging
import re
from typing import Any, Dict, List, Optional, cast
from llama_index.core import ServiceContext
from llama_index.core.bridge.pydantic import PrivateAttr
from llama_index.core.schema import (
BaseNode,
MetadataMode,
NodeRelationship,
RelatedNodeInfo,
... | Default tokenizer. |
36,379 | import importlib
import json
import logging
import re
from typing import Any, Dict, List, Optional, cast
from llama_index.core import ServiceContext
from llama_index.core.bridge.pydantic import PrivateAttr
from llama_index.core.schema import (
BaseNode,
MetadataMode,
NodeRelationship,
RelatedNodeInfo,
... | null |
36,380 | import importlib
import json
import logging
import re
from typing import Any, Dict, List, Optional, cast
from llama_index.core import ServiceContext
from llama_index.core.bridge.pydantic import PrivateAttr
from llama_index.core.schema import (
BaseNode,
MetadataMode,
NodeRelationship,
RelatedNodeInfo,
... | null |
36,381 | import logging
from typing import Any, Dict, Iterable, List, Optional, TypeVar, cast
from cassio.table import ClusteredMetadataVectorCassandraTable
from llama_index.core.bridge.pydantic import PrivateAttr
from llama_index.core.indices.query.embedding_utils import (
get_top_k_mmr_embeddings,
)
from llama_index.core.... | null |
36,382 | import logging
import re
from typing import Any, List, Optional, Pattern
import numpy as np
from redis.client import Redis as RedisType
from redis.commands.search.query import Query
_logger = logging.getLogger(__name__)
REDIS_REQUIRED_MODULES = [
{"name": "search", "ver": 20400},
{"name": "searchlight", "ver": ... | Check if the correct Redis modules are installed. |
36,383 | import logging
import re
from typing import Any, List, Optional, Pattern
import numpy as np
from redis.client import Redis as RedisType
from redis.commands.search.query import Query
The provided code snippet includes necessary dependencies for implementing the `get_redis_query` function. Write a Python function `def g... | Create a vector query for use with a SearchIndex. Args: return_fields (t.List[str]): A list of fields to return in the query results top_k (int, optional): The number of results to return. Defaults to 20. vector_field (str, optional): The name of the vector field in the index. Defaults to "vector". sort (bool, optional... |
36,384 | import logging
import re
from typing import Any, List, Optional, Pattern
import numpy as np
from redis.client import Redis as RedisType
from redis.commands.search.query import Query
def convert_bytes(data: Any) -> Any:
if isinstance(data, bytes):
return data.decode("ascii")
if isinstance(data, dict):
... | null |
36,385 | import logging
import re
from typing import Any, List, Optional, Pattern
import numpy as np
from redis.client import Redis as RedisType
from redis.commands.search.query import Query
def array_to_buffer(array: List[float], dtype: Any = np.float32) -> bytes:
return np.array(array).astype(dtype).tobytes() | null |
36,386 | import logging
from typing import Any, Dict, List, Optional
import fsspec
from llama_index.core.bridge.pydantic import PrivateAttr
from llama_index.core.schema import (
BaseNode,
MetadataMode,
NodeRelationship,
RelatedNodeInfo,
TextNode,
)
from llama_index.core.vector_stores.types import (
BaseP... | null |
36,387 | import json
from typing import Any, Dict, List, Optional
from llama_index.core.schema import (
BaseNode,
NodeRelationship,
RelatedNodeInfo,
TextNode,
)
from llama_index.core.vector_stores.types import (
VectorStore,
VectorStoreQuery,
VectorStoreQueryResult,
)
from llama_index.core.vector_sto... | null |
36,388 | import math
from typing import Any, List
import metal_sdk
from llama_index.core.schema import BaseNode, MetadataMode, TextNode
from llama_index.core.vector_stores.types import (
MetadataFilters,
VectorStore,
VectorStoreQuery,
VectorStoreQueryResult,
)
from llama_index.core.vector_stores.utils import (
... | null |
36,389 | from typing import Any
from packaging import version
def _import_pinecone() -> Any:
"""
Try to import pinecone module. If it's not already installed, instruct user how to install.
"""
try:
import pinecone
except ImportError as e:
raise ImportError(
"Could not import pinec... | Check whether the pinecone client is >= 3.0.0. |
36,390 | import logging
from collections import Counter
from functools import partial
from typing import Any, Callable, Dict, List, Optional, cast
from llama_index.core.bridge.pydantic import PrivateAttr
from llama_index.core.schema import BaseNode, MetadataMode, TextNode
from llama_index.core.vector_stores.types import (
B... | Generate sparse vectors from a batch of contexts. NOTE: taken from https://www.pinecone.io/learn/hybrid-search-intro/. |
36,391 | import logging
from collections import Counter
from functools import partial
from typing import Any, Callable, Dict, List, Optional, cast
from llama_index.core.bridge.pydantic import PrivateAttr
from llama_index.core.schema import BaseNode, MetadataMode, TextNode
from llama_index.core.vector_stores.types import (
B... | Get default tokenizer. NOTE: taken from https://www.pinecone.io/learn/hybrid-search-intro/. |
36,392 | import logging
from collections import Counter
from functools import partial
from typing import Any, Callable, Dict, List, Optional, cast
from llama_index.core.bridge.pydantic import PrivateAttr
from llama_index.core.schema import BaseNode, MetadataMode, TextNode
from llama_index.core.vector_stores.types import (
B... | Convert from standard dataclass to pinecone filter dict. |
36,393 | import asyncio
import json
import uuid
from typing import Any, Dict, Iterable, List, Optional, Union, cast
from llama_index.core.bridge.pydantic import PrivateAttr
from llama_index.core.schema import BaseNode, MetadataMode, TextNode
from llama_index.core.vector_stores.types import (
MetadataFilters,
BasePydanti... | Get AsyncOpenSearch client from the opensearch_url, otherwise raise error. |
36,394 | import asyncio
import json
import uuid
from typing import Any, Dict, Iterable, List, Optional, Union, cast
from llama_index.core.bridge.pydantic import PrivateAttr
from llama_index.core.schema import BaseNode, MetadataMode, TextNode
from llama_index.core.vector_stores.types import (
MetadataFilters,
BasePydanti... | Async Bulk Ingest Embeddings into given index. |
36,395 | import asyncio
import json
import uuid
from typing import Any, Dict, Iterable, List, Optional, Union, cast
from llama_index.core.bridge.pydantic import PrivateAttr
from llama_index.core.schema import BaseNode, MetadataMode, TextNode
from llama_index.core.vector_stores.types import (
MetadataFilters,
BasePydanti... | null |
36,396 | import asyncio
import json
import uuid
from typing import Any, Dict, Iterable, List, Optional, Union, cast
from llama_index.core.bridge.pydantic import PrivateAttr
from llama_index.core.schema import BaseNode, MetadataMode, TextNode
from llama_index.core.vector_stores.types import (
MetadataFilters,
BasePydanti... | Check if the service is http_auth is set as `aoss`. |
36,397 | import os
from typing import Any, Dict, List, Optional
import requests
from llama_index.core.schema import (
BaseNode,
MetadataMode,
NodeRelationship,
RelatedNodeInfo,
TextNode,
)
from llama_index.core.utils import get_tqdm_iterable
from llama_index.core.vector_stores.types import (
VectorStore,... | Convert docs to JSON. |
36,398 | import asyncio
import uuid
from logging import getLogger
from typing import Any, Callable, Dict, List, Literal, Optional, Union, cast
import nest_asyncio
import numpy as np
from llama_index.core.bridge.pydantic import PrivateAttr
from llama_index.core.schema import BaseNode, MetadataMode, TextNode
from llama_index.core... | Get AsyncElasticsearch client. Args: es_url: Elasticsearch URL. cloud_id: Elasticsearch cloud ID. api_key: Elasticsearch API key. username: Elasticsearch username. password: Elasticsearch password. Returns: AsyncElasticsearch client. Raises: ConnectionError: If Elasticsearch client cannot connect to Elasticsearch. |
36,399 | import asyncio
import uuid
from logging import getLogger
from typing import Any, Callable, Dict, List, Literal, Optional, Union, cast
import nest_asyncio
import numpy as np
from llama_index.core.bridge.pydantic import PrivateAttr
from llama_index.core.schema import BaseNode, MetadataMode, TextNode
from llama_index.core... | Convert standard filters to Elasticsearch filter. Args: standard_filters: Standard Llama-index filters. Returns: Elasticsearch filter. |
36,400 | import asyncio
import uuid
from logging import getLogger
from typing import Any, Callable, Dict, List, Literal, Optional, Union, cast
import nest_asyncio
import numpy as np
from llama_index.core.bridge.pydantic import PrivateAttr
from llama_index.core.schema import BaseNode, MetadataMode, TextNode
from llama_index.core... | null |
36,401 | import logging
import os
from importlib.metadata import version
from typing import Any, Dict, List, Optional, cast
from llama_index.core.bridge.pydantic import PrivateAttr
from llama_index.core.schema import BaseNode, MetadataMode, TextNode
from llama_index.core.vector_stores.types import (
MetadataFilters,
Bas... | Convert from standard dataclass to filter dict. |
36,402 | import logging
import math
from typing import Any, List
from llama_index.core.schema import BaseNode, MetadataMode, TextNode
from llama_index.core.vector_stores.types import (
MetadataFilters,
VectorStore,
VectorStoreQuery,
VectorStoreQueryResult,
)
from llama_index.core.vector_stores.utils import (
... | Translate standard metadata filters to Bagel specific spec. |
36,403 | import logging
from typing import Any, Dict, List, Optional, Union
import pymilvus
from llama_index.core.bridge.pydantic import PrivateAttr
from llama_index.core.schema import BaseNode, TextNode
from llama_index.core.vector_stores.types import (
BasePydanticVectorStore,
MetadataFilters,
VectorStoreQuery,
... | Translate standard metadata filters to Milvus specific spec. |
36,404 | import logging
from typing import Any, List, Optional, cast
from llama_index.core.schema import BaseNode, MetadataMode, TextNode
from llama_index.core.vector_stores.types import (
MetadataFilters,
VectorStore,
VectorStoreQuery,
VectorStoreQueryMode,
VectorStoreQueryResult,
)
from llama_index.core.ve... | Convert from standard filter to dashvector filter dict. |
36,405 | import logging
import math
from typing import Any, Dict, Generator, List, Optional, cast
import chromadb
from chromadb.api.models.Collection import Collection
from llama_index.core.bridge.pydantic import Field, PrivateAttr
from llama_index.core.schema import BaseNode, MetadataMode, TextNode
from llama_index.core.utils ... | Translate standard metadata filters to Chroma specific spec. |
36,406 | import logging
import math
from typing import Any, Dict, Generator, List, Optional, cast
import chromadb
from chromadb.api.models.Collection import Collection
from llama_index.core.bridge.pydantic import Field, PrivateAttr
from llama_index.core.schema import BaseNode, MetadataMode, TextNode
from llama_index.core.utils ... | Yield successive max_chunk_size-sized chunks from lst. Args: lst (List[BaseNode]): list of nodes with embeddings max_chunk_size (int): max chunk size Yields: Generator[List[BaseNode], None, None]: list of nodes with embeddings |
36,407 | import logging
from typing import Any, List, NamedTuple, Optional, Type
import asyncpg
import psycopg2
import sqlalchemy
import sqlalchemy.ext.asyncio
from llama_index.core.bridge.pydantic import PrivateAttr
from llama_index.core.schema import BaseNode, MetadataMode, TextNode
from llama_index.core.vector_stores.type... | This part create a dynamic sqlalchemy model with a new table. |
36,408 | import logging
from typing import Any, List, NamedTuple, Optional, Type
import asyncpg
import psycopg2
import sqlalchemy
import sqlalchemy.ext.asyncio
from llama_index.core.bridge.pydantic import PrivateAttr
from llama_index.core.schema import BaseNode, MetadataMode, TextNode
from llama_index.core.vector_stores.type... | null |
36,409 | import logging
from typing import TYPE_CHECKING, Any, Dict, List, Optional, cast
from llama_index.core.schema import BaseNode, MetadataMode, TextNode
from llama_index.core.vector_stores.utils import (
DEFAULT_TEXT_KEY,
legacy_metadata_dict_to_node,
metadata_dict_to_node,
node_to_metadata_dict,
)
The pr... | Parse get response from Weaviate. |
36,410 | import logging
from typing import TYPE_CHECKING, Any, Dict, List, Optional, cast
from llama_index.core.schema import BaseNode, MetadataMode, TextNode
from llama_index.core.vector_stores.utils import (
DEFAULT_TEXT_KEY,
legacy_metadata_dict_to_node,
metadata_dict_to_node,
node_to_metadata_dict,
)
def val... | Check if class schema exists. |
36,411 | import logging
from typing import TYPE_CHECKING, Any, Dict, List, Optional, cast
from llama_index.core.schema import BaseNode, MetadataMode, TextNode
from llama_index.core.vector_stores.utils import (
DEFAULT_TEXT_KEY,
legacy_metadata_dict_to_node,
metadata_dict_to_node,
node_to_metadata_dict,
)
NODE_SC... | Create default schema. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.