code stringlengths 141 97.3k | apis listlengths 1 24 | extract_api stringlengths 113 214k |
|---|---|---|
import streamlit as st
import os
import sys
import openai
from streamlit_extras.switch_page_button import switch_page
from llama_index import VectorStoreIndex, GithubRepositoryReader, ServiceContext, set_global_service_context
from llama_index.llms import OpenAI
from database.neo4j_connection import connect_to_db
st.... | [
"llama_index.set_global_service_context",
"llama_index.llms.OpenAI",
"llama_index.ServiceContext.from_defaults",
"llama_index.GithubRepositoryReader"
] | [((317, 379), 'streamlit.set_page_config', 'st.set_page_config', ([], {'page_title': '"""Authentication"""', 'page_icon': '"""π"""'}), "(page_title='Authentication', page_icon='π')\n", (335, 379), True, 'import streamlit as st\n'), ((392, 439), 'streamlit.write', 'st.write', (['"""# Welcome to AI GitHub Repo reader!"... |
from llama_index.core import VectorStoreIndex,SimpleDirectoryReader,ServiceContext
print("VectorStoreIndex,SimpleDirectoryReader,ServiceContext imported")
from llama_index.llms.huggingface import HuggingFaceLLM
print("HuggingFaceLLM imported")
from llama_index.core.prompts.prompts import SimpleInputPrompt
print("Simple... | [
"llama_index.core.prompts.prompts.SimpleInputPrompt",
"llama_index.core.SimpleDirectoryReader"
] | [((872, 885), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (883, 885), False, 'from dotenv import load_dotenv\n'), ((905, 931), 'os.environ.get', 'os.environ.get', (['"""HF_TOKEN"""'], {}), "('HF_TOKEN')\n", (919, 931), False, 'import os\n'), ((1262, 1315), 'llama_index.core.prompts.prompts.SimpleInputPrompt'... |
import logging
from typing import Any, List, Optional
from llama_index.legacy.bridge.pydantic import Field, PrivateAttr
from llama_index.legacy.core.embeddings.base import (
DEFAULT_EMBED_BATCH_SIZE,
BaseEmbedding,
Embedding,
)
logger = logging.getLogger(__name__)
# For bge models that Gradient AI provi... | [
"llama_index.legacy.bridge.pydantic.PrivateAttr",
"llama_index.legacy.bridge.pydantic.Field"
] | [((251, 278), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (268, 278), False, 'import logging\n'), ((1040, 1086), 'llama_index.legacy.bridge.pydantic.Field', 'Field', ([], {'default': 'GRADIENT_EMBED_BATCH_SIZE', 'gt': '(0)'}), '(default=GRADIENT_EMBED_BATCH_SIZE, gt=0)\n', (1045, 1086)... |
"""Answer inserter."""
from abc import abstractmethod
from typing import Any, Dict, List, Optional
from llama_index.core.llms.llm import LLM
from llama_index.core.prompts.base import BasePromptTemplate, PromptTemplate
from llama_index.core.prompts.mixin import (
PromptDictType,
PromptMixin,
PromptMixinTyp... | [
"llama_index.core.settings.llm_from_settings_or_context",
"llama_index.core.prompts.base.PromptTemplate"
] | [((4287, 4336), 'llama_index.core.prompts.base.PromptTemplate', 'PromptTemplate', (['DEFAULT_ANSWER_INSERT_PROMPT_TMPL'], {}), '(DEFAULT_ANSWER_INSERT_PROMPT_TMPL)\n', (4301, 4336), False, 'from llama_index.core.prompts.base import BasePromptTemplate, PromptTemplate\n'), ((4860, 4915), 'llama_index.core.settings.llm_fr... |
"""Retrieval evaluators."""
from typing import Any, List, Optional, Sequence, Tuple
from llama_index.legacy.bridge.pydantic import Field
from llama_index.legacy.core.base_retriever import BaseRetriever
from llama_index.legacy.evaluation.retrieval.base import (
BaseRetrievalEvaluator,
RetrievalEvalMode,
)
from... | [
"llama_index.legacy.bridge.pydantic.Field"
] | [((1038, 1085), 'llama_index.legacy.bridge.pydantic.Field', 'Field', (['...'], {'description': '"""Retriever to evaluate"""'}), "(..., description='Retriever to evaluate')\n", (1043, 1085), False, 'from llama_index.legacy.bridge.pydantic import Field\n'), ((1151, 1209), 'llama_index.legacy.bridge.pydantic.Field', 'Fiel... |
from typing import Any, List, Optional
from llama_index.legacy.bridge.pydantic import Field, PrivateAttr
from llama_index.legacy.callbacks import CallbackManager
from llama_index.legacy.core.embeddings.base import (
DEFAULT_EMBED_BATCH_SIZE,
BaseEmbedding,
)
from llama_index.legacy.embeddings.huggingface_utils... | [
"llama_index.legacy.bridge.pydantic.Field",
"llama_index.legacy.embeddings.huggingface_utils.format_text",
"llama_index.legacy.bridge.pydantic.PrivateAttr",
"llama_index.legacy.embeddings.huggingface_utils.get_pooling_mode",
"llama_index.legacy.embeddings.pooling.Pooling",
"llama_index.legacy.embeddings.h... | [((567, 613), 'llama_index.legacy.bridge.pydantic.Field', 'Field', ([], {'description': '"""Folder name to load from."""'}), "(description='Folder name to load from.')\n", (572, 613), False, 'from llama_index.legacy.bridge.pydantic import Field, PrivateAttr\n'), ((636, 681), 'llama_index.legacy.bridge.pydantic.Field', ... |
"""LLM Chains for executing Retrival Augmented Generation."""
import base64
import os
from functools import lru_cache
from pathlib import Path
from typing import TYPE_CHECKING, Generator, List, Optional
import torch
from langchain.embeddings import HuggingFaceEmbeddings
from langchain.llms import HuggingFaceTextGenInf... | [
"llama_index.response.schema.Response",
"llama_index.embeddings.LangchainEmbedding",
"llama_index.VectorStoreIndex.from_vector_store",
"llama_index.llms.LangChainLLM",
"llama_index.vector_stores.MilvusVectorStore",
"llama_index.Prompt",
"llama_index.download_loader",
"llama_index.node_parser.SimpleNod... | [((3156, 3202), 'os.environ.get', 'os.environ.get', (['"""APP_CONFIG_FILE"""', '"""/dev/null"""'], {}), "('APP_CONFIG_FILE', '/dev/null')\n", (3170, 3202), False, 'import os\n'), ((3216, 3262), 'chain_server.configuration.AppConfig.from_file', 'configuration.AppConfig.from_file', (['config_file'], {}), '(config_file)\n... |
from llama_index import ServiceContext
from llama_index import StorageContext, load_index_from_storage
from omegaconf import DictConfig, OmegaConf
import hydra
from llama_index.evaluation import RetrieverEvaluator
from llama_index.evaluation import (
EmbeddingQAFinetuneDataset,
)
import pandas as pd
@hydra.main(v... | [
"llama_index.evaluation.EmbeddingQAFinetuneDataset.from_json",
"llama_index.ServiceContext.from_defaults",
"llama_index.StorageContext.from_defaults",
"llama_index.load_index_from_storage",
"llama_index.evaluation.RetrieverEvaluator.from_metric_names"
] | [((308, 385), 'hydra.main', 'hydra.main', ([], {'version_base': 'None', 'config_path': '"""../../conf"""', 'config_name': '"""config"""'}), "(version_base=None, config_path='../../conf', config_name='config')\n", (318, 385), False, 'import hydra\n'), ((589, 619), 'llama_index.ServiceContext.from_defaults', 'ServiceCont... |
import os
import time
from typing import Any, Callable, List, Sequence
from lib import constants
from lib.index.helper import cur_simple_date_time_sec
from llama_index.core.llms.callbacks import llm_chat_callback, llm_completion_callback
from llama_index.core.base.llms.base import BaseLLM
from llama_index.core.llms imp... | [
"llama_index.core.llms.callbacks.llm_completion_callback",
"llama_index.core.llms.callbacks.llm_chat_callback"
] | [((1905, 1924), 'llama_index.core.llms.callbacks.llm_chat_callback', 'llm_chat_callback', ([], {}), '()\n', (1922, 1924), False, 'from llama_index.core.llms.callbacks import llm_chat_callback, llm_completion_callback\n'), ((2715, 2734), 'llama_index.core.llms.callbacks.llm_chat_callback', 'llm_chat_callback', ([], {}),... |
from llama_index import StorageContext, load_index_from_storage
# rebuild storage context
storage_context = StorageContext.from_defaults(persist_dir="./storage")
# load index
index = load_index_from_storage(storage_context)
| [
"llama_index.StorageContext.from_defaults",
"llama_index.load_index_from_storage"
] | [((109, 162), 'llama_index.StorageContext.from_defaults', 'StorageContext.from_defaults', ([], {'persist_dir': '"""./storage"""'}), "(persist_dir='./storage')\n", (137, 162), False, 'from llama_index import StorageContext, load_index_from_storage\n'), ((184, 224), 'llama_index.load_index_from_storage', 'load_index_from... |
"""Autoretriever prompts."""
from llama_index.legacy.prompts.base import PromptTemplate
from llama_index.legacy.prompts.prompt_type import PromptType
from llama_index.legacy.vector_stores.types import (
FilterOperator,
MetadataFilter,
MetadataInfo,
VectorStoreInfo,
VectorStoreQuerySpec,
)
# NOTE: ... | [
"llama_index.legacy.vector_stores.types.MetadataInfo",
"llama_index.legacy.prompts.base.PromptTemplate",
"llama_index.legacy.vector_stores.types.MetadataFilter"
] | [((3927, 4033), 'llama_index.legacy.prompts.base.PromptTemplate', 'PromptTemplate', ([], {'template': 'DEFAULT_VECTARA_QUERY_PROMPT_TMPL', 'prompt_type': 'PromptType.VECTOR_STORE_QUERY'}), '(template=DEFAULT_VECTARA_QUERY_PROMPT_TMPL, prompt_type=\n PromptType.VECTOR_STORE_QUERY)\n', (3941, 4033), False, 'from llama... |
import asyncio
from abc import abstractmethod
from typing import Any, Dict, List, Optional, Sequence, Tuple, cast
import pandas as pd
from tqdm import tqdm
from llama_index.core.async_utils import DEFAULT_NUM_WORKERS, run_jobs
from llama_index.core.base.response.schema import PydanticResponse
from llama_index.core.br... | [
"llama_index.core.node_parser.SentenceSplitter",
"llama_index.core.callbacks.base.CallbackManager",
"llama_index.core.bridge.pydantic.Field",
"llama_index.core.service_context.ServiceContext.from_defaults",
"llama_index.core.async_utils.run_jobs",
"llama_index.core.schema.Document",
"llama_index.core.sc... | [((2154, 2206), 'llama_index.core.bridge.pydantic.Field', 'Field', ([], {'default_factory': 'CallbackManager', 'exclude': '(True)'}), '(default_factory=CallbackManager, exclude=True)\n', (2159, 2206), False, 'from llama_index.core.bridge.pydantic import BaseModel, Field, ValidationError\n'), ((2246, 2316), 'llama_index... |
# SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: MIT
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without res... | [
"llama_index.llms.base.LLMMetadata",
"llama_index.bridge.pydantic.Field",
"llama_index.llms.base.llm_completion_callback",
"llama_index.bridge.pydantic.PrivateAttr",
"llama_index.llms.base.llm_chat_callback",
"llama_index.llms.generic_utils.completion_response_to_chat_response"
] | [((2151, 2199), 'llama_index.bridge.pydantic.Field', 'Field', ([], {'description': '"""The path to the trt engine."""'}), "(description='The path to the trt engine.')\n", (2156, 2199), False, 'from llama_index.bridge.pydantic import Field, PrivateAttr\n'), ((2239, 2296), 'llama_index.bridge.pydantic.Field', 'Field', ([... |
from llama_index.core.callbacks.schema import CBEventType, EventPayload
from llama_index.core.llms import ChatMessage, ChatResponse
from llama_index.core.schema import NodeWithScore, TextNode
import chainlit as cl
@cl.on_chat_start
async def start():
await cl.Message(content="LlamaIndexCb").send()
cb = cl.L... | [
"llama_index.core.schema.TextNode",
"llama_index.core.llms.ChatMessage"
] | [((316, 346), 'chainlit.LlamaIndexCallbackHandler', 'cl.LlamaIndexCallbackHandler', ([], {}), '()\n', (344, 346), True, 'import chainlit as cl\n'), ((415, 428), 'chainlit.sleep', 'cl.sleep', (['(0.2)'], {}), '(0.2)\n', (423, 428), True, 'import chainlit as cl\n'), ((691, 704), 'chainlit.sleep', 'cl.sleep', (['(0.2)'], ... |
from typing import Optional, Union
from llama_index import ServiceContext
from llama_index.callbacks import CallbackManager
from llama_index.embeddings.utils import EmbedType
from llama_index.extractors import (
EntityExtractor,
KeywordExtractor,
QuestionsAnsweredExtractor,
SummaryExtractor,
TitleE... | [
"llama_index.extractors.TitleExtractor",
"llama_index.extractors.QuestionsAnsweredExtractor",
"llama_index.ServiceContext.from_defaults",
"llama_index.prompts.PromptTemplate",
"llama_index.extractors.SummaryExtractor",
"llama_index.extractors.EntityExtractor",
"llama_index.extractors.KeywordExtractor",
... | [((3952, 4020), 'llama_index.text_splitter.SentenceSplitter', 'SentenceSplitter', ([], {'chunk_size': 'chunk_size', 'chunk_overlap': 'chunk_overlap'}), '(chunk_size=chunk_size, chunk_overlap=chunk_overlap)\n', (3968, 4020), False, 'from llama_index.text_splitter import SentenceSplitter\n'), ((4643, 4954), 'llama_index.... |
import torch
from llama_index import WikipediaReader
def divide_string(wiki_page, word_limit=50):
divided_text = []
for each_page in wiki_page:
words = each_page[0].text.split()
for i in range(0, len(words), word_limit):
chunk = ' '.join(words[i:i+word_limit])
... | [
"llama_index.WikipediaReader"
] | [((933, 948), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (946, 948), False, 'import torch\n'), ((3638, 3653), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (3651, 3653), False, 'import torch\n'), ((1958, 1975), 'llama_index.WikipediaReader', 'WikipediaReader', ([], {}), '()\n', (1973, 1975), False, 'from... |
import logging
import os
from llama_index import (
StorageContext,
load_index_from_storage,
)
from app.engine.constants import STORAGE_DIR
from app.engine.context import create_service_context
def get_chat_engine():
service_context = create_service_context()
# check if storage already exists
if n... | [
"llama_index.StorageContext.from_defaults",
"llama_index.load_index_from_storage"
] | [((249, 273), 'app.engine.context.create_service_context', 'create_service_context', ([], {}), '()\n', (271, 273), False, 'from app.engine.context import create_service_context\n'), ((507, 535), 'logging.getLogger', 'logging.getLogger', (['"""uvicorn"""'], {}), "('uvicorn')\n", (524, 535), False, 'import logging\n'), (... |
import logging
import os
from llama_index import (
StorageContext,
load_index_from_storage,
)
from app.engine.constants import STORAGE_DIR
from app.engine.context import create_service_context
def get_chat_engine():
service_context = create_service_context()
# check if storage already exists
if n... | [
"llama_index.StorageContext.from_defaults",
"llama_index.load_index_from_storage"
] | [((249, 273), 'app.engine.context.create_service_context', 'create_service_context', ([], {}), '()\n', (271, 273), False, 'from app.engine.context import create_service_context\n'), ((507, 535), 'logging.getLogger', 'logging.getLogger', (['"""uvicorn"""'], {}), "('uvicorn')\n", (524, 535), False, 'import logging\n'), (... |
import logging
import os
from llama_index import (
StorageContext,
load_index_from_storage,
)
from app.engine.constants import STORAGE_DIR
from app.engine.context import create_service_context
def get_chat_engine():
service_context = create_service_context()
# check if storage already exists
if n... | [
"llama_index.StorageContext.from_defaults",
"llama_index.load_index_from_storage"
] | [((249, 273), 'app.engine.context.create_service_context', 'create_service_context', ([], {}), '()\n', (271, 273), False, 'from app.engine.context import create_service_context\n'), ((507, 535), 'logging.getLogger', 'logging.getLogger', (['"""uvicorn"""'], {}), "('uvicorn')\n", (524, 535), False, 'import logging\n'), (... |
import logging
import os
from llama_index import (
StorageContext,
load_index_from_storage,
)
from app.engine.constants import STORAGE_DIR
from app.engine.context import create_service_context
def get_chat_engine():
service_context = create_service_context()
# check if storage already exists
if n... | [
"llama_index.StorageContext.from_defaults",
"llama_index.load_index_from_storage"
] | [((249, 273), 'app.engine.context.create_service_context', 'create_service_context', ([], {}), '()\n', (271, 273), False, 'from app.engine.context import create_service_context\n'), ((507, 535), 'logging.getLogger', 'logging.getLogger', (['"""uvicorn"""'], {}), "('uvicorn')\n", (524, 535), False, 'import logging\n'), (... |
from llama_index import PromptTemplate
instruction_str = """\
1. Convert the query to executable Python code using Pandas.
2. The final line of code should be a Python expression that can be called with the `eval()` function.
3. The code should represent a solution to the query.
4. PRINT ONLY THE EXPR... | [
"llama_index.PromptTemplate"
] | [((381, 660), 'llama_index.PromptTemplate', 'PromptTemplate', (['""" You are working with a pandas dataframe in Python.\n The name of the dataframe is `df`.\n This is the result of `print(df.head())`:\n {df_str}\n\n Follow these instructions:\n {instruction_str}\n Query: {query_str}\n\n Expressi... |
from llama_index import PromptTemplate
instruction_str = """\
1. Convert the query to executable Python code using Pandas.
2. The final line of code should be a Python expression that can be called with the `eval()` function.
3. The code should represent a solution to the query.
4. PRINT ONLY THE EXPR... | [
"llama_index.PromptTemplate"
] | [((381, 660), 'llama_index.PromptTemplate', 'PromptTemplate', (['""" You are working with a pandas dataframe in Python.\n The name of the dataframe is `df`.\n This is the result of `print(df.head())`:\n {df_str}\n\n Follow these instructions:\n {instruction_str}\n Query: {query_str}\n\n Expressi... |
from typing import Union, Optional, List
from llama_index.chat_engine.types import BaseChatEngine, ChatMode
from llama_index.embeddings.utils import EmbedType
from llama_index.chat_engine import ContextChatEngine
from llama_index.memory import ChatMemoryBuffer
from lyzr.base.llm import LyzrLLMFactory
from lyzr.base.s... | [
"llama_index.memory.ChatMemoryBuffer.from_defaults"
] | [((1242, 1430), 'lyzr.utils.document_reading.read_pdf_as_documents', 'read_pdf_as_documents', ([], {'input_dir': 'input_dir', 'input_files': 'input_files', 'exclude_hidden': 'exclude_hidden', 'filename_as_id': 'filename_as_id', 'recursive': 'recursive', 'required_exts': 'required_exts'}), '(input_dir=input_dir, input_f... |
from typing import Union, Optional, List
from llama_index.chat_engine.types import BaseChatEngine, ChatMode
from llama_index.embeddings.utils import EmbedType
from llama_index.chat_engine import ContextChatEngine
from llama_index.memory import ChatMemoryBuffer
from lyzr.base.llm import LyzrLLMFactory
from lyzr.base.s... | [
"llama_index.memory.ChatMemoryBuffer.from_defaults"
] | [((1242, 1430), 'lyzr.utils.document_reading.read_pdf_as_documents', 'read_pdf_as_documents', ([], {'input_dir': 'input_dir', 'input_files': 'input_files', 'exclude_hidden': 'exclude_hidden', 'filename_as_id': 'filename_as_id', 'recursive': 'recursive', 'required_exts': 'required_exts'}), '(input_dir=input_dir, input_f... |
"""Agent utils."""
from llama_index.core.agent.types import TaskStep
from llama_index.core.base.llms.types import ChatMessage, MessageRole
from llama_index.core.memory import BaseMemory
def add_user_step_to_memory(
step: TaskStep, memory: BaseMemory, verbose: bool = False
) -> None:
"""Add user step to memor... | [
"llama_index.core.base.llms.types.ChatMessage"
] | [((345, 399), 'llama_index.core.base.llms.types.ChatMessage', 'ChatMessage', ([], {'content': 'step.input', 'role': 'MessageRole.USER'}), '(content=step.input, role=MessageRole.USER)\n', (356, 399), False, 'from llama_index.core.base.llms.types import ChatMessage, MessageRole\n')] |
"""Agent utils."""
from llama_index.core.agent.types import TaskStep
from llama_index.core.base.llms.types import ChatMessage, MessageRole
from llama_index.core.memory import BaseMemory
def add_user_step_to_memory(
step: TaskStep, memory: BaseMemory, verbose: bool = False
) -> None:
"""Add user step to memor... | [
"llama_index.core.base.llms.types.ChatMessage"
] | [((345, 399), 'llama_index.core.base.llms.types.ChatMessage', 'ChatMessage', ([], {'content': 'step.input', 'role': 'MessageRole.USER'}), '(content=step.input, role=MessageRole.USER)\n', (356, 399), False, 'from llama_index.core.base.llms.types import ChatMessage, MessageRole\n')] |
from llama_index.core.tools import FunctionTool
def calculate_average(*values):
"""
Calculates the average of the provided values.
"""
return sum(values) / len(values)
average_tool = FunctionTool.from_defaults(
fn=calculate_average
)
| [
"llama_index.core.tools.FunctionTool.from_defaults"
] | [((200, 248), 'llama_index.core.tools.FunctionTool.from_defaults', 'FunctionTool.from_defaults', ([], {'fn': 'calculate_average'}), '(fn=calculate_average)\n', (226, 248), False, 'from llama_index.core.tools import FunctionTool\n')] |
#ingest uploaded documents
from global_settings import STORAGE_PATH, INDEX_STORAGE, CACHE_FILE
from logging_functions import log_action
from llama_index.core import SimpleDirectoryReader, VectorStoreIndex
from llama_index.core.ingestion import IngestionPipeline, IngestionCache
from llama_index.core.node_parser import T... | [
"llama_index.core.extractors.SummaryExtractor",
"llama_index.core.ingestion.IngestionCache.from_persist_path",
"llama_index.core.SimpleDirectoryReader",
"llama_index.core.node_parser.TokenTextSplitter",
"llama_index.embeddings.openai.OpenAIEmbedding"
] | [((644, 711), 'logging_functions.log_action', 'log_action', (['f"""File \'{doc.id_}\' uploaded user"""'], {'action_type': '"""UPLOAD"""'}), '(f"File \'{doc.id_}\' uploaded user", action_type=\'UPLOAD\')\n', (654, 711), False, 'from logging_functions import log_action\n'), ((786, 830), 'llama_index.core.ingestion.Ingest... |
import tiktoken
from llama_index.core import TreeIndex, SimpleDirectoryReader, Settings
from llama_index.core.llms.mock import MockLLM
from llama_index.core.callbacks import CallbackManager, TokenCountingHandler
llm = MockLLM(max_tokens=256)
token_counter = TokenCountingHandler(
tokenizer=tiktoken.encoding_for_mod... | [
"llama_index.core.TreeIndex.from_documents",
"llama_index.core.callbacks.CallbackManager",
"llama_index.core.SimpleDirectoryReader",
"llama_index.core.llms.mock.MockLLM"
] | [((219, 242), 'llama_index.core.llms.mock.MockLLM', 'MockLLM', ([], {'max_tokens': '(256)'}), '(max_tokens=256)\n', (226, 242), False, 'from llama_index.core.llms.mock import MockLLM\n'), ((368, 400), 'llama_index.core.callbacks.CallbackManager', 'CallbackManager', (['[token_counter]'], {}), '([token_counter])\n', (383... |
"""Llama Dataset Class."""
import asyncio
import time
from typing import List, Optional
from llama_index.core.base.base_query_engine import BaseQueryEngine
from llama_index.core.bridge.pydantic import Field
from llama_index.core.llama_dataset.base import (
BaseLlamaDataExample,
BaseLlamaDataset,
BaseLlama... | [
"llama_index.core.bridge.pydantic.Field"
] | [((764, 909), 'llama_index.core.bridge.pydantic.Field', 'Field', ([], {'default_factory': 'str', 'description': '"""The generated (predicted) response that can be compared to a reference (ground-truth) answer."""'}), "(default_factory=str, description=\n 'The generated (predicted) response that can be compared to a ... |
"""Llama Dataset Class."""
import asyncio
import time
from typing import List, Optional
from llama_index.core.base.base_query_engine import BaseQueryEngine
from llama_index.core.bridge.pydantic import Field
from llama_index.core.llama_dataset.base import (
BaseLlamaDataExample,
BaseLlamaDataset,
BaseLlama... | [
"llama_index.core.bridge.pydantic.Field"
] | [((764, 909), 'llama_index.core.bridge.pydantic.Field', 'Field', ([], {'default_factory': 'str', 'description': '"""The generated (predicted) response that can be compared to a reference (ground-truth) answer."""'}), "(default_factory=str, description=\n 'The generated (predicted) response that can be compared to a ... |
"""Llama Dataset Class."""
import asyncio
import time
from typing import List, Optional
from llama_index.core.base.base_query_engine import BaseQueryEngine
from llama_index.core.bridge.pydantic import Field
from llama_index.core.llama_dataset.base import (
BaseLlamaDataExample,
BaseLlamaDataset,
BaseLlama... | [
"llama_index.core.bridge.pydantic.Field"
] | [((764, 909), 'llama_index.core.bridge.pydantic.Field', 'Field', ([], {'default_factory': 'str', 'description': '"""The generated (predicted) response that can be compared to a reference (ground-truth) answer."""'}), "(default_factory=str, description=\n 'The generated (predicted) response that can be compared to a ... |
from llama_index.core.base.llms.types import (
ChatMessage,
ChatResponse,
ChatResponseGen,
MessageRole,
)
from llama_index.core.types import TokenGen
def response_gen_from_query_engine(response_gen: TokenGen) -> ChatResponseGen:
response_str = ""
for token in response_gen:
response_str... | [
"llama_index.core.base.llms.types.ChatMessage"
] | [((378, 439), 'llama_index.core.base.llms.types.ChatMessage', 'ChatMessage', ([], {'role': 'MessageRole.ASSISTANT', 'content': 'response_str'}), '(role=MessageRole.ASSISTANT, content=response_str)\n', (389, 439), False, 'from llama_index.core.base.llms.types import ChatMessage, ChatResponse, ChatResponseGen, MessageRol... |
from llama_index.core.base.llms.types import (
ChatMessage,
ChatResponse,
ChatResponseGen,
MessageRole,
)
from llama_index.core.types import TokenGen
def response_gen_from_query_engine(response_gen: TokenGen) -> ChatResponseGen:
response_str = ""
for token in response_gen:
response_str... | [
"llama_index.core.base.llms.types.ChatMessage"
] | [((378, 439), 'llama_index.core.base.llms.types.ChatMessage', 'ChatMessage', ([], {'role': 'MessageRole.ASSISTANT', 'content': 'response_str'}), '(role=MessageRole.ASSISTANT, content=response_str)\n', (389, 439), False, 'from llama_index.core.base.llms.types import ChatMessage, ChatResponse, ChatResponseGen, MessageRol... |
from llama_index.core.base.llms.types import (
ChatMessage,
ChatResponse,
ChatResponseGen,
MessageRole,
)
from llama_index.core.types import TokenGen
def response_gen_from_query_engine(response_gen: TokenGen) -> ChatResponseGen:
response_str = ""
for token in response_gen:
response_str... | [
"llama_index.core.base.llms.types.ChatMessage"
] | [((378, 439), 'llama_index.core.base.llms.types.ChatMessage', 'ChatMessage', ([], {'role': 'MessageRole.ASSISTANT', 'content': 'response_str'}), '(role=MessageRole.ASSISTANT, content=response_str)\n', (389, 439), False, 'from llama_index.core.base.llms.types import ChatMessage, ChatResponse, ChatResponseGen, MessageRol... |
"""DashScope llm api."""
from http import HTTPStatus
from typing import Any, Dict, List, Optional, Sequence, Tuple
from llama_index.legacy.bridge.pydantic import Field
from llama_index.legacy.callbacks import CallbackManager
from llama_index.legacy.constants import DEFAULT_NUM_OUTPUTS, DEFAULT_TEMPERATURE
from llama_... | [
"llama_index.legacy.core.llms.types.CompletionResponse",
"llama_index.legacy.llms.dashscope_utils.chat_message_to_dashscope_messages",
"llama_index.legacy.llms.dashscope_utils.dashscope_response_to_chat_response",
"llama_index.legacy.core.llms.types.LLMMetadata",
"llama_index.legacy.llms.base.llm_chat_callb... | [((2272, 2350), 'dashscope.Generation.call', 'Generation.call', ([], {'model': 'model', 'messages': 'messages', 'api_key': 'api_key'}), '(model=model, messages=messages, api_key=api_key, **parameters)\n', (2287, 2350), False, 'from dashscope import Generation\n'), ((2443, 2540), 'llama_index.legacy.bridge.pydantic.Fiel... |
"""DashScope llm api."""
from http import HTTPStatus
from typing import Any, Dict, List, Optional, Sequence, Tuple
from llama_index.legacy.bridge.pydantic import Field
from llama_index.legacy.callbacks import CallbackManager
from llama_index.legacy.constants import DEFAULT_NUM_OUTPUTS, DEFAULT_TEMPERATURE
from llama_... | [
"llama_index.legacy.core.llms.types.CompletionResponse",
"llama_index.legacy.llms.dashscope_utils.chat_message_to_dashscope_messages",
"llama_index.legacy.llms.dashscope_utils.dashscope_response_to_chat_response",
"llama_index.legacy.core.llms.types.LLMMetadata",
"llama_index.legacy.llms.base.llm_chat_callb... | [((2272, 2350), 'dashscope.Generation.call', 'Generation.call', ([], {'model': 'model', 'messages': 'messages', 'api_key': 'api_key'}), '(model=model, messages=messages, api_key=api_key, **parameters)\n', (2287, 2350), False, 'from dashscope import Generation\n'), ((2443, 2540), 'llama_index.legacy.bridge.pydantic.Fiel... |
"""Relevancy evaluation."""
from __future__ import annotations
import asyncio
from typing import Any, Optional, Sequence, Union
from llama_index.core import ServiceContext
from llama_index.core.evaluation.base import BaseEvaluator, EvaluationResult
from llama_index.core.indices import SummaryIndex
from llama_index.co... | [
"llama_index.core.prompts.PromptTemplate",
"llama_index.core.settings.llm_from_settings_or_context",
"llama_index.core.evaluation.base.EvaluationResult",
"llama_index.core.schema.Document",
"llama_index.core.indices.SummaryIndex.from_documents"
] | [((620, 974), 'llama_index.core.prompts.PromptTemplate', 'PromptTemplate', (['"""Your task is to evaluate if the response for the query is in line with the context information provided.\nYou have two options to answer. Either YES/ NO.\nAnswer - YES, if the response for the query is in line with context informat... |
"""Relevancy evaluation."""
from __future__ import annotations
import asyncio
from typing import Any, Optional, Sequence, Union
from llama_index.core import ServiceContext
from llama_index.core.evaluation.base import BaseEvaluator, EvaluationResult
from llama_index.core.indices import SummaryIndex
from llama_index.co... | [
"llama_index.core.prompts.PromptTemplate",
"llama_index.core.settings.llm_from_settings_or_context",
"llama_index.core.evaluation.base.EvaluationResult",
"llama_index.core.schema.Document",
"llama_index.core.indices.SummaryIndex.from_documents"
] | [((620, 974), 'llama_index.core.prompts.PromptTemplate', 'PromptTemplate', (['"""Your task is to evaluate if the response for the query is in line with the context information provided.\nYou have two options to answer. Either YES/ NO.\nAnswer - YES, if the response for the query is in line with context informat... |
"""Base tool spec class."""
import asyncio
from inspect import signature
from typing import Any, Awaitable, Callable, Dict, List, Optional, Tuple, Type, Union
from llama_index.core.bridge.pydantic import BaseModel
from llama_index.core.tools.function_tool import FunctionTool
from llama_index.core.tools.types import ... | [
"llama_index.core.tools.function_tool.FunctionTool.from_defaults",
"llama_index.core.tools.types.ToolMetadata"
] | [((2092, 2161), 'llama_index.core.tools.types.ToolMetadata', 'ToolMetadata', ([], {'name': 'name', 'description': 'description', 'fn_schema': 'fn_schema'}), '(name=name, description=description, fn_schema=fn_schema)\n', (2104, 2161), False, 'from llama_index.core.tools.types import ToolMetadata\n'), ((4457, 4481), 'asy... |
"""Base tool spec class."""
import asyncio
from inspect import signature
from typing import Any, Awaitable, Callable, Dict, List, Optional, Tuple, Type, Union
from llama_index.core.bridge.pydantic import BaseModel
from llama_index.core.tools.function_tool import FunctionTool
from llama_index.core.tools.types import ... | [
"llama_index.core.tools.function_tool.FunctionTool.from_defaults",
"llama_index.core.tools.types.ToolMetadata"
] | [((2092, 2161), 'llama_index.core.tools.types.ToolMetadata', 'ToolMetadata', ([], {'name': 'name', 'description': 'description', 'fn_schema': 'fn_schema'}), '(name=name, description=description, fn_schema=fn_schema)\n', (2104, 2161), False, 'from llama_index.core.tools.types import ToolMetadata\n'), ((4457, 4481), 'asy... |
"""Node parser interface."""
from abc import ABC, abstractmethod
from typing import Any, Callable, List, Sequence
from llama_index.core.bridge.pydantic import Field, validator
from llama_index.core.callbacks import CallbackManager, CBEventType, EventPayload
from llama_index.core.node_parser.node_utils import (
bu... | [
"llama_index.core.utils.get_tqdm_iterable",
"llama_index.core.node_parser.node_utils.build_nodes_from_splits",
"llama_index.core.bridge.pydantic.validator",
"llama_index.core.bridge.pydantic.Field"
] | [((668, 759), 'llama_index.core.bridge.pydantic.Field', 'Field', ([], {'default': '(True)', 'description': '"""Whether or not to consider metadata when splitting."""'}), "(default=True, description=\n 'Whether or not to consider metadata when splitting.')\n", (673, 759), False, 'from llama_index.core.bridge.pydantic... |
"""Node parser interface."""
from abc import ABC, abstractmethod
from typing import Any, Callable, List, Sequence
from llama_index.core.bridge.pydantic import Field, validator
from llama_index.core.callbacks import CallbackManager, CBEventType, EventPayload
from llama_index.core.node_parser.node_utils import (
bu... | [
"llama_index.core.utils.get_tqdm_iterable",
"llama_index.core.node_parser.node_utils.build_nodes_from_splits",
"llama_index.core.bridge.pydantic.validator",
"llama_index.core.bridge.pydantic.Field"
] | [((668, 759), 'llama_index.core.bridge.pydantic.Field', 'Field', ([], {'default': '(True)', 'description': '"""Whether or not to consider metadata when splitting."""'}), "(default=True, description=\n 'Whether or not to consider metadata when splitting.')\n", (673, 759), False, 'from llama_index.core.bridge.pydantic... |
"""Tree Index inserter."""
from typing import Optional, Sequence
from llama_index.core.data_structs.data_structs import IndexGraph
from llama_index.core.indices.prompt_helper import PromptHelper
from llama_index.core.indices.tree.utils import get_numbered_text_from_nodes
from llama_index.core.indices.utils import (
... | [
"llama_index.core.indices.tree.utils.get_numbered_text_from_nodes",
"llama_index.core.settings.llm_from_settings_or_context",
"llama_index.core.storage.docstore.registry.get_default_docstore",
"llama_index.core.indices.utils.extract_numbers_given_response",
"llama_index.core.schema.TextNode",
"llama_index... | [((5228, 5265), 'llama_index.core.indices.utils.get_sorted_node_list', 'get_sorted_node_list', (['cur_graph_nodes'], {}), '(cur_graph_nodes)\n', (5248, 5265), False, 'from llama_index.core.indices.utils import extract_numbers_given_response, get_sorted_node_list\n'), ((1733, 1788), 'llama_index.core.settings.llm_from_s... |
"""Tree Index inserter."""
from typing import Optional, Sequence
from llama_index.core.data_structs.data_structs import IndexGraph
from llama_index.core.indices.prompt_helper import PromptHelper
from llama_index.core.indices.tree.utils import get_numbered_text_from_nodes
from llama_index.core.indices.utils import (
... | [
"llama_index.core.indices.tree.utils.get_numbered_text_from_nodes",
"llama_index.core.settings.llm_from_settings_or_context",
"llama_index.core.storage.docstore.registry.get_default_docstore",
"llama_index.core.indices.utils.extract_numbers_given_response",
"llama_index.core.schema.TextNode",
"llama_index... | [((5228, 5265), 'llama_index.core.indices.utils.get_sorted_node_list', 'get_sorted_node_list', (['cur_graph_nodes'], {}), '(cur_graph_nodes)\n', (5248, 5265), False, 'from llama_index.core.indices.utils import extract_numbers_given_response, get_sorted_node_list\n'), ((1733, 1788), 'llama_index.core.settings.llm_from_s... |
"""JSON node parser."""
import json
from typing import Any, Dict, Generator, List, Optional, Sequence
from llama_index.core.callbacks.base import CallbackManager
from llama_index.core.node_parser.interface import NodeParser
from llama_index.core.node_parser.node_utils import build_nodes_from_splits
from llama_index.co... | [
"llama_index.core.callbacks.base.CallbackManager",
"llama_index.core.utils.get_tqdm_iterable"
] | [((1510, 1566), 'llama_index.core.utils.get_tqdm_iterable', 'get_tqdm_iterable', (['nodes', 'show_progress', '"""Parsing nodes"""'], {}), "(nodes, show_progress, 'Parsing nodes')\n", (1527, 1566), False, 'from llama_index.core.utils import get_tqdm_iterable\n'), ((995, 1014), 'llama_index.core.callbacks.base.CallbackMa... |
"""JSON node parser."""
import json
from typing import Any, Dict, Generator, List, Optional, Sequence
from llama_index.core.callbacks.base import CallbackManager
from llama_index.core.node_parser.interface import NodeParser
from llama_index.core.node_parser.node_utils import build_nodes_from_splits
from llama_index.co... | [
"llama_index.core.callbacks.base.CallbackManager",
"llama_index.core.utils.get_tqdm_iterable"
] | [((1510, 1566), 'llama_index.core.utils.get_tqdm_iterable', 'get_tqdm_iterable', (['nodes', 'show_progress', '"""Parsing nodes"""'], {}), "(nodes, show_progress, 'Parsing nodes')\n", (1527, 1566), False, 'from llama_index.core.utils import get_tqdm_iterable\n'), ((995, 1014), 'llama_index.core.callbacks.base.CallbackMa... |
"""JSON node parser."""
import json
from typing import Any, Dict, Generator, List, Optional, Sequence
from llama_index.core.callbacks.base import CallbackManager
from llama_index.core.node_parser.interface import NodeParser
from llama_index.core.node_parser.node_utils import build_nodes_from_splits
from llama_index.co... | [
"llama_index.core.callbacks.base.CallbackManager",
"llama_index.core.utils.get_tqdm_iterable"
] | [((1510, 1566), 'llama_index.core.utils.get_tqdm_iterable', 'get_tqdm_iterable', (['nodes', 'show_progress', '"""Parsing nodes"""'], {}), "(nodes, show_progress, 'Parsing nodes')\n", (1527, 1566), False, 'from llama_index.core.utils import get_tqdm_iterable\n'), ((995, 1014), 'llama_index.core.callbacks.base.CallbackMa... |
from typing import TYPE_CHECKING, Any, Optional
from llama_index.legacy.core.base_query_engine import BaseQueryEngine
if TYPE_CHECKING:
from llama_index.legacy.langchain_helpers.agents.tools import (
LlamaIndexTool,
)
from llama_index.legacy.tools.types import AsyncBaseTool, ToolMetadata, ToolOutput
... | [
"llama_index.legacy.langchain_helpers.agents.tools.LlamaIndexTool.from_tool_config",
"llama_index.legacy.tools.types.ToolMetadata",
"llama_index.legacy.langchain_helpers.agents.tools.IndexToolConfig"
] | [((1408, 1456), 'llama_index.legacy.tools.types.ToolMetadata', 'ToolMetadata', ([], {'name': 'name', 'description': 'description'}), '(name=name, description=description)\n', (1420, 1456), False, 'from llama_index.legacy.tools.types import AsyncBaseTool, ToolMetadata, ToolOutput\n'), ((3568, 3683), 'llama_index.legacy.... |
from llama_index.core.llama_dataset import download_llama_dataset
from llama_index.core.llama_pack import download_llama_pack
from llama_index.core import VectorStoreIndex
async def main():
# DOWNLOAD LLAMADATASET
rag_dataset, documents = download_llama_dataset(
"EvaluatingLlmSurveyPaperDataset", "./d... | [
"llama_index.core.llama_dataset.download_llama_dataset",
"llama_index.core.llama_pack.download_llama_pack",
"llama_index.core.VectorStoreIndex.from_documents"
] | [((249, 316), 'llama_index.core.llama_dataset.download_llama_dataset', 'download_llama_dataset', (['"""EvaluatingLlmSurveyPaperDataset"""', '"""./data"""'], {}), "('EvaluatingLlmSurveyPaperDataset', './data')\n", (271, 316), False, 'from llama_index.core.llama_dataset import download_llama_dataset\n'), ((375, 427), 'll... |
from llama_index.core.llama_dataset import download_llama_dataset
from llama_index.core.llama_pack import download_llama_pack
from llama_index.core import VectorStoreIndex
async def main():
# DOWNLOAD LLAMADATASET
rag_dataset, documents = download_llama_dataset(
"EvaluatingLlmSurveyPaperDataset", "./d... | [
"llama_index.core.llama_dataset.download_llama_dataset",
"llama_index.core.llama_pack.download_llama_pack",
"llama_index.core.VectorStoreIndex.from_documents"
] | [((249, 316), 'llama_index.core.llama_dataset.download_llama_dataset', 'download_llama_dataset', (['"""EvaluatingLlmSurveyPaperDataset"""', '"""./data"""'], {}), "('EvaluatingLlmSurveyPaperDataset', './data')\n", (271, 316), False, 'from llama_index.core.llama_dataset import download_llama_dataset\n'), ((375, 427), 'll... |
import json
import os
import warnings
from enum import Enum
from typing import Any, Callable, Dict, List, Literal, Optional, Sequence
from deprecated import deprecated
from llama_index.legacy.bridge.pydantic import Field, PrivateAttr
from llama_index.legacy.callbacks.base import CallbackManager
from llama_index.legac... | [
"llama_index.legacy.bridge.pydantic.PrivateAttr",
"llama_index.legacy.bridge.pydantic.Field"
] | [((1210, 1271), 'llama_index.legacy.bridge.pydantic.Field', 'Field', ([], {'description': '"""The modelId of the Bedrock model to use."""'}), "(description='The modelId of the Bedrock model to use.')\n", (1215, 1271), False, 'from llama_index.legacy.bridge.pydantic import Field, PrivateAttr\n'), ((1306, 1430), 'llama_i... |
import json
import os
import warnings
from enum import Enum
from typing import Any, Callable, Dict, List, Literal, Optional, Sequence
from deprecated import deprecated
from llama_index.legacy.bridge.pydantic import Field, PrivateAttr
from llama_index.legacy.callbacks.base import CallbackManager
from llama_index.legac... | [
"llama_index.legacy.bridge.pydantic.PrivateAttr",
"llama_index.legacy.bridge.pydantic.Field"
] | [((1210, 1271), 'llama_index.legacy.bridge.pydantic.Field', 'Field', ([], {'description': '"""The modelId of the Bedrock model to use."""'}), "(description='The modelId of the Bedrock model to use.')\n", (1215, 1271), False, 'from llama_index.legacy.bridge.pydantic import Field, PrivateAttr\n'), ((1306, 1430), 'llama_i... |
from pathlib import Path
from llama_index import download_loader
from llama_index import SimpleDirectoryReader
PDFReader = download_loader("PDFReader")
def getdocument(filename : str,filetype:str):
if filetype == "pdf":
loader = PDFReader()
elif filetype == "txt":
loader = SimpleDirectoryReade... | [
"llama_index.download_loader",
"llama_index.SimpleDirectoryReader"
] | [((124, 152), 'llama_index.download_loader', 'download_loader', (['"""PDFReader"""'], {}), "('PDFReader')\n", (139, 152), False, 'from llama_index import download_loader\n'), ((300, 334), 'llama_index.SimpleDirectoryReader', 'SimpleDirectoryReader', (['"""./example"""'], {}), "('./example')\n", (321, 334), False, 'from... |
from pathlib import Path
from llama_index import download_loader
from llama_index import SimpleDirectoryReader
PDFReader = download_loader("PDFReader")
def getdocument(filename : str,filetype:str):
if filetype == "pdf":
loader = PDFReader()
elif filetype == "txt":
loader = SimpleDirectoryReade... | [
"llama_index.download_loader",
"llama_index.SimpleDirectoryReader"
] | [((124, 152), 'llama_index.download_loader', 'download_loader', (['"""PDFReader"""'], {}), "('PDFReader')\n", (139, 152), False, 'from llama_index import download_loader\n'), ((300, 334), 'llama_index.SimpleDirectoryReader', 'SimpleDirectoryReader', (['"""./example"""'], {}), "('./example')\n", (321, 334), False, 'from... |
"""Utils for jupyter notebook."""
import os
from io import BytesIO
from typing import Any, Dict, List, Tuple
import matplotlib.pyplot as plt
import requests
from IPython.display import Markdown, display
from llama_index.core.base.response.schema import Response
from llama_index.core.img_utils import b64_2_img
from lla... | [
"llama_index.core.img_utils.b64_2_img"
] | [((723, 741), 'llama_index.core.img_utils.b64_2_img', 'b64_2_img', (['img_str'], {}), '(img_str)\n', (732, 741), False, 'from llama_index.core.img_utils import b64_2_img\n'), ((770, 782), 'IPython.display.display', 'display', (['img'], {}), '(img)\n', (777, 782), False, 'from IPython.display import Markdown, display\n'... |
"""Utils for jupyter notebook."""
import os
from io import BytesIO
from typing import Any, Dict, List, Tuple
import matplotlib.pyplot as plt
import requests
from IPython.display import Markdown, display
from llama_index.core.base.response.schema import Response
from llama_index.core.img_utils import b64_2_img
from lla... | [
"llama_index.core.img_utils.b64_2_img"
] | [((723, 741), 'llama_index.core.img_utils.b64_2_img', 'b64_2_img', (['img_str'], {}), '(img_str)\n', (732, 741), False, 'from llama_index.core.img_utils import b64_2_img\n'), ((770, 782), 'IPython.display.display', 'display', (['img'], {}), '(img)\n', (777, 782), False, 'from IPython.display import Markdown, display\n'... |
from typing import Optional, Type
from llama_index.legacy.download.module import (
LLAMA_HUB_URL,
MODULE_TYPE,
download_llama_module,
track_download,
)
from llama_index.legacy.llama_pack.base import BaseLlamaPack
def download_llama_pack(
llama_pack_class: str,
download_dir: str,
llama_hub... | [
"llama_index.legacy.download.module.download_llama_module",
"llama_index.legacy.download.module.track_download"
] | [((887, 1134), 'llama_index.legacy.download.module.download_llama_module', 'download_llama_module', (['llama_pack_class'], {'llama_hub_url': 'llama_hub_url', 'refresh_cache': 'refresh_cache', 'custom_path': 'download_dir', 'library_path': '"""llama_packs/library.json"""', 'disable_library_cache': '(True)', 'override_pa... |
from typing import Any, Dict, List, Optional, Sequence, Tuple
from llama_index.core.base.response.schema import RESPONSE_TYPE, Response
from llama_index.core.callbacks.base import CallbackManager
from llama_index.core.callbacks.schema import CBEventType, EventPayload
from llama_index.core.indices.multi_modal import Mu... | [
"llama_index.core.callbacks.base.CallbackManager",
"llama_index.multi_modal_llms.openai.OpenAIMultiModal"
] | [((3353, 3372), 'llama_index.core.callbacks.base.CallbackManager', 'CallbackManager', (['[]'], {}), '([])\n', (3368, 3372), False, 'from llama_index.core.callbacks.base import CallbackManager\n'), ((2707, 2774), 'llama_index.multi_modal_llms.openai.OpenAIMultiModal', 'OpenAIMultiModal', ([], {'model': '"""gpt-4-vision-... |
import json
from typing import Sequence
from llama_index.legacy.prompts.base import PromptTemplate
from llama_index.legacy.question_gen.types import SubQuestion
from llama_index.legacy.tools.types import ToolMetadata
# deprecated, kept for backward compatibility
SubQuestionPrompt = PromptTemplate
def build_tools_te... | [
"llama_index.legacy.question_gen.types.SubQuestion",
"llama_index.legacy.tools.types.ToolMetadata"
] | [((465, 497), 'json.dumps', 'json.dumps', (['tools_dict'], {'indent': '(4)'}), '(tools_dict, indent=4)\n', (475, 497), False, 'import json\n'), ((817, 923), 'llama_index.legacy.tools.types.ToolMetadata', 'ToolMetadata', ([], {'name': '"""uber_10k"""', 'description': '"""Provides information about Uber financials for ye... |
from typing import Any, List, Optional
from llama_index.legacy.bridge.pydantic import Field, PrivateAttr
from llama_index.legacy.callbacks import CallbackManager
from llama_index.legacy.core.embeddings.base import (
DEFAULT_EMBED_BATCH_SIZE,
BaseEmbedding,
)
from llama_index.legacy.embeddings.huggingface_utils... | [
"llama_index.legacy.embeddings.huggingface_utils.get_query_instruct_for_model_name",
"llama_index.legacy.embeddings.huggingface_utils.get_text_instruct_for_model_name",
"llama_index.legacy.bridge.pydantic.PrivateAttr",
"llama_index.legacy.bridge.pydantic.Field"
] | [((520, 578), 'llama_index.legacy.bridge.pydantic.Field', 'Field', ([], {'description': '"""Instruction to prepend to query text."""'}), "(description='Instruction to prepend to query text.')\n", (525, 578), False, 'from llama_index.legacy.bridge.pydantic import Field, PrivateAttr\n'), ((631, 683), 'llama_index.legacy.... |
from typing import Any, List, Optional
from llama_index.legacy.bridge.pydantic import Field, PrivateAttr
from llama_index.legacy.callbacks import CallbackManager
from llama_index.legacy.core.embeddings.base import (
DEFAULT_EMBED_BATCH_SIZE,
BaseEmbedding,
)
from llama_index.legacy.embeddings.huggingface_utils... | [
"llama_index.legacy.embeddings.huggingface_utils.get_query_instruct_for_model_name",
"llama_index.legacy.embeddings.huggingface_utils.get_text_instruct_for_model_name",
"llama_index.legacy.bridge.pydantic.PrivateAttr",
"llama_index.legacy.bridge.pydantic.Field"
] | [((520, 578), 'llama_index.legacy.bridge.pydantic.Field', 'Field', ([], {'description': '"""Instruction to prepend to query text."""'}), "(description='Instruction to prepend to query text.')\n", (525, 578), False, 'from llama_index.legacy.bridge.pydantic import Field, PrivateAttr\n'), ((631, 683), 'llama_index.legacy.... |
"""Base retrieval abstractions."""
import asyncio
from abc import abstractmethod
from enum import Enum
from typing import Any, Dict, List, Optional, Tuple
from llama_index.core.bridge.pydantic import BaseModel, Field
from llama_index.core.evaluation.retrieval.metrics import resolve_metrics
from llama_index.core.evalu... | [
"llama_index.core.evaluation.retrieval.metrics.resolve_metrics",
"llama_index.core.bridge.pydantic.Field"
] | [((1364, 1402), 'llama_index.core.bridge.pydantic.Field', 'Field', (['...'], {'description': '"""Query string"""'}), "(..., description='Query string')\n", (1369, 1402), False, 'from llama_index.core.bridge.pydantic import BaseModel, Field\n'), ((1433, 1471), 'llama_index.core.bridge.pydantic.Field', 'Field', (['...'],... |
"""Base retrieval abstractions."""
import asyncio
from abc import abstractmethod
from enum import Enum
from typing import Any, Dict, List, Optional, Tuple
from llama_index.core.bridge.pydantic import BaseModel, Field
from llama_index.core.evaluation.retrieval.metrics import resolve_metrics
from llama_index.core.evalu... | [
"llama_index.core.evaluation.retrieval.metrics.resolve_metrics",
"llama_index.core.bridge.pydantic.Field"
] | [((1364, 1402), 'llama_index.core.bridge.pydantic.Field', 'Field', (['...'], {'description': '"""Query string"""'}), "(..., description='Query string')\n", (1369, 1402), False, 'from llama_index.core.bridge.pydantic import BaseModel, Field\n'), ((1433, 1471), 'llama_index.core.bridge.pydantic.Field', 'Field', (['...'],... |
"""Code splitter."""
from typing import Any, Callable, List, Optional
from llama_index.legacy.bridge.pydantic import Field, PrivateAttr
from llama_index.legacy.callbacks.base import CallbackManager
from llama_index.legacy.callbacks.schema import CBEventType, EventPayload
from llama_index.legacy.node_parser.interface ... | [
"llama_index.legacy.bridge.pydantic.PrivateAttr",
"llama_index.legacy.bridge.pydantic.Field",
"llama_index.legacy.callbacks.base.CallbackManager"
] | [((779, 849), 'llama_index.legacy.bridge.pydantic.Field', 'Field', ([], {'description': '"""The programming language of the code being split."""'}), "(description='The programming language of the code being split.')\n", (784, 849), False, 'from llama_index.legacy.bridge.pydantic import Field, PrivateAttr\n'), ((887, 99... |
import asyncio
from llama_index.core.llama_dataset import download_llama_dataset
from llama_index.core.llama_pack import download_llama_pack
from llama_index.core import VectorStoreIndex
from llama_index.llms import OpenAI
async def main():
# DOWNLOAD LLAMADATASET
rag_dataset, documents = download_llama_data... | [
"llama_index.core.llama_dataset.download_llama_dataset",
"llama_index.core.llama_pack.download_llama_pack",
"llama_index.core.VectorStoreIndex.from_documents",
"llama_index.llms.OpenAI"
] | [((301, 376), 'llama_index.core.llama_dataset.download_llama_dataset', 'download_llama_dataset', (['"""DocugamiKgRagSec10Q"""', '"""./docugami_kg_rag_sec_10_q"""'], {}), "('DocugamiKgRagSec10Q', './docugami_kg_rag_sec_10_q')\n", (323, 376), False, 'from llama_index.core.llama_dataset import download_llama_dataset\n'), ... |
import asyncio
from llama_index.core.llama_dataset import download_llama_dataset
from llama_index.core.llama_pack import download_llama_pack
from llama_index.core import VectorStoreIndex
from llama_index.llms import OpenAI
async def main():
# DOWNLOAD LLAMADATASET
rag_dataset, documents = download_llama_data... | [
"llama_index.core.llama_dataset.download_llama_dataset",
"llama_index.core.llama_pack.download_llama_pack",
"llama_index.core.VectorStoreIndex.from_documents",
"llama_index.llms.OpenAI"
] | [((301, 376), 'llama_index.core.llama_dataset.download_llama_dataset', 'download_llama_dataset', (['"""DocugamiKgRagSec10Q"""', '"""./docugami_kg_rag_sec_10_q"""'], {}), "('DocugamiKgRagSec10Q', './docugami_kg_rag_sec_10_q')\n", (323, 376), False, 'from llama_index.core.llama_dataset import download_llama_dataset\n'), ... |
"""Table node mapping."""
from typing import Any, Dict, Optional, Sequence
from llama_index.core.bridge.pydantic import BaseModel
from llama_index.core.objects.base_node_mapping import (
DEFAULT_PERSIST_DIR,
DEFAULT_PERSIST_FNAME,
BaseObjectNodeMapping,
)
from llama_index.core.schema import BaseNode, Text... | [
"llama_index.core.schema.TextNode"
] | [((1821, 1968), 'llama_index.core.schema.TextNode', 'TextNode', ([], {'text': 'table_text', 'metadata': 'metadata', 'excluded_embed_metadata_keys': "['name', 'context']", 'excluded_llm_metadata_keys': "['name', 'context']"}), "(text=table_text, metadata=metadata, excluded_embed_metadata_keys=[\n 'name', 'context'], ... |
"""Table node mapping."""
from typing import Any, Dict, Optional, Sequence
from llama_index.core.bridge.pydantic import BaseModel
from llama_index.core.objects.base_node_mapping import (
DEFAULT_PERSIST_DIR,
DEFAULT_PERSIST_FNAME,
BaseObjectNodeMapping,
)
from llama_index.core.schema import BaseNode, Text... | [
"llama_index.core.schema.TextNode"
] | [((1821, 1968), 'llama_index.core.schema.TextNode', 'TextNode', ([], {'text': 'table_text', 'metadata': 'metadata', 'excluded_embed_metadata_keys': "['name', 'context']", 'excluded_llm_metadata_keys': "['name', 'context']"}), "(text=table_text, metadata=metadata, excluded_embed_metadata_keys=[\n 'name', 'context'], ... |
"""Table node mapping."""
from typing import Any, Dict, Optional, Sequence
from llama_index.core.bridge.pydantic import BaseModel
from llama_index.core.objects.base_node_mapping import (
DEFAULT_PERSIST_DIR,
DEFAULT_PERSIST_FNAME,
BaseObjectNodeMapping,
)
from llama_index.core.schema import BaseNode, Text... | [
"llama_index.core.schema.TextNode"
] | [((1821, 1968), 'llama_index.core.schema.TextNode', 'TextNode', ([], {'text': 'table_text', 'metadata': 'metadata', 'excluded_embed_metadata_keys': "['name', 'context']", 'excluded_llm_metadata_keys': "['name', 'context']"}), "(text=table_text, metadata=metadata, excluded_embed_metadata_keys=[\n 'name', 'context'], ... |
"""Base query engine."""
import logging
from abc import abstractmethod
from typing import Any, Dict, List, Optional, Sequence
from llama_index.legacy.bridge.pydantic import Field
from llama_index.legacy.callbacks.base import CallbackManager
from llama_index.legacy.core.query_pipeline.query_component import (
Chai... | [
"llama_index.legacy.core.query_pipeline.query_component.OutputKeys.from_keys",
"llama_index.legacy.callbacks.base.CallbackManager",
"llama_index.legacy.schema.QueryBundle",
"llama_index.legacy.core.query_pipeline.query_component.InputKeys.from_keys",
"llama_index.legacy.bridge.pydantic.Field",
"llama_inde... | [((647, 674), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (664, 674), False, 'import logging\n'), ((3066, 3104), 'llama_index.legacy.bridge.pydantic.Field', 'Field', (['...'], {'description': '"""Query engine"""'}), "(..., description='Query engine')\n", (3071, 3104), False, 'from llam... |
import os
from shutil import rmtree
from typing import Callable, Dict, List, Optional
import tqdm
from llama_index.core.base.base_retriever import BaseRetriever
from llama_index.core.postprocessor.types import BaseNodePostprocessor
from llama_index.core.schema import Document, QueryBundle
from llama_index.core.utils i... | [
"llama_index.core.utils.get_cache_dir",
"llama_index.core.schema.QueryBundle",
"llama_index.core.schema.Document"
] | [((861, 876), 'llama_index.core.utils.get_cache_dir', 'get_cache_dir', ([], {}), '()\n', (874, 876), False, 'from llama_index.core.utils import get_cache_dir\n'), ((970, 1025), 'os.path.join', 'os.path.join', (['cache_dir', '"""datasets"""', "('BeIR__' + dataset)"], {}), "(cache_dir, 'datasets', 'BeIR__' + dataset)\n",... |
import os
from shutil import rmtree
from typing import Callable, Dict, List, Optional
import tqdm
from llama_index.core.base.base_retriever import BaseRetriever
from llama_index.core.postprocessor.types import BaseNodePostprocessor
from llama_index.core.schema import Document, QueryBundle
from llama_index.core.utils i... | [
"llama_index.core.utils.get_cache_dir",
"llama_index.core.schema.QueryBundle",
"llama_index.core.schema.Document"
] | [((861, 876), 'llama_index.core.utils.get_cache_dir', 'get_cache_dir', ([], {}), '()\n', (874, 876), False, 'from llama_index.core.utils import get_cache_dir\n'), ((970, 1025), 'os.path.join', 'os.path.join', (['cache_dir', '"""datasets"""', "('BeIR__' + dataset)"], {}), "(cache_dir, 'datasets', 'BeIR__' + dataset)\n",... |
import logging
from typing import Any, Dict, Generator, List, Optional, Tuple, Type, Union, cast
from llama_index.legacy.agent.openai.utils import resolve_tool_choice
from llama_index.legacy.llms.llm import LLM
from llama_index.legacy.llms.openai import OpenAI
from llama_index.legacy.llms.openai_utils import OpenAIToo... | [
"llama_index.legacy.agent.openai.utils.resolve_tool_choice",
"llama_index.legacy.llms.openai_utils.to_openai_tool",
"llama_index.legacy.llms.openai.OpenAI",
"llama_index.legacy.prompts.base.PromptTemplate",
"llama_index.legacy.program.utils.create_list_model"
] | [((619, 646), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (636, 646), False, 'import logging\n'), ((914, 950), 'llama_index.legacy.agent.openai.utils.resolve_tool_choice', 'resolve_tool_choice', (["schema['title']"], {}), "(schema['title'])\n", (933, 950), False, 'from llama_index.lega... |
import logging
from typing import Any, Dict, Generator, List, Optional, Tuple, Type, Union, cast
from llama_index.legacy.agent.openai.utils import resolve_tool_choice
from llama_index.legacy.llms.llm import LLM
from llama_index.legacy.llms.openai import OpenAI
from llama_index.legacy.llms.openai_utils import OpenAIToo... | [
"llama_index.legacy.agent.openai.utils.resolve_tool_choice",
"llama_index.legacy.llms.openai_utils.to_openai_tool",
"llama_index.legacy.llms.openai.OpenAI",
"llama_index.legacy.prompts.base.PromptTemplate",
"llama_index.legacy.program.utils.create_list_model"
] | [((619, 646), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (636, 646), False, 'import logging\n'), ((914, 950), 'llama_index.legacy.agent.openai.utils.resolve_tool_choice', 'resolve_tool_choice', (["schema['title']"], {}), "(schema['title'])\n", (933, 950), False, 'from llama_index.lega... |
from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, cast
import httpx
from openai import AsyncOpenAI
from openai import OpenAI as SyncOpenAI
from openai.types.chat import ChatCompletionMessageParam
from openai.types.chat.chat_completion_chunk import (
ChatCompletionChunk,
ChoiceDelta,
... | [
"llama_index.legacy.llms.openai_utils.from_openai_message",
"llama_index.legacy.multi_modal_llms.MultiModalLLMMetadata",
"llama_index.legacy.multi_modal_llms.openai_utils.generate_openai_multi_modal_chat_message",
"llama_index.legacy.bridge.pydantic.Field",
"llama_index.legacy.core.llms.types.ChatMessage",
... | [((1407, 1469), 'llama_index.legacy.bridge.pydantic.Field', 'Field', ([], {'description': '"""The Multi-Modal model to use from OpenAI."""'}), "(description='The Multi-Modal model to use from OpenAI.')\n", (1412, 1469), False, 'from llama_index.legacy.bridge.pydantic import Field, PrivateAttr\n'), ((1495, 1552), 'llama... |
from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, cast
import httpx
from openai import AsyncOpenAI
from openai import OpenAI as SyncOpenAI
from openai.types.chat import ChatCompletionMessageParam
from openai.types.chat.chat_completion_chunk import (
ChatCompletionChunk,
ChoiceDelta,
... | [
"llama_index.legacy.llms.openai_utils.from_openai_message",
"llama_index.legacy.multi_modal_llms.MultiModalLLMMetadata",
"llama_index.legacy.multi_modal_llms.openai_utils.generate_openai_multi_modal_chat_message",
"llama_index.legacy.bridge.pydantic.Field",
"llama_index.legacy.core.llms.types.ChatMessage",
... | [((1407, 1469), 'llama_index.legacy.bridge.pydantic.Field', 'Field', ([], {'description': '"""The Multi-Modal model to use from OpenAI."""'}), "(description='The Multi-Modal model to use from OpenAI.')\n", (1412, 1469), False, 'from llama_index.legacy.bridge.pydantic import Field, PrivateAttr\n'), ((1495, 1552), 'llama... |
import os
from dotenv import load_dotenv, find_dotenv
import numpy as np
from trulens_eval import (
Feedback,
TruLlama,
OpenAI
)
from trulens_eval.feedback import Groundedness
import nest_asyncio
nest_asyncio.apply()
def get_openai_api_key():
_ = load_dotenv(find_dotenv())
return os.getenv("OP... | [
"llama_index.VectorStoreIndex.from_documents",
"llama_index.retrievers.AutoMergingRetriever",
"llama_index.node_parser.get_leaf_nodes",
"llama_index.ServiceContext.from_defaults",
"llama_index.StorageContext.from_defaults",
"llama_index.node_parser.SentenceWindowNodeParser.from_defaults",
"llama_index.V... | [((211, 231), 'nest_asyncio.apply', 'nest_asyncio.apply', ([], {}), '()\n', (229, 231), False, 'import nest_asyncio\n'), ((449, 457), 'trulens_eval.OpenAI', 'OpenAI', ([], {}), '()\n', (455, 457), False, 'from trulens_eval import Feedback, TruLlama, OpenAI\n'), ((854, 896), 'trulens_eval.feedback.Groundedness', 'Ground... |
"""SQL Structured Store."""
from collections import defaultdict
from enum import Enum
from typing import Any, Optional, Sequence, Union
from sqlalchemy import Table
from llama_index.legacy.core.base_query_engine import BaseQueryEngine
from llama_index.legacy.core.base_retriever import BaseRetriever
from llama_index.... | [
"llama_index.legacy.indices.struct_store.container_builder.SQLContextContainerBuilder",
"llama_index.legacy.indices.common.struct_store.sql.SQLStructDatapointExtractor",
"llama_index.legacy.indices.struct_store.sql_query.NLStructStoreQueryEngine",
"llama_index.legacy.indices.struct_store.sql_query.SQLStructSt... | [((5106, 5332), 'llama_index.legacy.indices.common.struct_store.sql.SQLStructDatapointExtractor', 'SQLStructDatapointExtractor', (['self._service_context.llm', 'self.schema_extract_prompt', 'self.output_parser', 'self.sql_database'], {'table_name': 'self._table_name', 'table': 'self._table', 'ref_doc_id_column': 'self.... |
"""SQL Structured Store."""
from collections import defaultdict
from enum import Enum
from typing import Any, Optional, Sequence, Union
from sqlalchemy import Table
from llama_index.legacy.core.base_query_engine import BaseQueryEngine
from llama_index.legacy.core.base_retriever import BaseRetriever
from llama_index.... | [
"llama_index.legacy.indices.struct_store.container_builder.SQLContextContainerBuilder",
"llama_index.legacy.indices.common.struct_store.sql.SQLStructDatapointExtractor",
"llama_index.legacy.indices.struct_store.sql_query.NLStructStoreQueryEngine",
"llama_index.legacy.indices.struct_store.sql_query.SQLStructSt... | [((5106, 5332), 'llama_index.legacy.indices.common.struct_store.sql.SQLStructDatapointExtractor', 'SQLStructDatapointExtractor', (['self._service_context.llm', 'self.schema_extract_prompt', 'self.output_parser', 'self.sql_database'], {'table_name': 'self._table_name', 'table': 'self._table', 'ref_doc_id_column': 'self.... |
from llama_index.core.tools import FunctionTool
import os
note_file = os.path.join("data", "notes.txt")
def save_note(note):
if not os.path.exists(note_file):
open(note_file, "w")
with open(note_file, "a") as f:
f.writelines([note + "\n"])
return "note saved"
note_engine = FunctionToo... | [
"llama_index.core.tools.FunctionTool.from_defaults"
] | [((71, 104), 'os.path.join', 'os.path.join', (['"""data"""', '"""notes.txt"""'], {}), "('data', 'notes.txt')\n", (83, 104), False, 'import os\n'), ((309, 448), 'llama_index.core.tools.FunctionTool.from_defaults', 'FunctionTool.from_defaults', ([], {'fn': 'save_note', 'name': '"""note_saver"""', 'description': '"""this ... |
from llama_index.core.tools import FunctionTool
import os
note_file = os.path.join("data", "notes.txt")
def save_note(note):
if not os.path.exists(note_file):
open(note_file, "w")
with open(note_file, "a") as f:
f.writelines([note + "\n"])
return "note saved"
note_engine = FunctionToo... | [
"llama_index.core.tools.FunctionTool.from_defaults"
] | [((71, 104), 'os.path.join', 'os.path.join', (['"""data"""', '"""notes.txt"""'], {}), "('data', 'notes.txt')\n", (83, 104), False, 'import os\n'), ((309, 448), 'llama_index.core.tools.FunctionTool.from_defaults', 'FunctionTool.from_defaults', ([], {'fn': 'save_note', 'name': '"""note_saver"""', 'description': '"""this ... |
from llama_index.core.node_parser import SentenceWindowNodeParser
from llama_index.readers.file import FlatReader
from pathlib import Path
reader = FlatReader()
document = reader.load_data(Path("files/sample_document1.txt"))
parser = SentenceWindowNodeParser.from_defaults(
window_size=2,
window_metadata_key... | [
"llama_index.readers.file.FlatReader",
"llama_index.core.node_parser.SentenceWindowNodeParser.from_defaults"
] | [((149, 161), 'llama_index.readers.file.FlatReader', 'FlatReader', ([], {}), '()\n', (159, 161), False, 'from llama_index.readers.file import FlatReader\n'), ((236, 377), 'llama_index.core.node_parser.SentenceWindowNodeParser.from_defaults', 'SentenceWindowNodeParser.from_defaults', ([], {'window_size': '(2)', 'window_... |
# uses brave (requires api key) for web search then uses ollama for local embedding and inference, for a cost-free web RAG
# requires ollama to be installed and running
import os
import json
import logging
import sys
import requests
from dotenv import load_dotenv
from requests.adapters import HTTPAdapter
from urllib3.... | [
"llama_index.llms.ollama.Ollama",
"llama_index.tools.brave_search.BraveSearchToolSpec",
"llama_index.embeddings.ollama.OllamaEmbedding",
"llama_index.core.VectorStoreIndex.from_documents",
"llama_index.core.Document"
] | [((660, 706), 'llama_index.embeddings.ollama.OllamaEmbedding', 'OllamaEmbedding', ([], {'model_name': '"""nomic-embed-text"""'}), "(model_name='nomic-embed-text')\n", (675, 706), False, 'from llama_index.embeddings.ollama import OllamaEmbedding\n'), ((814, 860), 'llama_index.llms.ollama.Ollama', 'Ollama', ([], {'model'... |
"""Composability graphs."""
from typing import Any, Dict, List, Optional, Sequence, Type, cast
from llama_index.legacy.core.base_query_engine import BaseQueryEngine
from llama_index.legacy.data_structs.data_structs import IndexStruct
from llama_index.legacy.indices.base import BaseIndex
from llama_index.legacy.schema... | [
"llama_index.legacy.service_context.ServiceContext.from_defaults",
"llama_index.legacy.query_engine.graph_query_engine.ComposableGraphQueryEngine",
"llama_index.legacy.schema.RelatedNodeInfo"
] | [((4914, 4956), 'llama_index.legacy.query_engine.graph_query_engine.ComposableGraphQueryEngine', 'ComposableGraphQueryEngine', (['self'], {}), '(self, **kwargs)\n', (4940, 4956), False, 'from llama_index.legacy.query_engine.graph_query_engine import ComposableGraphQueryEngine\n'), ((1930, 1960), 'llama_index.legacy.ser... |
"""Composability graphs."""
from typing import Any, Dict, List, Optional, Sequence, Type, cast
from llama_index.legacy.core.base_query_engine import BaseQueryEngine
from llama_index.legacy.data_structs.data_structs import IndexStruct
from llama_index.legacy.indices.base import BaseIndex
from llama_index.legacy.schema... | [
"llama_index.legacy.service_context.ServiceContext.from_defaults",
"llama_index.legacy.query_engine.graph_query_engine.ComposableGraphQueryEngine",
"llama_index.legacy.schema.RelatedNodeInfo"
] | [((4914, 4956), 'llama_index.legacy.query_engine.graph_query_engine.ComposableGraphQueryEngine', 'ComposableGraphQueryEngine', (['self'], {}), '(self, **kwargs)\n', (4940, 4956), False, 'from llama_index.legacy.query_engine.graph_query_engine import ComposableGraphQueryEngine\n'), ((1930, 1960), 'llama_index.legacy.ser... |
from langchain.callbacks import CallbackManager
from llama_index import ServiceContext, PromptHelper, LLMPredictor
from core.callback_handler.std_out_callback_handler import DifyStdOutCallbackHandler
from core.embedding.openai_embedding import OpenAIEmbedding
from core.llm.llm_builder import LLMBuilder
class IndexBui... | [
"llama_index.PromptHelper",
"llama_index.LLMPredictor"
] | [((599, 745), 'core.llm.llm_builder.LLMBuilder.to_llm', 'LLMBuilder.to_llm', ([], {'tenant_id': 'tenant_id', 'model_name': '"""text-davinci-003"""', 'temperature': '(0)', 'max_tokens': 'num_output', 'callback_manager': 'callback_manager'}), "(tenant_id=tenant_id, model_name='text-davinci-003',\n temperature=0, max_t... |
from langchain.callbacks import CallbackManager
from llama_index import ServiceContext, PromptHelper, LLMPredictor
from core.callback_handler.std_out_callback_handler import DifyStdOutCallbackHandler
from core.embedding.openai_embedding import OpenAIEmbedding
from core.llm.llm_builder import LLMBuilder
class IndexBui... | [
"llama_index.PromptHelper",
"llama_index.LLMPredictor"
] | [((599, 745), 'core.llm.llm_builder.LLMBuilder.to_llm', 'LLMBuilder.to_llm', ([], {'tenant_id': 'tenant_id', 'model_name': '"""text-davinci-003"""', 'temperature': '(0)', 'max_tokens': 'num_output', 'callback_manager': 'callback_manager'}), "(tenant_id=tenant_id, model_name='text-davinci-003',\n temperature=0, max_t... |
"""Default prompt selectors."""
from llama_index.core.prompts import SelectorPromptTemplate
from llama_index.core.prompts.chat_prompts import (
CHAT_REFINE_PROMPT,
CHAT_REFINE_TABLE_CONTEXT_PROMPT,
CHAT_TEXT_QA_PROMPT,
CHAT_TREE_SUMMARIZE_PROMPT,
)
from llama_index.core.prompts.default_prompts import (
... | [
"llama_index.core.prompts.SelectorPromptTemplate"
] | [((540, 660), 'llama_index.core.prompts.SelectorPromptTemplate', 'SelectorPromptTemplate', ([], {'default_template': 'DEFAULT_TEXT_QA_PROMPT', 'conditionals': '[(is_chat_model, CHAT_TEXT_QA_PROMPT)]'}), '(default_template=DEFAULT_TEXT_QA_PROMPT,\n conditionals=[(is_chat_model, CHAT_TEXT_QA_PROMPT)])\n', (562, 660), ... |
"""Default prompt selectors."""
from llama_index.core.prompts import SelectorPromptTemplate
from llama_index.core.prompts.chat_prompts import (
CHAT_REFINE_PROMPT,
CHAT_REFINE_TABLE_CONTEXT_PROMPT,
CHAT_TEXT_QA_PROMPT,
CHAT_TREE_SUMMARIZE_PROMPT,
)
from llama_index.core.prompts.default_prompts import (
... | [
"llama_index.core.prompts.SelectorPromptTemplate"
] | [((540, 660), 'llama_index.core.prompts.SelectorPromptTemplate', 'SelectorPromptTemplate', ([], {'default_template': 'DEFAULT_TEXT_QA_PROMPT', 'conditionals': '[(is_chat_model, CHAT_TEXT_QA_PROMPT)]'}), '(default_template=DEFAULT_TEXT_QA_PROMPT,\n conditionals=[(is_chat_model, CHAT_TEXT_QA_PROMPT)])\n', (562, 660), ... |
"""Default prompt selectors."""
from llama_index.core.prompts import SelectorPromptTemplate
from llama_index.core.prompts.chat_prompts import (
CHAT_REFINE_PROMPT,
CHAT_REFINE_TABLE_CONTEXT_PROMPT,
CHAT_TEXT_QA_PROMPT,
CHAT_TREE_SUMMARIZE_PROMPT,
)
from llama_index.core.prompts.default_prompts import (
... | [
"llama_index.core.prompts.SelectorPromptTemplate"
] | [((540, 660), 'llama_index.core.prompts.SelectorPromptTemplate', 'SelectorPromptTemplate', ([], {'default_template': 'DEFAULT_TEXT_QA_PROMPT', 'conditionals': '[(is_chat_model, CHAT_TEXT_QA_PROMPT)]'}), '(default_template=DEFAULT_TEXT_QA_PROMPT,\n conditionals=[(is_chat_model, CHAT_TEXT_QA_PROMPT)])\n', (562, 660), ... |
"""Langchain memory wrapper (for LlamaIndex)."""
from typing import Any, Dict, List, Optional
from llama_index.core.bridge.langchain import (
AIMessage,
BaseChatMemory,
BaseMessage,
HumanMessage,
)
from llama_index.core.bridge.langchain import BaseMemory as Memory
from llama_index.core.bridge.pydantic... | [
"llama_index.core.bridge.langchain.AIMessage",
"llama_index.core.bridge.langchain.HumanMessage",
"llama_index.core.bridge.pydantic.Field",
"llama_index.core.schema.Document"
] | [((1663, 1690), 'llama_index.core.bridge.pydantic.Field', 'Field', ([], {'default_factory': 'dict'}), '(default_factory=dict)\n', (1668, 1690), False, 'from llama_index.core.bridge.pydantic import Field\n'), ((4306, 4333), 'llama_index.core.bridge.pydantic.Field', 'Field', ([], {'default_factory': 'dict'}), '(default_f... |
import logging
from typing import Any, List, Optional
from llama_index.legacy.bridge.pydantic import Field, PrivateAttr
from llama_index.legacy.core.embeddings.base import (
DEFAULT_EMBED_BATCH_SIZE,
BaseEmbedding,
Embedding,
)
logger = logging.getLogger(__name__)
# For bge models that Gradient AI provi... | [
"llama_index.legacy.bridge.pydantic.PrivateAttr",
"llama_index.legacy.bridge.pydantic.Field"
] | [((251, 278), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (268, 278), False, 'import logging\n'), ((1040, 1086), 'llama_index.legacy.bridge.pydantic.Field', 'Field', ([], {'default': 'GRADIENT_EMBED_BATCH_SIZE', 'gt': '(0)'}), '(default=GRADIENT_EMBED_BATCH_SIZE, gt=0)\n', (1045, 1086)... |
import logging
from typing import Any, List, Optional
from llama_index.legacy.bridge.pydantic import Field, PrivateAttr
from llama_index.legacy.core.embeddings.base import (
DEFAULT_EMBED_BATCH_SIZE,
BaseEmbedding,
Embedding,
)
logger = logging.getLogger(__name__)
# For bge models that Gradient AI provi... | [
"llama_index.legacy.bridge.pydantic.PrivateAttr",
"llama_index.legacy.bridge.pydantic.Field"
] | [((251, 278), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (268, 278), False, 'import logging\n'), ((1040, 1086), 'llama_index.legacy.bridge.pydantic.Field', 'Field', ([], {'default': 'GRADIENT_EMBED_BATCH_SIZE', 'gt': '(0)'}), '(default=GRADIENT_EMBED_BATCH_SIZE, gt=0)\n', (1045, 1086)... |
"""Answer inserter."""
from abc import abstractmethod
from typing import Any, Dict, List, Optional
from llama_index.core.llms.llm import LLM
from llama_index.core.prompts.base import BasePromptTemplate, PromptTemplate
from llama_index.core.prompts.mixin import (
PromptDictType,
PromptMixin,
PromptMixinTyp... | [
"llama_index.core.settings.llm_from_settings_or_context",
"llama_index.core.prompts.base.PromptTemplate"
] | [((4287, 4336), 'llama_index.core.prompts.base.PromptTemplate', 'PromptTemplate', (['DEFAULT_ANSWER_INSERT_PROMPT_TMPL'], {}), '(DEFAULT_ANSWER_INSERT_PROMPT_TMPL)\n', (4301, 4336), False, 'from llama_index.core.prompts.base import BasePromptTemplate, PromptTemplate\n'), ((4860, 4915), 'llama_index.core.settings.llm_fr... |
"""Answer inserter."""
from abc import abstractmethod
from typing import Any, Dict, List, Optional
from llama_index.core.llms.llm import LLM
from llama_index.core.prompts.base import BasePromptTemplate, PromptTemplate
from llama_index.core.prompts.mixin import (
PromptDictType,
PromptMixin,
PromptMixinTyp... | [
"llama_index.core.settings.llm_from_settings_or_context",
"llama_index.core.prompts.base.PromptTemplate"
] | [((4287, 4336), 'llama_index.core.prompts.base.PromptTemplate', 'PromptTemplate', (['DEFAULT_ANSWER_INSERT_PROMPT_TMPL'], {}), '(DEFAULT_ANSWER_INSERT_PROMPT_TMPL)\n', (4301, 4336), False, 'from llama_index.core.prompts.base import BasePromptTemplate, PromptTemplate\n'), ((4860, 4915), 'llama_index.core.settings.llm_fr... |
"""Answer inserter."""
from abc import abstractmethod
from typing import Any, Dict, List, Optional
from llama_index.core.llms.llm import LLM
from llama_index.core.prompts.base import BasePromptTemplate, PromptTemplate
from llama_index.core.prompts.mixin import (
PromptDictType,
PromptMixin,
PromptMixinTyp... | [
"llama_index.core.settings.llm_from_settings_or_context",
"llama_index.core.prompts.base.PromptTemplate"
] | [((4287, 4336), 'llama_index.core.prompts.base.PromptTemplate', 'PromptTemplate', (['DEFAULT_ANSWER_INSERT_PROMPT_TMPL'], {}), '(DEFAULT_ANSWER_INSERT_PROMPT_TMPL)\n', (4301, 4336), False, 'from llama_index.core.prompts.base import BasePromptTemplate, PromptTemplate\n'), ((4860, 4915), 'llama_index.core.settings.llm_fr... |
"""Retrieval evaluators."""
from typing import Any, List, Optional, Sequence, Tuple
from llama_index.legacy.bridge.pydantic import Field
from llama_index.legacy.core.base_retriever import BaseRetriever
from llama_index.legacy.evaluation.retrieval.base import (
BaseRetrievalEvaluator,
RetrievalEvalMode,
)
from... | [
"llama_index.legacy.bridge.pydantic.Field"
] | [((1038, 1085), 'llama_index.legacy.bridge.pydantic.Field', 'Field', (['...'], {'description': '"""Retriever to evaluate"""'}), "(..., description='Retriever to evaluate')\n", (1043, 1085), False, 'from llama_index.legacy.bridge.pydantic import Field\n'), ((1151, 1209), 'llama_index.legacy.bridge.pydantic.Field', 'Fiel... |
"""Retrieval evaluators."""
from typing import Any, List, Optional, Sequence, Tuple
from llama_index.legacy.bridge.pydantic import Field
from llama_index.legacy.core.base_retriever import BaseRetriever
from llama_index.legacy.evaluation.retrieval.base import (
BaseRetrievalEvaluator,
RetrievalEvalMode,
)
from... | [
"llama_index.legacy.bridge.pydantic.Field"
] | [((1038, 1085), 'llama_index.legacy.bridge.pydantic.Field', 'Field', (['...'], {'description': '"""Retriever to evaluate"""'}), "(..., description='Retriever to evaluate')\n", (1043, 1085), False, 'from llama_index.legacy.bridge.pydantic import Field\n'), ((1151, 1209), 'llama_index.legacy.bridge.pydantic.Field', 'Fiel... |
from typing import Any, List, Optional
from llama_index.legacy.bridge.pydantic import Field, PrivateAttr
from llama_index.legacy.callbacks import CallbackManager
from llama_index.legacy.core.embeddings.base import (
DEFAULT_EMBED_BATCH_SIZE,
BaseEmbedding,
)
from llama_index.legacy.embeddings.huggingface_utils... | [
"llama_index.legacy.bridge.pydantic.Field",
"llama_index.legacy.embeddings.huggingface_utils.format_text",
"llama_index.legacy.bridge.pydantic.PrivateAttr",
"llama_index.legacy.embeddings.huggingface_utils.get_pooling_mode",
"llama_index.legacy.embeddings.pooling.Pooling",
"llama_index.legacy.embeddings.h... | [((567, 613), 'llama_index.legacy.bridge.pydantic.Field', 'Field', ([], {'description': '"""Folder name to load from."""'}), "(description='Folder name to load from.')\n", (572, 613), False, 'from llama_index.legacy.bridge.pydantic import Field, PrivateAttr\n'), ((636, 681), 'llama_index.legacy.bridge.pydantic.Field', ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.