code stringlengths 161 233k | apis listlengths 1 24 | extract_api stringlengths 162 68.5k |
|---|---|---|
import sys
from langchain import OpenAI
from pathlib import Path
import llama_index as li
#from llamahub.connectors import TextFileConnector
from llama_index import SimpleDirectoryReader,GPTListIndex,LLMPredictor
file_name = sys.argv[1]
llm_predictor = LLMPredictor(llm=OpenAI(model_name="gpt-3.5-turbo")) #temperature=... | [
"llama_index.GPTListIndex",
"llama_index.SimpleDirectoryReader"
] | [((391, 409), 'llama_index.GPTListIndex', 'GPTListIndex', (['docs'], {}), '(docs)\n', (403, 409), False, 'from llama_index import SimpleDirectoryReader, GPTListIndex, LLMPredictor\n'), ((271, 305), 'langchain.OpenAI', 'OpenAI', ([], {'model_name': '"""gpt-3.5-turbo"""'}), "(model_name='gpt-3.5-turbo')\n", (277, 305), F... |
"""Download."""
import json
import logging
import os
import subprocess
import sys
from enum import Enum
from importlib import util
from pathlib import Path
from typing import Any, Dict, List, Optional, Union
import pkg_resources
import requests
from pkg_resources import DistributionNotFound
from llama_index.download.... | [
"llama_index.download.utils.get_exports",
"llama_index.download.utils.initialize_directory"
] | [((637, 664), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (654, 664), False, 'import logging\n'), ((5550, 5583), 'os.path.exists', 'os.path.exists', (['requirements_path'], {}), '(requirements_path)\n', (5564, 5583), False, 'import os\n'), ((7432, 7500), 'llama_index.download.utils.ini... |
"""Download."""
import json
import logging
import os
import subprocess
import sys
from enum import Enum
from importlib import util
from pathlib import Path
from typing import Any, Dict, List, Optional, Union
import pkg_resources
import requests
from pkg_resources import DistributionNotFound
from llama_index.download.... | [
"llama_index.download.utils.get_exports",
"llama_index.download.utils.initialize_directory"
] | [((637, 664), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (654, 664), False, 'import logging\n'), ((5550, 5583), 'os.path.exists', 'os.path.exists', (['requirements_path'], {}), '(requirements_path)\n', (5564, 5583), False, 'import os\n'), ((7432, 7500), 'llama_index.download.utils.ini... |
import logging
from dataclasses import dataclass
from typing import Any, List, Optional, cast
import llama_index
from llama_index.bridge.pydantic import BaseModel
from llama_index.callbacks.base import CallbackManager
from llama_index.core.embeddings.base import BaseEmbedding
from llama_index.indices.prompt_helper imp... | [
"llama_index.llms.utils.resolve_llm",
"llama_index.node_parser.loading.load_parser",
"llama_index.extractors.loading.load_extractor",
"llama_index.embeddings.loading.load_embed_model",
"llama_index.llm_predictor.LLMPredictor",
"llama_index.logger.LlamaLogger",
"llama_index.embeddings.utils.resolve_embed... | [((962, 989), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (979, 989), False, 'import logging\n'), ((1764, 1821), 'llama_index.indices.prompt_helper.PromptHelper.from_llm_metadata', 'PromptHelper.from_llm_metadata', ([], {'llm_metadata': 'llm_metadata'}), '(llm_metadata=llm_metadata)\n'... |
import logging
from dataclasses import dataclass
from typing import Any, List, Optional, cast
import llama_index
from llama_index.bridge.pydantic import BaseModel
from llama_index.callbacks.base import CallbackManager
from llama_index.core.embeddings.base import BaseEmbedding
from llama_index.indices.prompt_helper imp... | [
"llama_index.llms.utils.resolve_llm",
"llama_index.node_parser.loading.load_parser",
"llama_index.extractors.loading.load_extractor",
"llama_index.embeddings.loading.load_embed_model",
"llama_index.llm_predictor.LLMPredictor",
"llama_index.logger.LlamaLogger",
"llama_index.embeddings.utils.resolve_embed... | [((962, 989), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (979, 989), False, 'import logging\n'), ((1764, 1821), 'llama_index.indices.prompt_helper.PromptHelper.from_llm_metadata', 'PromptHelper.from_llm_metadata', ([], {'llm_metadata': 'llm_metadata'}), '(llm_metadata=llm_metadata)\n'... |
import utils
import os
import requests
import llama_index
import torch
import llama_cpp
from llama_index import SimpleDirectoryReader
from llama_index import Document
from llama_index import VectorStoreIndex
from llama_index import ServiceContext
from llama_index import LLMPredictor
# Paramas
llama = True
### Get d... | [
"llama_index.VectorStoreIndex.from_documents",
"llama_index.SimpleDirectoryReader",
"llama_index.ServiceContext.from_defaults",
"llama_index.llms.Replicate",
"llama_index.llms.llama_utils.completion_to_prompt"
] | [((1239, 1307), 'huggingface_hub.hf_hub_download', 'hf_hub_download', ([], {'repo_id': 'model_name_or_path', 'filename': 'model_basename'}), '(repo_id=model_name_or_path, filename=model_basename)\n', (1254, 1307), False, 'from huggingface_hub import hf_hub_download\n'), ((2628, 2799), 'llama_index.llms.Replicate', 'Rep... |
import logging
from dataclasses import dataclass
from typing import List, Optional
import llama_index
from llama_index.bridge.pydantic import BaseModel
from llama_index.callbacks.base import CallbackManager
from llama_index.embeddings.base import BaseEmbedding
from llama_index.embeddings.utils import EmbedType, resolv... | [
"llama_index.llms.utils.resolve_llm",
"llama_index.node_parser.loading.load_parser",
"llama_index.extractors.loading.load_extractor",
"llama_index.embeddings.loading.load_embed_model",
"llama_index.llm_predictor.LLMPredictor",
"llama_index.logger.LlamaLogger",
"llama_index.embeddings.utils.resolve_embed... | [((1018, 1045), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1035, 1045), False, 'import logging\n'), ((1820, 1877), 'llama_index.indices.prompt_helper.PromptHelper.from_llm_metadata', 'PromptHelper.from_llm_metadata', ([], {'llm_metadata': 'llm_metadata'}), '(llm_metadata=llm_metadata... |
"""Download."""
import json
import logging
import os
import subprocess
import sys
from enum import Enum
from importlib import util
from pathlib import Path
from typing import Any, Dict, List, Optional, Union
import pkg_resources
import requests
from pkg_resources import DistributionNotFound
from llama_index.download.... | [
"llama_index.download.utils.get_exports",
"llama_index.download.utils.initialize_directory"
] | [((637, 664), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (654, 664), False, 'import logging\n'), ((5360, 5393), 'os.path.exists', 'os.path.exists', (['requirements_path'], {}), '(requirements_path)\n', (5374, 5393), False, 'import os\n'), ((7213, 7281), 'llama_index.download.utils.ini... |
# SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ht... | [
"llama_index.SimpleDirectoryReader",
"llama_index.GPTVectorStoreIndex.from_documents",
"llama_index.LLMPredictor"
] | [((1791, 1843), 'nemoguardrails.RailsConfig.from_content', 'RailsConfig.from_content', (['COLANG_CONFIG', 'YAML_CONFIG'], {}), '(COLANG_CONFIG, YAML_CONFIG)\n', (1815, 1843), False, 'from nemoguardrails import LLMRails, RailsConfig\n'), ((1854, 1870), 'nemoguardrails.LLMRails', 'LLMRails', (['config'], {}), '(config)\n... |
import logging
from dataclasses import dataclass
from typing import List, Optional
import llama_index
from llama_index.bridge.pydantic import BaseModel
from llama_index.callbacks.base import CallbackManager
from llama_index.embeddings.base import BaseEmbedding
from llama_index.embeddings.utils import EmbedType, resolv... | [
"llama_index.llms.utils.resolve_llm",
"llama_index.node_parser.loading.load_parser",
"llama_index.extractors.loading.load_extractor",
"llama_index.embeddings.loading.load_embed_model",
"llama_index.llm_predictor.LLMPredictor",
"llama_index.logger.LlamaLogger",
"llama_index.embeddings.utils.resolve_embed... | [((1019, 1046), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1036, 1046), False, 'import logging\n'), ((1821, 1878), 'llama_index.indices.prompt_helper.PromptHelper.from_llm_metadata', 'PromptHelper.from_llm_metadata', ([], {'llm_metadata': 'llm_metadata'}), '(llm_metadata=llm_metadata... |
"""Elasticsearch vector store."""
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.schema import BaseNode, MetadataMode, TextNode
from llama_index.vector_stores.types import (
... | [
"llama_index.vector_stores.utils.metadata_dict_to_node",
"llama_index.schema.TextNode",
"llama_index.vector_stores.utils.node_to_metadata_dict"
] | [((534, 553), 'logging.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (543, 553), False, 'from logging import getLogger\n'), ((2379, 2432), 'elasticsearch.AsyncElasticsearch', 'elasticsearch.AsyncElasticsearch', ([], {}), '(**connection_params)\n', (2411, 2432), False, 'import elasticsearch\n'), ((3728, 3... |
"""Download."""
import json
import logging
import os
import subprocess
import sys
from enum import Enum
from importlib import util
from pathlib import Path
from typing import Any, Dict, List, Optional, Union
import requests
from llama_index.core.download.utils import (
get_exports,
get_file_content,
initi... | [
"llama_index.core.download.utils.get_exports",
"llama_index.core.download.utils.initialize_directory"
] | [((574, 601), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (591, 601), False, 'import logging\n'), ((5497, 5530), 'os.path.exists', 'os.path.exists', (['requirements_path'], {}), '(requirements_path)\n', (5511, 5530), False, 'import os\n'), ((7469, 7537), 'llama_index.core.download.util... |
import os
import sys
import json
import logging
import dotenv
import llama_index
ENV_CONFIG = dotenv.dotenv_values('.env') #not sync in .git
os.environ["OPENAI_API_KEY"] = ENV_CONFIG['OPENAI_API_KEY']
## print detailed information
# logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
# logging.getLogger().ad... | [
"llama_index.VectorStoreIndex.from_documents",
"llama_index.SimpleDirectoryReader",
"llama_index.StorageContext.from_defaults",
"llama_index.llms.ChatMessage",
"llama_index.load_index_from_storage",
"llama_index.llms.Ollama"
] | [((96, 124), 'dotenv.dotenv_values', 'dotenv.dotenv_values', (['""".env"""'], {}), "('.env')\n", (116, 124), False, 'import dotenv\n'), ((396, 435), 'llama_index.llms.Ollama', 'llama_index.llms.Ollama', ([], {'model': '"""llama2"""'}), "(model='llama2')\n", (419, 435), False, 'import llama_index\n'), ((521, 625), 'llam... |
import qdrant_client
from llama_index import (
VectorStoreIndex,
ServiceContext,
)
from llama_index.llms import Ollama
from llama_index.vector_stores.qdrant import QdrantVectorStore
import llama_index
llama_index.set_global_handler("simple")
# re-initialize the vector store
client = qdrant_client.... | [
"llama_index.ServiceContext.from_defaults",
"llama_index.set_global_handler",
"llama_index.vector_stores.qdrant.QdrantVectorStore",
"llama_index.VectorStoreIndex.from_vector_store",
"llama_index.llms.Ollama"
] | [((219, 259), 'llama_index.set_global_handler', 'llama_index.set_global_handler', (['"""simple"""'], {}), "('simple')\n", (249, 259), False, 'import llama_index\n'), ((306, 354), 'qdrant_client.QdrantClient', 'qdrant_client.QdrantClient', ([], {'path': '"""./qdrant_data"""'}), "(path='./qdrant_data')\n", (332, 354), Fa... |
import tkinter as tk
from screeninfo import get_monitors
from PIL import Image, ImageTk
import os
from tkinter import filedialog
import TextConverter as tc
from tkinter import messagebox
import platform
import pyperclip
import config
from threading import Thread
from Speech_functions import checking, asking
import text... | [
"llama_index.SimpleDirectoryReader",
"llama_index.GPTVectorStoreIndex.from_documents"
] | [((556, 569), 'config.init', 'config.init', ([], {}), '()\n', (567, 569), False, 'import config\n'), ((29784, 29826), 'threading.Thread', 'Thread', ([], {'target': 'window.waitAndReturnNewText'}), '(target=window.waitAndReturnNewText)\n', (29790, 29826), False, 'from threading import Thread\n'), ((2528, 2575), 'langcha... |
"""General utils functions."""
import asyncio
import os
import random
import sys
import time
import traceback
import uuid
from contextlib import contextmanager
from dataclasses import dataclass
from functools import partial, wraps
from itertools import islice
from pathlib import Path
from typing import (
Any,
... | [
"llama_index.utils.get_cache_dir"
] | [((7192, 7223), 'os.path.join', 'os.path.join', (['dirname', 'basename'], {}), '(dirname, basename)\n', (7204, 7223), False, 'import os\n'), ((8174, 8215), 'transformers.AutoTokenizer.from_pretrained', 'AutoTokenizer.from_pretrained', (['model_name'], {}), '(model_name)\n', (8203, 8215), False, 'from transformers impor... |
import os
from llama_index import StringIterableReader, GPTTreeIndex
import llama_index
openai_api_key = os.environ.get('OPENAI_API_KEY')
# input_question = "How tall is Tom Hiddleston"
input_question = "Who is taller Tom Hiddleston or Chris Hemsworth"
input_question_list = []
input_question_list.append(input_quest... | [
"llama_index.StringIterableReader",
"llama_index.GPTTreeIndex.from_documents"
] | [((108, 140), 'os.environ.get', 'os.environ.get', (['"""OPENAI_API_KEY"""'], {}), "('OPENAI_API_KEY')\n", (122, 140), False, 'import os\n'), ((407, 445), 'llama_index.GPTTreeIndex.from_documents', 'GPTTreeIndex.from_documents', (['documents'], {}), '(documents)\n', (434, 445), False, 'from llama_index import StringIter... |
"""Base embeddings file."""
import asyncio
from abc import abstractmethod
from enum import Enum
from typing import Any, Callable, Coroutine, List, Optional, Tuple
import numpy as np
from llama_index.core.bridge.pydantic import Field, validator
from llama_index.core.callbacks.base import CallbackManager
from llama_ind... | [
"llama_index.core.bridge.pydantic.validator",
"llama_index.core.instrumentation.get_dispatcher",
"llama_index.core.bridge.pydantic.Field",
"llama_index.core.callbacks.base.CallbackManager",
"llama_index.core.instrumentation.events.embedding.EmbeddingEndEvent",
"llama_index.core.utils.get_tqdm_iterable"
] | [((822, 857), 'llama_index.core.instrumentation.get_dispatcher', 'instrument.get_dispatcher', (['__name__'], {}), '(__name__)\n', (847, 857), True, 'import llama_index.core.instrumentation as instrument\n'), ((1902, 1974), 'llama_index.core.bridge.pydantic.Field', 'Field', ([], {'default': '"""unknown"""', 'description... |
from dotenv import load_dotenv
from llama_index.core import (
PromptTemplate,
VectorStoreIndex,
SimpleDirectoryReader,
SummaryIndex,
Settings,
StorageContext,
VectorStoreIndex,
)
from llama_index.core.extractors import (
KeywordExtractor,
QuestionsAnsweredExtractor,
TitleExtrac... | [
"llama_index.llms.openai.OpenAI",
"llama_index.core.VectorStoreIndex.from_vector_store",
"llama_index.core.VectorStoreIndex",
"llama_index.core.StorageContext.from_defaults",
"llama_index.core.output_parsers.PydanticOutputParser",
"llama_index.core.PromptTemplate",
"llama_index.core.query_pipeline.Query... | [((1050, 1070), 'nest_asyncio.apply', 'nest_asyncio.apply', ([], {}), '()\n', (1068, 1070), False, 'import nest_asyncio\n'), ((1112, 1125), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (1123, 1125), False, 'from dotenv import load_dotenv\n'), ((1151, 1213), 'llama_index.llms.openai.OpenAI', 'OpenAI', ([], {'t... |
import dataclasses
import logging
from dataclasses import dataclass
from typing import Optional
import llama_index
from llama_index.callbacks.base import CallbackManager
from llama_index.constants import DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE
from llama_index.embeddings.base import BaseEmbedding
from llama_index.em... | [
"llama_index.langchain_helpers.text_splitter.TokenTextSplitter",
"llama_index.langchain_helpers.chain_wrapper.LLMPredictor",
"llama_index.node_parser.simple.SimpleNodeParser",
"llama_index.logger.LlamaLogger",
"llama_index.indices.prompt_helper.PromptHelper.from_llm_metadata",
"llama_index.callbacks.base.... | [((859, 886), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (876, 886), False, 'import logging\n'), ((1305, 1413), 'llama_index.langchain_helpers.text_splitter.TokenTextSplitter', 'TokenTextSplitter', ([], {'chunk_size': 'chunk_size', 'chunk_overlap': 'chunk_overlap', 'callback_manager':... |
"""Global eval handlers."""
from typing import Any
from llama_index.callbacks.arize_phoenix_callback import arize_phoenix_callback_handler
from llama_index.callbacks.base_handler import BaseCallbackHandler
from llama_index.callbacks.honeyhive_callback import honeyhive_callback_handler
from llama_index.callbacks.open_... | [
"llama_index.callbacks.wandb_callback.WandbCallbackHandler",
"llama_index.callbacks.simple_llm_handler.SimpleLLMHandler",
"llama_index.callbacks.honeyhive_callback.honeyhive_callback_handler",
"llama_index.callbacks.arize_phoenix_callback.arize_phoenix_callback_handler",
"llama_index.callbacks.open_inferenc... | [((917, 952), 'llama_index.callbacks.wandb_callback.WandbCallbackHandler', 'WandbCallbackHandler', ([], {}), '(**eval_params)\n', (937, 952), False, 'from llama_index.callbacks.wandb_callback import WandbCallbackHandler\n'), ((1010, 1053), 'llama_index.callbacks.open_inference_callback.OpenInferenceCallbackHandler', 'O... |
# Imports
from collections import defaultdict
from time import sleep
from llama_index import (
StorageContext,
load_index_from_storage,
set_global_service_context,
)
from model_context import get_anyscale_context
from templates import custom_template, yn_template
import csv
from tqdm import tqdm
from openai... | [
"llama_index.load_index_from_storage",
"llama_index.set_global_service_context",
"llama_index.StorageContext.from_defaults"
] | [((345, 416), 'openai.OpenAI', 'OpenAI', ([], {'base_url': '"""https://api.endpoints.anyscale.com/v1"""', 'api_key': '"""KEY"""'}), "(base_url='https://api.endpoints.anyscale.com/v1', api_key='KEY')\n", (351, 416), False, 'from openai import OpenAI\n'), ((2365, 2382), 'collections.defaultdict', 'defaultdict', (['list']... |
#!/usr/bin/env python3
# Copyright (c) 2023-2024 Steve Castellotti
# This file is part of Urcuchillay and is released under the MIT License.
# See LICENSE file in the project root for full license information.
import logging
import os
import sys
import config
try:
import chromadb
import llama_index
import... | [
"llama_index.VectorStoreIndex.from_documents",
"llama_index.storage.storage_context.StorageContext.from_defaults",
"llama_index.SimpleDirectoryReader",
"llama_index.VectorStoreIndex.from_vector_store",
"llama_index.vector_stores.ChromaVectorStore",
"llama_index.ServiceContext.from_defaults",
"llama_inde... | [((590, 601), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (598, 601), False, 'import sys\n'), ((704, 774), 'llama_index.callbacks.LlamaDebugHandler', 'llama_index.callbacks.LlamaDebugHandler', ([], {'print_trace_on_end': 'self.debug'}), '(print_trace_on_end=self.debug)\n', (743, 774), False, 'import llama_index\n')... |
from dataclasses import dataclass, field
from typing import Generator, List, Set, Dict, Optional, Tuple, Union, Any
from os.path import sep as PathSep
from transformers import AutoTokenizer
import llama_index
from llama_index import (
PromptTemplate,
Document,
Prompt,
ServiceContext,
set_global_se... | [
"llama_index.tools.query_engine.QueryEngineTool.from_defaults",
"llama_index.ServiceContext.from_defaults",
"llama_index.llms.LlamaCPP",
"llama_index.schema.TextNode",
"llama_index.Prompt",
"llama_index.set_global_service_context",
"llama_index.retrievers.BM25Retriever.from_defaults",
"llama_index.res... | [((1241, 1268), 'llama_index.Prompt', 'Prompt', (['chatbot_instruction'], {}), '(chatbot_instruction)\n', (1247, 1268), False, 'from llama_index import PromptTemplate, Document, Prompt, ServiceContext, set_global_service_context, set_global_tokenizer\n'), ((6101, 6149), 'llama_index.embeddings.HuggingFaceEmbedding', 'H... |
#%%
import llama_index
from llama_index.tools import BaseTool, FunctionTool
from llama_index.agent import OpenAIAgent
from llama_index.llms import OpenAI
from llama_index.vector_stores import ChromaVectorStore
from llama_index import StorageContext, VectorStoreIndex
import chromadb
import phoenix as px
#%%
def mult... | [
"llama_index.VectorStoreIndex.from_documents",
"llama_index.SimpleWebPageReader",
"llama_index.download_loader",
"llama_index.llms.OpenAI",
"llama_index.tools.FunctionTool.from_defaults",
"llama_index.agent.OpenAIAgent.from_tools",
"llama_index.GPTVectorStoreIndex.from_documents"
] | [((452, 491), 'llama_index.tools.FunctionTool.from_defaults', 'FunctionTool.from_defaults', ([], {'fn': 'multiply'}), '(fn=multiply)\n', (478, 491), False, 'from llama_index.tools import BaseTool, FunctionTool\n'), ((620, 654), 'llama_index.tools.FunctionTool.from_defaults', 'FunctionTool.from_defaults', ([], {'fn': 'a... |
import sys
import os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import asyncio
from models.memory_models import (Message)
from services.config import get_option
from services.logger import setup_logger
from utilities.queue_utils import setup_queue, process_queue
from elasticsea... | [
"llama_index.Document"
] | [((877, 940), 'services.config.get_option', 'get_option', (['"""AZURE_STORAGE_CONNECTION_STRING"""'], {'is_required': '(True)'}), "('AZURE_STORAGE_CONNECTION_STRING', is_required=True)\n", (887, 940), False, 'from services.config import get_option\n'), ((962, 1012), 'services.config.get_option', 'get_option', (['"""SAV... |
"""FastAPI app creation, logger configuration and main API routes."""
import llama_index
from launcher import create_app
from di import global_injector
# Add LlamaIndex simple observability
llama_index.set_global_handler("simple")
app = create_app(global_injector)
| [
"llama_index.set_global_handler"
] | [((192, 232), 'llama_index.set_global_handler', 'llama_index.set_global_handler', (['"""simple"""'], {}), "('simple')\n", (222, 232), False, 'import llama_index\n'), ((240, 267), 'launcher.create_app', 'create_app', (['global_injector'], {}), '(global_injector)\n', (250, 267), False, 'from launcher import create_app\n'... |
import os
import streamlit as st
import openai
from core.pipeline_builder import build_query_pipeline
from core.index_builder.inquiry_index_builder import load_inquiry_index
from core.index_builder.act_index_builder import (
load_act_index,
load_act_enforcement_index,
)
from core.utils import draw_dag
from lla... | [
"llama_index.embeddings.openai.OpenAIEmbedding"
] | [((510, 525), 'phoenix.launch_app', 'px.launch_app', ([], {}), '()\n', (523, 525), True, 'import phoenix as px\n'), ((619, 666), 'llama_index.embeddings.openai.OpenAIEmbedding', 'OpenAIEmbedding', ([], {'model': '"""text-embedding-3-small"""'}), "(model='text-embedding-3-small')\n", (634, 666), False, 'from llama_index... |
"""Base vector store index query."""
from typing import Any, Dict, List, Optional
from llama_index.core.base.base_retriever import BaseRetriever
from llama_index.core.base.embeddings.base import BaseEmbedding
from llama_index.core.callbacks.base import CallbackManager
from llama_index.core.constants import DEFAULT_SI... | [
"llama_index.core.vector_stores.types.VectorStoreQuery",
"llama_index.core.instrumentation.get_dispatcher",
"llama_index.core.vector_stores.types.VectorStoreQueryMode",
"llama_index.core.schema.NodeWithScore",
"llama_index.core.callbacks.base.CallbackManager",
"llama_index.core.indices.utils.log_vector_st... | [((838, 873), 'llama_index.core.instrumentation.get_dispatcher', 'instrument.get_dispatcher', (['__name__'], {}), '(__name__)\n', (863, 873), True, 'import llama_index.core.instrumentation as instrument\n'), ((2619, 2664), 'llama_index.core.vector_stores.types.VectorStoreQueryMode', 'VectorStoreQueryMode', (['vector_st... |
"""Google Generative AI Vector Store.
The GenAI Semantic Retriever API is a managed end-to-end service that allows
developers to create a corpus of documents to perform semantic search on
related passages given a user query. For more information visit:
https://developers.generativeai.google/guide
"""
import logging
i... | [
"llama_index.vector_stores.google.generativeai.genai_extension.get_document",
"llama_index.vector_stores.google.generativeai.genai_extension.get_corpus",
"llama_index.vector_stores.google.generativeai.genai_extension.build_semantic_retriever",
"llama_index.indices.service_context.ServiceContext.from_defaults"... | [((843, 870), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (860, 870), False, 'import logging\n'), ((1036, 1092), 'llama_index.indices.service_context.ServiceContext.from_defaults', 'ServiceContext.from_defaults', ([], {'llm': 'None', 'embed_model': 'None'}), '(llm=None, embed_model=Non... |
import csv
import time
import logging
import os
import inspect
# import fitz
from datetime import datetime
from functools import wraps
import shutil
from pathlib import Path
from google.oauth2.credentials import Credentials
from google.oauth2.service_account import Credentials as ServiceAccountCredentials
import subp... | [
"llama_index.legacy.embeddings.HuggingFaceEmbedding",
"llama_index.vector_stores.pinecone.PineconeVectorStore",
"llama_index.legacy.OpenAIEmbedding",
"llama_index.legacy.vector_stores.PineconeVectorStore"
] | [((983, 1012), 'os.path.exists', 'os.path.exists', (['"""/.dockerenv"""'], {}), "('/.dockerenv')\n", (997, 1012), False, 'import os\n'), ((1787, 1798), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (1796, 1798), False, 'import os\n'), ((1810, 1833), 'os.path.abspath', 'os.path.abspath', (['os.sep'], {}), '(os.sep)\n', (1... |
import logging
from dataclasses import dataclass
from typing import Optional
import llama_index
from llama_index.bridge.pydantic import BaseModel
from llama_index.callbacks.base import CallbackManager
from llama_index.embeddings.base import BaseEmbedding
from llama_index.embeddings.utils import EmbedType, resolve_embe... | [
"llama_index.llms.utils.resolve_llm",
"llama_index.node_parser.loading.load_parser",
"llama_index.text_splitter.loading.load_text_splitter",
"llama_index.node_parser.extractors.loading.load_extractor",
"llama_index.embeddings.loading.load_embed_model",
"llama_index.llm_predictor.LLMPredictor",
"llama_in... | [((1015, 1042), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1032, 1042), False, 'import logging\n'), ((1273, 1395), 'llama_index.node_parser.simple.SimpleNodeParser.from_defaults', 'SimpleNodeParser.from_defaults', ([], {'chunk_size': 'chunk_size', 'chunk_overlap': 'chunk_overlap', 'c... |
import logging
from typing import (
Any,
Callable,
Generator,
Optional,
Sequence,
Type,
cast,
AsyncGenerator,
)
from llama_index.core.bridge.pydantic import BaseModel, Field, ValidationError
from llama_index.core.callbacks.base import CallbackManager
from llama_index.core.indices.prompt... | [
"llama_index.core.response.utils.get_response_text",
"llama_index.core.instrumentation.get_dispatcher",
"llama_index.core.bridge.pydantic.Field",
"llama_index.core.program.utils.get_program_for_llm",
"llama_index.core.instrumentation.events.synthesis.GetResponseEndEvent",
"llama_index.core.indices.utils.t... | [((1218, 1253), 'llama_index.core.instrumentation.get_dispatcher', 'instrument.get_dispatcher', (['__name__'], {}), '(__name__)\n', (1243, 1253), True, 'import llama_index.core.instrumentation as instrument\n'), ((1264, 1291), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1281, 1291), F... |
"""Base retriever."""
from abc import abstractmethod
from typing import Any, Dict, List, Optional
from llama_index.core.base.base_query_engine import BaseQueryEngine
from llama_index.core.base.query_pipeline.query import (
ChainableMixin,
InputKeys,
OutputKeys,
QueryComponent,
validate_and_convert... | [
"llama_index.core.schema.TextNode",
"llama_index.core.base.query_pipeline.query.InputKeys.from_keys",
"llama_index.core.base.query_pipeline.query.OutputKeys.from_keys",
"llama_index.core.instrumentation.get_dispatcher",
"llama_index.core.bridge.pydantic.Field",
"llama_index.core.instrumentation.events.ret... | [((1092, 1127), 'llama_index.core.instrumentation.get_dispatcher', 'instrument.get_dispatcher', (['__name__'], {}), '(__name__)\n', (1117, 1127), True, 'import llama_index.core.instrumentation as instrument\n'), ((11319, 11354), 'llama_index.core.bridge.pydantic.Field', 'Field', (['...'], {'description': '"""Retriever"... |
import dataclasses
import logging
from dataclasses import dataclass
from typing import Optional
from langchain.base_language import BaseLanguageModel
import llama_index
from llama_index.callbacks.base import CallbackManager
from llama_index.embeddings.base import BaseEmbedding
from llama_index.embeddings.openai impor... | [
"llama_index.langchain_helpers.chain_wrapper.LLMPredictor",
"llama_index.logger.LlamaLogger",
"llama_index.indices.prompt_helper.PromptHelper.from_llm_metadata",
"llama_index.callbacks.base.CallbackManager",
"llama_index.embeddings.openai.OpenAIEmbedding",
"llama_index.node_parser.simple.SimpleNodeParser.... | [((709, 736), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (726, 736), False, 'import logging\n'), ((967, 1089), 'llama_index.node_parser.simple.SimpleNodeParser.from_defaults', 'SimpleNodeParser.from_defaults', ([], {'chunk_size': 'chunk_size', 'chunk_overlap': 'chunk_overlap', 'callba... |
from __future__ import annotations
import os
try:
from llama_index import (
VectorStoreIndex,
SimpleDirectoryReader,
StorageContext,
load_index_from_storage
)
except:
pass
from dataclasses import dataclass
def get_or_create_index_local(persist_dir = './storage', documents_... | [
"llama_index.VectorStoreIndex.from_documents",
"llama_index.load_index_from_storage",
"llama_index.SimpleDirectoryReader",
"llama_index.StorageContext.from_defaults"
] | [((350, 377), 'os.path.exists', 'os.path.exists', (['persist_dir'], {}), '(persist_dir)\n', (364, 377), False, 'import os\n'), ((464, 506), 'llama_index.VectorStoreIndex.from_documents', 'VectorStoreIndex.from_documents', (['documents'], {}), '(documents)\n', (495, 506), False, 'from llama_index import VectorStoreIndex... |
"""Elasticsearch vector store."""
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.bridge.pydantic import PrivateAttr
from llama_index.schema import BaseNode, MetadataMode, Text... | [
"llama_index.vector_stores.utils.metadata_dict_to_node",
"llama_index.bridge.pydantic.PrivateAttr",
"llama_index.schema.TextNode",
"llama_index.vector_stores.utils.node_to_metadata_dict"
] | [((598, 617), 'logging.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (607, 617), False, 'from logging import getLogger\n'), ((2443, 2496), 'elasticsearch.AsyncElasticsearch', 'elasticsearch.AsyncElasticsearch', ([], {}), '(**connection_params)\n', (2475, 2496), False, 'import elasticsearch\n'), ((3819, 3... |
import os
from abc import abstractmethod
from collections import deque
from typing import Any, Deque, Dict, List, Optional, Union, cast
from llama_index.core.agent.types import (
BaseAgent,
BaseAgentWorker,
Task,
TaskStep,
TaskStepOutput,
)
from llama_index.core.bridge.pydantic import BaseModel, Fi... | [
"llama_index.core.agent.types.Task",
"llama_index.core.memory.ChatMemoryBuffer.from_defaults",
"llama_index.core.instrumentation.get_dispatcher",
"llama_index.core.bridge.pydantic.Field",
"llama_index.core.agent.ReActAgent.from_tools",
"llama_index.core.instrumentation.events.agent.AgentRunStepStartEvent"... | [((1114, 1149), 'llama_index.core.instrumentation.get_dispatcher', 'instrument.get_dispatcher', (['__name__'], {}), '(__name__)\n', (1139, 1149), True, 'import llama_index.core.instrumentation as instrument\n'), ((4349, 4380), 'llama_index.core.bridge.pydantic.Field', 'Field', (['...'], {'description': '"""Task."""'}),... |
from typing import Any, List, Optional, Sequence
from llama_index.core.base.base_query_engine import BaseQueryEngine
from llama_index.core.base.base_retriever import BaseRetriever
from llama_index.core.base.response.schema import RESPONSE_TYPE
from llama_index.core.bridge.pydantic import BaseModel
from llama_index.cor... | [
"llama_index.core.instrumentation.get_dispatcher",
"llama_index.core.settings.callback_manager_from_settings_or_context",
"llama_index.core.settings.llm_from_settings_or_context",
"llama_index.core.response_synthesizers.get_response_synthesizer"
] | [((1112, 1147), 'llama_index.core.instrumentation.get_dispatcher', 'instrument.get_dispatcher', (['__name__'], {}), '(__name__)\n', (1137, 1147), True, 'import llama_index.core.instrumentation as instrument\n'), ((5090, 5158), 'llama_index.core.settings.callback_manager_from_settings_or_context', 'callback_manager_from... |
import llama_index.core.instrumentation as instrument
from llama_index.core.llama_dataset.simple import LabelledSimpleDataset
from llama_index.packs.diff_private_simple_dataset.base import PromptBundle
from llama_index.packs.diff_private_simple_dataset import DiffPrivateSimpleDatasetPack
from llama_index.llms.openai im... | [
"llama_index.llms.openai.OpenAI",
"llama_index.core.llama_dataset.simple.LabelledSimpleDataset.from_json",
"llama_index.packs.diff_private_simple_dataset.DiffPrivateSimpleDatasetPack",
"llama_index.core.instrumentation.get_dispatcher",
"llama_index.packs.diff_private_simple_dataset.base.PromptBundle"
] | [((584, 611), 'llama_index.core.instrumentation.get_dispatcher', 'instrument.get_dispatcher', ([], {}), '()\n', (609, 611), True, 'import llama_index.core.instrumentation as instrument\n'), ((844, 886), 'llama_index.core.llama_dataset.simple.LabelledSimpleDataset.from_json', 'LabelledSimpleDataset.from_json', (['json_p... |
from typing import Any
from llama_index.core.callbacks.base_handler import BaseCallbackHandler
from llama_index.core.callbacks.simple_llm_handler import SimpleLLMHandler
def set_global_handler(eval_mode: str, **eval_params: Any) -> None:
"""Set global eval handlers."""
import llama_index.core
llama_inde... | [
"llama_index.callbacks.wandb.WandbCallbackHandler",
"llama_index.callbacks.deepeval.deepeval_callback_handler",
"llama_index.callbacks.argilla.argilla_callback_handler",
"llama_index.callbacks.honeyhive.honeyhive_callback_handler",
"llama_index.callbacks.openinference.OpenInferenceCallbackHandler",
"llama... | [((941, 976), 'llama_index.callbacks.wandb.WandbCallbackHandler', 'WandbCallbackHandler', ([], {}), '(**eval_params)\n', (961, 976), False, 'from llama_index.callbacks.wandb import WandbCallbackHandler\n'), ((1424, 1467), 'llama_index.callbacks.openinference.OpenInferenceCallbackHandler', 'OpenInferenceCallbackHandler'... |
"""Google Generative AI Vector Store.
The GenAI Semantic Retriever API is a managed end-to-end service that allows
developers to create a corpus of documents to perform semantic search on
related passages given a user query. For more information visit:
https://developers.generativeai.google/guide
"""
import logging
i... | [
"llama_index.legacy.vector_stores.google.generativeai.genai_extension.Config",
"llama_index.legacy.vector_stores.google.generativeai.genai_extension.create_corpus",
"llama_index.legacy.vector_stores.google.generativeai.genai_extension.delete_document",
"llama_index.legacy.vector_stores.google.generativeai.gen... | [((888, 915), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (905, 915), False, 'import logging\n'), ((1081, 1137), 'llama_index.legacy.indices.service_context.ServiceContext.from_defaults', 'ServiceContext.from_defaults', ([], {'llm': 'None', 'embed_model': 'None'}), '(llm=None, embed_mo... |
"""Download."""
import json
import logging
import os
import subprocess
import sys
from enum import Enum
from importlib import util
from pathlib import Path
from typing import Any, Dict, List, Optional, Union
import pkg_resources
import requests
from pkg_resources import DistributionNotFound
from llama_index.legacy.d... | [
"llama_index.legacy.download.utils.get_exports",
"llama_index.legacy.download.utils.initialize_directory"
] | [((645, 672), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (662, 672), False, 'import logging\n'), ((5586, 5619), 'os.path.exists', 'os.path.exists', (['requirements_path'], {}), '(requirements_path)\n', (5600, 5619), False, 'import os\n'), ((7468, 7536), 'llama_index.legacy.download.ut... |
import logging
from dataclasses import dataclass
from typing import Any, List, Optional, cast
import llama_index.legacy
from llama_index.legacy.bridge.pydantic import BaseModel
from llama_index.legacy.callbacks.base import CallbackManager
from llama_index.legacy.core.embeddings.base import BaseEmbedding
from llama_ind... | [
"llama_index.legacy.embeddings.utils.resolve_embed_model",
"llama_index.legacy.embeddings.loading.load_embed_model",
"llama_index.legacy.indices.prompt_helper.PromptHelper.from_dict",
"llama_index.legacy.node_parser.loading.load_parser",
"llama_index.legacy.llm_predictor.LLMPredictor",
"llama_index.legacy... | [((1067, 1094), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1084, 1094), False, 'import logging\n'), ((1869, 1926), 'llama_index.legacy.indices.prompt_helper.PromptHelper.from_llm_metadata', 'PromptHelper.from_llm_metadata', ([], {'llm_metadata': 'llm_metadata'}), '(llm_metadata=llm_m... |
"""Astra DB."""
from typing import Any, List, Optional
import llama_index.core
from llama_index.core.readers.base import BaseReader
from llama_index.core.schema import Document
class AstraDBReader(BaseReader):
"""Astra DB reader.
Retrieve documents from an Astra DB Instance.
Args:
collection_n... | [
"llama_index.core.schema.Document"
] | [((2732, 2820), 'llama_index.core.schema.Document', 'Document', ([], {'doc_id': "result['_id']", 'text': "result['content']", 'embedding': "result['$vector']"}), "(doc_id=result['_id'], text=result['content'], embedding=result[\n '$vector'])\n", (2740, 2820), False, 'from llama_index.core.schema import Document\n')] |
import os
from django.conf import settings
from django.http import JsonResponse
from django.views import View
import llama_index
from llama_index import (StorageContext,
load_index_from_storage,
ServiceContext,
set_global_service_context,
... | [
"llama_index.get_response_synthesizer",
"llama_index.ServiceContext.from_defaults",
"llama_index.retrievers.VectorIndexRetriever",
"llama_index.prompts.PromptTemplate",
"llama_index.set_global_handler",
"llama_index.StorageContext.from_defaults",
"llama_index.set_global_service_context",
"llama_index.... | [((837, 877), 'llama_index.set_global_handler', 'llama_index.set_global_handler', (['"""simple"""'], {}), "('simple')\n", (867, 877), False, 'import llama_index\n'), ((1043, 1080), 'llama_index.ServiceContext.from_defaults', 'ServiceContext.from_defaults', ([], {'llm': 'llm'}), '(llm=llm)\n', (1071, 1080), False, 'from... |
from unittest.mock import MagicMock, patch
import pytest
from llama_index.core.response.schema import Response
from llama_index.schema import Document
try:
import google.ai.generativelanguage as genai
has_google = True
except ImportError:
has_google = False
from llama_index.indices.managed.google.genera... | [
"llama_index.indices.managed.google.generativeai.GoogleIndex.from_corpus",
"llama_index.indices.managed.google.generativeai.set_google_config",
"llama_index.vector_stores.google.generativeai.genai_extension.get_config",
"llama_index.schema.Document",
"llama_index.indices.managed.google.generativeai.GoogleIn... | [((665, 724), 'pytest.mark.skipif', 'pytest.mark.skipif', (['(not has_google)'], {'reason': 'SKIP_TEST_REASON'}), '(not has_google, reason=SKIP_TEST_REASON)\n', (683, 724), False, 'import pytest\n'), ((726, 770), 'unittest.mock.patch', 'patch', (['"""google.auth.credentials.Credentials"""'], {}), "('google.auth.credent... |
from unittest.mock import MagicMock, patch
import pytest
from llama_index.schema import NodeRelationship, RelatedNodeInfo, TextNode
from llama_index.vector_stores.types import (
ExactMatchFilter,
MetadataFilters,
VectorStoreQuery,
)
try:
import google.ai.generativelanguage as genai
has_google = T... | [
"llama_index.vector_stores.google.generativeai.GoogleVectorStore.from_corpus",
"llama_index.vector_stores.google.generativeai.genai_extension.get_config",
"llama_index.vector_stores.google.generativeai.set_google_config",
"llama_index.schema.RelatedNodeInfo",
"llama_index.vector_stores.google.generativeai.G... | [((827, 886), 'pytest.mark.skipif', 'pytest.mark.skipif', (['(not has_google)'], {'reason': 'SKIP_TEST_REASON'}), '(not has_google, reason=SKIP_TEST_REASON)\n', (845, 886), False, 'import pytest\n'), ((888, 932), 'unittest.mock.patch', 'patch', (['"""google.auth.credentials.Credentials"""'], {}), "('google.auth.credent... |
import streamlit as st
import llama_index
from llama_index import StorageContext, load_index_from_storage
from llama_index.query_engine import RetrieverQueryEngine
from llama_index.storage.docstore import SimpleDocumentStore
from llama_index.vector_stores import SimpleVectorStore
from llama_index.storage.index_store im... | [
"llama_index.storage.docstore.SimpleDocumentStore.from_persist_dir",
"llama_index.storage.index_store.SimpleIndexStore.from_persist_dir",
"llama_index.ServiceContext.from_defaults",
"llama_index.retrievers.VectorIndexRetriever",
"llama_index.indices.keyword_table.retrievers.KeywordTableGPTRetriever",
"lla... | [((2439, 2481), 'llama_index.load_index_from_storage', 'load_index_from_storage', (['storage_context_1'], {}), '(storage_context_1)\n', (2462, 2481), False, 'from llama_index import load_index_from_storage, load_indices_from_storage, load_graph_from_storage\n'), ((2493, 2535), 'llama_index.load_index_from_storage', 'lo... |
from unittest.mock import MagicMock, patch
import pytest
try:
import google.ai.generativelanguage as genai
has_google = True
except ImportError:
has_google = False
from llama_index.response_synthesizers.google.generativeai import (
GoogleTextSynthesizer,
set_google_config,
)
from llama_index.sch... | [
"llama_index.vector_stores.google.generativeai.genai_extension.get_config",
"llama_index.response_synthesizers.google.generativeai.set_google_config",
"llama_index.schema.TextNode",
"llama_index.response_synthesizers.google.generativeai.GoogleTextSynthesizer.from_defaults"
] | [((642, 701), 'pytest.mark.skipif', 'pytest.mark.skipif', (['(not has_google)'], {'reason': 'SKIP_TEST_REASON'}), '(not has_google, reason=SKIP_TEST_REASON)\n', (660, 701), False, 'import pytest\n'), ((703, 747), 'unittest.mock.patch', 'patch', (['"""google.auth.credentials.Credentials"""'], {}), "('google.auth.credent... |
from unittest.mock import MagicMock, patch
import pytest
from llama_index.legacy.schema import NodeRelationship, RelatedNodeInfo, TextNode
from llama_index.legacy.vector_stores.types import (
ExactMatchFilter,
MetadataFilters,
VectorStoreQuery,
)
try:
import google.ai.generativelanguage as genai
... | [
"llama_index.legacy.vector_stores.google.generativeai.GoogleVectorStore.from_corpus",
"llama_index.legacy.vector_stores.google.generativeai.genai_extension.get_config",
"llama_index.legacy.vector_stores.types.ExactMatchFilter",
"llama_index.legacy.vector_stores.google.generativeai.set_google_config",
"llama... | [((855, 914), 'pytest.mark.skipif', 'pytest.mark.skipif', (['(not has_google)'], {'reason': 'SKIP_TEST_REASON'}), '(not has_google, reason=SKIP_TEST_REASON)\n', (873, 914), False, 'import pytest\n'), ((916, 960), 'unittest.mock.patch', 'patch', (['"""google.auth.credentials.Credentials"""'], {}), "('google.auth.credent... |
import logging
from dataclasses import dataclass
from typing import List, Optional
import llama_index
from llama_index.bridge.pydantic import BaseModel
from llama_index.callbacks.base import CallbackManager
from llama_index.embeddings.base import BaseEmbedding
from llama_index.embeddings.utils import EmbedType, resolv... | [
"llama_index.llms.utils.resolve_llm",
"llama_index.node_parser.loading.load_parser",
"llama_index.extractors.loading.load_extractor",
"llama_index.embeddings.loading.load_embed_model",
"llama_index.llm_predictor.LLMPredictor",
"llama_index.logger.LlamaLogger",
"llama_index.embeddings.utils.resolve_embed... | [((1019, 1046), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1036, 1046), False, 'import logging\n'), ((1821, 1878), 'llama_index.indices.prompt_helper.PromptHelper.from_llm_metadata', 'PromptHelper.from_llm_metadata', ([], {'llm_metadata': 'llm_metadata'}), '(llm_metadata=llm_metadata... |
"""Download."""
import json
import logging
import os
import subprocess
import sys
from enum import Enum
from importlib import util
from pathlib import Path
from typing import Any, Dict, List, Optional, Union
import requests
from llama_index.core.download.utils import (
get_exports,
get_file_content,
initi... | [
"llama_index.core.download.utils.get_exports",
"llama_index.core.download.utils.initialize_directory"
] | [((574, 601), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (591, 601), False, 'import logging\n'), ((5497, 5530), 'os.path.exists', 'os.path.exists', (['requirements_path'], {}), '(requirements_path)\n', (5511, 5530), False, 'import os\n'), ((7469, 7537), 'llama_index.core.download.util... |
"""Download."""
import json
import logging
import os
import subprocess
import sys
from enum import Enum
from importlib import util
from pathlib import Path
from typing import Any, Dict, List, Optional, Union
import requests
from llama_index.core.download.utils import (
get_exports,
get_file_content,
initi... | [
"llama_index.core.download.utils.get_exports",
"llama_index.core.download.utils.initialize_directory"
] | [((574, 601), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (591, 601), False, 'import logging\n'), ((5497, 5530), 'os.path.exists', 'os.path.exists', (['requirements_path'], {}), '(requirements_path)\n', (5511, 5530), False, 'import os\n'), ((7469, 7537), 'llama_index.core.download.util... |
"""Download."""
import json
import logging
import os
import subprocess
import sys
from enum import Enum
from importlib import util
from pathlib import Path
from typing import Any, Dict, List, Optional, Union
import requests
from llama_index.core.download.utils import (
get_exports,
get_file_content,
initi... | [
"llama_index.core.download.utils.get_exports",
"llama_index.core.download.utils.initialize_directory"
] | [((574, 601), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (591, 601), False, 'import logging\n'), ((5497, 5530), 'os.path.exists', 'os.path.exists', (['requirements_path'], {}), '(requirements_path)\n', (5511, 5530), False, 'import os\n'), ((7469, 7537), 'llama_index.core.download.util... |
import qdrant_client
from llama_index import (
VectorStoreIndex,
ServiceContext,
)
from llama_index.llms import Ollama
from llama_index.vector_stores.qdrant import QdrantVectorStore
import llama_index
llama_index.set_global_handler("simple")
# re-initialize the vector store
client = qdrant_client.... | [
"llama_index.ServiceContext.from_defaults",
"llama_index.set_global_handler",
"llama_index.vector_stores.qdrant.QdrantVectorStore",
"llama_index.VectorStoreIndex.from_vector_store",
"llama_index.llms.Ollama"
] | [((219, 259), 'llama_index.set_global_handler', 'llama_index.set_global_handler', (['"""simple"""'], {}), "('simple')\n", (249, 259), False, 'import llama_index\n'), ((306, 354), 'qdrant_client.QdrantClient', 'qdrant_client.QdrantClient', ([], {'path': '"""./qdrant_data"""'}), "(path='./qdrant_data')\n", (332, 354), Fa... |
"""General utils functions."""
import asyncio
import os
import random
import sys
import time
import traceback
import uuid
from contextlib import contextmanager
from dataclasses import dataclass
from functools import partial, wraps
from itertools import islice
from pathlib import Path
from typing import (
Any,
... | [
"llama_index.utils.get_cache_dir"
] | [((7192, 7223), 'os.path.join', 'os.path.join', (['dirname', 'basename'], {}), '(dirname, basename)\n', (7204, 7223), False, 'import os\n'), ((8174, 8215), 'transformers.AutoTokenizer.from_pretrained', 'AutoTokenizer.from_pretrained', (['model_name'], {}), '(model_name)\n', (8203, 8215), False, 'from transformers impor... |
"""General utils functions."""
import asyncio
import os
import random
import sys
import time
import traceback
import uuid
from contextlib import contextmanager
from dataclasses import dataclass
from functools import partial, wraps
from itertools import islice
from pathlib import Path
from typing import (
Any,
... | [
"llama_index.utils.get_cache_dir"
] | [((7192, 7223), 'os.path.join', 'os.path.join', (['dirname', 'basename'], {}), '(dirname, basename)\n', (7204, 7223), False, 'import os\n'), ((8174, 8215), 'transformers.AutoTokenizer.from_pretrained', 'AutoTokenizer.from_pretrained', (['model_name'], {}), '(model_name)\n', (8203, 8215), False, 'from transformers impor... |
"""General utils functions."""
import asyncio
import os
import random
import sys
import time
import traceback
import uuid
from contextlib import contextmanager
from dataclasses import dataclass
from functools import partial, wraps
from itertools import islice
from pathlib import Path
from typing import (
Any,
... | [
"llama_index.utils.get_cache_dir"
] | [((7192, 7223), 'os.path.join', 'os.path.join', (['dirname', 'basename'], {}), '(dirname, basename)\n', (7204, 7223), False, 'import os\n'), ((8174, 8215), 'transformers.AutoTokenizer.from_pretrained', 'AutoTokenizer.from_pretrained', (['model_name'], {}), '(model_name)\n', (8203, 8215), False, 'from transformers impor... |
"""Global eval handlers."""
from typing import Any
from llama_index.callbacks.arize_phoenix_callback import arize_phoenix_callback_handler
from llama_index.callbacks.base_handler import BaseCallbackHandler
from llama_index.callbacks.honeyhive_callback import honeyhive_callback_handler
from llama_index.callbacks.open_... | [
"llama_index.callbacks.wandb_callback.WandbCallbackHandler",
"llama_index.callbacks.simple_llm_handler.SimpleLLMHandler",
"llama_index.callbacks.honeyhive_callback.honeyhive_callback_handler",
"llama_index.callbacks.arize_phoenix_callback.arize_phoenix_callback_handler",
"llama_index.callbacks.open_inferenc... | [((917, 952), 'llama_index.callbacks.wandb_callback.WandbCallbackHandler', 'WandbCallbackHandler', ([], {}), '(**eval_params)\n', (937, 952), False, 'from llama_index.callbacks.wandb_callback import WandbCallbackHandler\n'), ((1010, 1053), 'llama_index.callbacks.open_inference_callback.OpenInferenceCallbackHandler', 'O... |
"""Global eval handlers."""
from typing import Any
from llama_index.callbacks.arize_phoenix_callback import arize_phoenix_callback_handler
from llama_index.callbacks.base_handler import BaseCallbackHandler
from llama_index.callbacks.honeyhive_callback import honeyhive_callback_handler
from llama_index.callbacks.open_... | [
"llama_index.callbacks.wandb_callback.WandbCallbackHandler",
"llama_index.callbacks.simple_llm_handler.SimpleLLMHandler",
"llama_index.callbacks.honeyhive_callback.honeyhive_callback_handler",
"llama_index.callbacks.arize_phoenix_callback.arize_phoenix_callback_handler",
"llama_index.callbacks.open_inferenc... | [((917, 952), 'llama_index.callbacks.wandb_callback.WandbCallbackHandler', 'WandbCallbackHandler', ([], {}), '(**eval_params)\n', (937, 952), False, 'from llama_index.callbacks.wandb_callback import WandbCallbackHandler\n'), ((1010, 1053), 'llama_index.callbacks.open_inference_callback.OpenInferenceCallbackHandler', 'O... |
"""Google Generative AI Vector Store.
The GenAI Semantic Retriever API is a managed end-to-end service that allows
developers to create a corpus of documents to perform semantic search on
related passages given a user query. For more information visit:
https://developers.generativeai.google/guide
"""
import logging
i... | [
"llama_index.vector_stores.google.generativeai.genai_extension.get_document",
"llama_index.vector_stores.google.generativeai.genai_extension.get_corpus",
"llama_index.vector_stores.google.generativeai.genai_extension.build_semantic_retriever",
"llama_index.indices.service_context.ServiceContext.from_defaults"... | [((843, 870), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (860, 870), False, 'import logging\n'), ((1036, 1092), 'llama_index.indices.service_context.ServiceContext.from_defaults', 'ServiceContext.from_defaults', ([], {'llm': 'None', 'embed_model': 'None'}), '(llm=None, embed_model=Non... |
"""Google Generative AI Vector Store.
The GenAI Semantic Retriever API is a managed end-to-end service that allows
developers to create a corpus of documents to perform semantic search on
related passages given a user query. For more information visit:
https://developers.generativeai.google/guide
"""
import logging
i... | [
"llama_index.vector_stores.google.generativeai.genai_extension.get_document",
"llama_index.vector_stores.google.generativeai.genai_extension.get_corpus",
"llama_index.vector_stores.google.generativeai.genai_extension.build_semantic_retriever",
"llama_index.indices.service_context.ServiceContext.from_defaults"... | [((843, 870), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (860, 870), False, 'import logging\n'), ((1036, 1092), 'llama_index.indices.service_context.ServiceContext.from_defaults', 'ServiceContext.from_defaults', ([], {'llm': 'None', 'embed_model': 'None'}), '(llm=None, embed_model=Non... |
"""Google Generative AI Vector Store.
The GenAI Semantic Retriever API is a managed end-to-end service that allows
developers to create a corpus of documents to perform semantic search on
related passages given a user query. For more information visit:
https://developers.generativeai.google/guide
"""
import logging
i... | [
"llama_index.vector_stores.google.generativeai.genai_extension.get_document",
"llama_index.vector_stores.google.generativeai.genai_extension.get_corpus",
"llama_index.vector_stores.google.generativeai.genai_extension.build_semantic_retriever",
"llama_index.indices.service_context.ServiceContext.from_defaults"... | [((843, 870), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (860, 870), False, 'import logging\n'), ((1036, 1092), 'llama_index.indices.service_context.ServiceContext.from_defaults', 'ServiceContext.from_defaults', ([], {'llm': 'None', 'embed_model': 'None'}), '(llm=None, embed_model=Non... |
import dataclasses
import logging
from dataclasses import dataclass
from typing import Optional
from langchain.base_language import BaseLanguageModel
import llama_index
from llama_index.callbacks.base import CallbackManager
from llama_index.embeddings.base import BaseEmbedding
from llama_index.embeddings.openai impor... | [
"llama_index.langchain_helpers.chain_wrapper.LLMPredictor",
"llama_index.logger.LlamaLogger",
"llama_index.indices.prompt_helper.PromptHelper.from_llm_metadata",
"llama_index.callbacks.base.CallbackManager",
"llama_index.embeddings.openai.OpenAIEmbedding",
"llama_index.node_parser.simple.SimpleNodeParser.... | [((709, 736), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (726, 736), False, 'import logging\n'), ((967, 1089), 'llama_index.node_parser.simple.SimpleNodeParser.from_defaults', 'SimpleNodeParser.from_defaults', ([], {'chunk_size': 'chunk_size', 'chunk_overlap': 'chunk_overlap', 'callba... |
"""Elasticsearch vector store."""
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.bridge.pydantic import PrivateAttr
from llama_index.schema import BaseNode, MetadataMode, Text... | [
"llama_index.vector_stores.utils.metadata_dict_to_node",
"llama_index.bridge.pydantic.PrivateAttr",
"llama_index.schema.TextNode",
"llama_index.vector_stores.utils.node_to_metadata_dict"
] | [((598, 617), 'logging.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (607, 617), False, 'from logging import getLogger\n'), ((2443, 2496), 'elasticsearch.AsyncElasticsearch', 'elasticsearch.AsyncElasticsearch', ([], {}), '(**connection_params)\n', (2475, 2496), False, 'import elasticsearch\n'), ((3819, 3... |
from typing import Any
from llama_index.core.callbacks.base_handler import BaseCallbackHandler
from llama_index.core.callbacks.simple_llm_handler import SimpleLLMHandler
def set_global_handler(eval_mode: str, **eval_params: Any) -> None:
"""Set global eval handlers."""
import llama_index.core
llama_inde... | [
"llama_index.callbacks.wandb.WandbCallbackHandler",
"llama_index.callbacks.deepeval.deepeval_callback_handler",
"llama_index.callbacks.argilla.argilla_callback_handler",
"llama_index.callbacks.honeyhive.honeyhive_callback_handler",
"llama_index.callbacks.openinference.OpenInferenceCallbackHandler",
"llama... | [((941, 976), 'llama_index.callbacks.wandb.WandbCallbackHandler', 'WandbCallbackHandler', ([], {}), '(**eval_params)\n', (961, 976), False, 'from llama_index.callbacks.wandb import WandbCallbackHandler\n'), ((1424, 1467), 'llama_index.callbacks.openinference.OpenInferenceCallbackHandler', 'OpenInferenceCallbackHandler'... |
from typing import Any
from llama_index.core.callbacks.base_handler import BaseCallbackHandler
from llama_index.core.callbacks.simple_llm_handler import SimpleLLMHandler
def set_global_handler(eval_mode: str, **eval_params: Any) -> None:
"""Set global eval handlers."""
import llama_index.core
llama_inde... | [
"llama_index.callbacks.wandb.WandbCallbackHandler",
"llama_index.callbacks.deepeval.deepeval_callback_handler",
"llama_index.callbacks.argilla.argilla_callback_handler",
"llama_index.callbacks.honeyhive.honeyhive_callback_handler",
"llama_index.callbacks.openinference.OpenInferenceCallbackHandler",
"llama... | [((941, 976), 'llama_index.callbacks.wandb.WandbCallbackHandler', 'WandbCallbackHandler', ([], {}), '(**eval_params)\n', (961, 976), False, 'from llama_index.callbacks.wandb import WandbCallbackHandler\n'), ((1424, 1467), 'llama_index.callbacks.openinference.OpenInferenceCallbackHandler', 'OpenInferenceCallbackHandler'... |
"""Google Generative AI Vector Store.
The GenAI Semantic Retriever API is a managed end-to-end service that allows
developers to create a corpus of documents to perform semantic search on
related passages given a user query. For more information visit:
https://developers.generativeai.google/guide
"""
import logging
i... | [
"llama_index.legacy.vector_stores.google.generativeai.genai_extension.Config",
"llama_index.legacy.vector_stores.google.generativeai.genai_extension.create_corpus",
"llama_index.legacy.vector_stores.google.generativeai.genai_extension.delete_document",
"llama_index.legacy.vector_stores.google.generativeai.gen... | [((888, 915), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (905, 915), False, 'import logging\n'), ((1081, 1137), 'llama_index.legacy.indices.service_context.ServiceContext.from_defaults', 'ServiceContext.from_defaults', ([], {'llm': 'None', 'embed_model': 'None'}), '(llm=None, embed_mo... |
"""Google Generative AI Vector Store.
The GenAI Semantic Retriever API is a managed end-to-end service that allows
developers to create a corpus of documents to perform semantic search on
related passages given a user query. For more information visit:
https://developers.generativeai.google/guide
"""
import logging
i... | [
"llama_index.legacy.vector_stores.google.generativeai.genai_extension.Config",
"llama_index.legacy.vector_stores.google.generativeai.genai_extension.create_corpus",
"llama_index.legacy.vector_stores.google.generativeai.genai_extension.delete_document",
"llama_index.legacy.vector_stores.google.generativeai.gen... | [((888, 915), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (905, 915), False, 'import logging\n'), ((1081, 1137), 'llama_index.legacy.indices.service_context.ServiceContext.from_defaults', 'ServiceContext.from_defaults', ([], {'llm': 'None', 'embed_model': 'None'}), '(llm=None, embed_mo... |
"""Download."""
import json
import logging
import os
import subprocess
import sys
from enum import Enum
from importlib import util
from pathlib import Path
from typing import Any, Dict, List, Optional, Union
import pkg_resources
import requests
from pkg_resources import DistributionNotFound
from llama_index.legacy.d... | [
"llama_index.legacy.download.utils.get_exports",
"llama_index.legacy.download.utils.initialize_directory"
] | [((645, 672), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (662, 672), False, 'import logging\n'), ((5586, 5619), 'os.path.exists', 'os.path.exists', (['requirements_path'], {}), '(requirements_path)\n', (5600, 5619), False, 'import os\n'), ((7468, 7536), 'llama_index.legacy.download.ut... |
"""Download."""
import json
import logging
import os
import subprocess
import sys
from enum import Enum
from importlib import util
from pathlib import Path
from typing import Any, Dict, List, Optional, Union
import pkg_resources
import requests
from pkg_resources import DistributionNotFound
from llama_index.legacy.d... | [
"llama_index.legacy.download.utils.get_exports",
"llama_index.legacy.download.utils.initialize_directory"
] | [((645, 672), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (662, 672), False, 'import logging\n'), ((5586, 5619), 'os.path.exists', 'os.path.exists', (['requirements_path'], {}), '(requirements_path)\n', (5600, 5619), False, 'import os\n'), ((7468, 7536), 'llama_index.legacy.download.ut... |
import logging
from dataclasses import dataclass
from typing import Any, List, Optional, cast
import llama_index.legacy
from llama_index.legacy.bridge.pydantic import BaseModel
from llama_index.legacy.callbacks.base import CallbackManager
from llama_index.legacy.core.embeddings.base import BaseEmbedding
from llama_ind... | [
"llama_index.legacy.embeddings.utils.resolve_embed_model",
"llama_index.legacy.embeddings.loading.load_embed_model",
"llama_index.legacy.indices.prompt_helper.PromptHelper.from_dict",
"llama_index.legacy.node_parser.loading.load_parser",
"llama_index.legacy.llm_predictor.LLMPredictor",
"llama_index.legacy... | [((1067, 1094), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1084, 1094), False, 'import logging\n'), ((1869, 1926), 'llama_index.legacy.indices.prompt_helper.PromptHelper.from_llm_metadata', 'PromptHelper.from_llm_metadata', ([], {'llm_metadata': 'llm_metadata'}), '(llm_metadata=llm_m... |
import logging
from dataclasses import dataclass
from typing import Any, List, Optional, cast
import llama_index.legacy
from llama_index.legacy.bridge.pydantic import BaseModel
from llama_index.legacy.callbacks.base import CallbackManager
from llama_index.legacy.core.embeddings.base import BaseEmbedding
from llama_ind... | [
"llama_index.legacy.embeddings.utils.resolve_embed_model",
"llama_index.legacy.embeddings.loading.load_embed_model",
"llama_index.legacy.indices.prompt_helper.PromptHelper.from_dict",
"llama_index.legacy.node_parser.loading.load_parser",
"llama_index.legacy.llm_predictor.LLMPredictor",
"llama_index.legacy... | [((1067, 1094), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1084, 1094), False, 'import logging\n'), ((1869, 1926), 'llama_index.legacy.indices.prompt_helper.PromptHelper.from_llm_metadata', 'PromptHelper.from_llm_metadata', ([], {'llm_metadata': 'llm_metadata'}), '(llm_metadata=llm_m... |
"""Astra DB."""
from typing import Any, List, Optional
import llama_index.core
from llama_index.core.readers.base import BaseReader
from llama_index.core.schema import Document
class AstraDBReader(BaseReader):
"""Astra DB reader.
Retrieve documents from an Astra DB Instance.
Args:
collection_n... | [
"llama_index.core.schema.Document"
] | [((2732, 2820), 'llama_index.core.schema.Document', 'Document', ([], {'doc_id': "result['_id']", 'text': "result['content']", 'embedding': "result['$vector']"}), "(doc_id=result['_id'], text=result['content'], embedding=result[\n '$vector'])\n", (2740, 2820), False, 'from llama_index.core.schema import Document\n')] |
from unittest.mock import MagicMock, patch
import pytest
from llama_index.legacy.schema import NodeRelationship, RelatedNodeInfo, TextNode
from llama_index.legacy.vector_stores.types import (
ExactMatchFilter,
MetadataFilters,
VectorStoreQuery,
)
try:
import google.ai.generativelanguage as genai
... | [
"llama_index.legacy.vector_stores.google.generativeai.GoogleVectorStore.from_corpus",
"llama_index.legacy.vector_stores.google.generativeai.genai_extension.get_config",
"llama_index.legacy.vector_stores.types.ExactMatchFilter",
"llama_index.legacy.vector_stores.google.generativeai.set_google_config",
"llama... | [((855, 914), 'pytest.mark.skipif', 'pytest.mark.skipif', (['(not has_google)'], {'reason': 'SKIP_TEST_REASON'}), '(not has_google, reason=SKIP_TEST_REASON)\n', (873, 914), False, 'import pytest\n'), ((916, 960), 'unittest.mock.patch', 'patch', (['"""google.auth.credentials.Credentials"""'], {}), "('google.auth.credent... |
"""
The core primatives for any language model interfacing. Docprompt uses these for the prompt garden, but
supports free conversion to and from these types from other libaries.
"""
from typing import Literal, Union, Optional
from pydantic import BaseModel, model_validator
class OpenAIImageURL(BaseModel):
url: s... | [
"llama_index.core.base.llms.types.ChatMessage.from_str"
] | [((487, 516), 'pydantic.model_validator', 'model_validator', ([], {'mode': '"""after"""'}), "(mode='after')\n", (502, 516), False, 'from pydantic import BaseModel, model_validator\n'), ((2416, 2493), 'llama_index.core.base.llms.types.ChatMessage.from_str', 'ChatMessage.from_str', ([], {'content': "dumped['content']", '... |
#!/usr/bin/env python3
# Copyright (c) 2023 Steve Castellotti
# This file is part of Urcuchillay and is released under the MIT License.
# See LICENSE file in the project root for full license information.
import argparse
import logging
import os
import sys
import config
import utils
try:
import llama_index
i... | [
"llama_index.VectorStoreIndex.from_documents",
"llama_index.SimpleDirectoryReader",
"llama_index.ServiceContext.from_defaults",
"llama_index.llms.LlamaCPP",
"llama_index.callbacks.LlamaDebugHandler",
"llama_index.StorageContext.from_defaults",
"llama_index.load_index_from_storage",
"llama_index.callba... | [((5042, 5107), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Process command parameters"""'}), "(description='Process command parameters')\n", (5065, 5107), False, 'import argparse\n'), ((5121, 5157), 'utils.parse_arguments_common', 'utils.parse_arguments_common', (['parser'], {}), '(p... |
import gradio as gr
from dotenv import load_dotenv
from prompts import context
#from note_engine import note_engine
import llama_index
from llama_index.core.tools import QueryEngineTool, ToolMetadata
from llama_index.core.agent import ReActAgent
from llama_index.llms.openai import OpenAI
from llama_index.core import (
... | [
"llama_index.core.VectorStoreIndex.from_documents",
"llama_index.embeddings.huggingface.HuggingFaceEmbedding",
"llama_index.core.tools.ToolMetadata",
"llama_index.llms.openai.OpenAI",
"llama_index.vector_stores.milvus.MilvusVectorStore",
"llama_index.core.StorageContext.from_defaults",
"llama_index.core... | [((613, 670), 'llama_index.embeddings.huggingface.HuggingFaceEmbedding', 'HuggingFaceEmbedding', ([], {'model_name': '"""BAAI/bge-small-en-v1.5"""'}), "(model_name='BAAI/bge-small-en-v1.5')\n", (633, 670), False, 'from llama_index.embeddings.huggingface import HuggingFaceEmbedding\n'), ((707, 720), 'dotenv.load_dotenv'... |
import os
import logging, sys
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
# fix llama index and chainlit bug
import llama_index
import llama_index.core
llama_index.__version__ = llama_index.core.__version__
import chainlit as cl
# llama-index core
from llama_index.core.query_engine.retriever_query_en... | [
"llama_index.core.StorageContext.from_defaults",
"llama_index.llms.ollama.Ollama",
"llama_index.core.embeddings.resolve_embed_model",
"llama_index.core.query_engine.retriever_query_engine.RetrieverQueryEngine.from_args"
] | [((31, 90), 'logging.basicConfig', 'logging.basicConfig', ([], {'stream': 'sys.stdout', 'level': 'logging.DEBUG'}), '(stream=sys.stdout, level=logging.DEBUG)\n', (50, 90), False, 'import logging, sys\n'), ((960, 986), 'os.environ.get', 'os.environ.get', (['"""username"""'], {}), "('username')\n", (974, 986), False, 'im... |
import llama_index
import json, os, time
from constants import MIXSC_ENGINE, CHAINOFTABLE_ENGINE, GPT_LLM, LOCAL_LLM
from llama_index import ServiceContext
from llama_index import set_global_service_context
from llama_index.embeddings import OpenAIEmbedding
from llama_index.llms import OpenAILike, OpenAI
from llama_hub... | [
"llama_index.ServiceContext.from_defaults",
"llama_index.llms.OpenAI",
"llama_index.embeddings.OpenAIEmbedding",
"llama_index.set_global_service_context",
"llama_index.llms.OpenAILike"
] | [((592, 619), 'os.path.dirname', 'os.path.dirname', (['script_dir'], {}), '(script_dir)\n', (607, 619), False, 'import json, os, time\n'), ((634, 682), 'os.path.join', 'os.path.join', (['f"""{upper_dir}/conf"""', '"""config.json"""'], {}), "(f'{upper_dir}/conf', 'config.json')\n", (646, 682), False, 'import json, os, t... |
from typing import Any, List, Optional, Sequence
from llama_index.core.prompts.prompt_utils import get_biggest_prompt
from llama_index.core.response_synthesizers.refine import Refine
from llama_index.core.types import RESPONSE_TEXT_TYPE
import llama_index.core.instrumentation as instrument
dispatcher = instrument.get... | [
"llama_index.core.instrumentation.get_dispatcher",
"llama_index.core.prompts.prompt_utils.get_biggest_prompt"
] | [((306, 341), 'llama_index.core.instrumentation.get_dispatcher', 'instrument.get_dispatcher', (['__name__'], {}), '(__name__)\n', (331, 341), True, 'import llama_index.core.instrumentation as instrument\n'), ((2027, 2082), 'llama_index.core.prompts.prompt_utils.get_biggest_prompt', 'get_biggest_prompt', (['[text_qa_tem... |
import llama_index, os
import dill as pickle # dill is a more powerful version of pickle
from llama_index import ServiceContext, StorageContext
from dotenv import load_dotenv
from langchain.chat_models import ChatOpenAI
from langchain.embeddings import OpenAIEmbeddings
load_dotenv('app/.env')
OPENAI_API_KEY = os.envi... | [
"llama_index.ServiceContext.from_defaults",
"llama_index.set_global_service_context",
"llama_index.StorageContext.from_defaults"
] | [((271, 294), 'dotenv.load_dotenv', 'load_dotenv', (['"""app/.env"""'], {}), "('app/.env')\n", (282, 294), False, 'from dotenv import load_dotenv\n'), ((313, 345), 'os.environ.get', 'os.environ.get', (['"""OPENAI_API_KEY"""'], {}), "('OPENAI_API_KEY')\n", (327, 345), False, 'import llama_index, os\n'), ((353, 406), 'la... |
import os
import pickle
from dotenv import load_dotenv
import llama_index
from langchain import OpenAI
from langchain.embeddings import OpenAIEmbeddings
from llama_index import LLMPredictor, ServiceContext
from llama_index import SimpleDirectoryReader, LangchainEmbedding, GPTVectorStoreIndex
class IndexChatBot:
... | [
"llama_index.ServiceContext.from_defaults",
"llama_index.GPTVectorStoreIndex.from_documents",
"llama_index.LangchainEmbedding",
"llama_index.Document"
] | [((426, 490), 'os.path.join', 'os.path.join', (['artifact_folder', 'project_name', '"""story_summary.pkl"""'], {}), "(artifact_folder, project_name, 'story_summary.pkl')\n", (438, 490), False, 'import os\n'), ((721, 763), 'dotenv.load_dotenv', 'load_dotenv', ([], {'dotenv_path': '""".env/openai.env"""'}), "(dotenv_path... |
import logging
import sys
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
logging.getLogger().addHandler(logging.StreamHandler(stream=sys.stdout))
import os
from dotenv import load_dotenv
load_dotenv()
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
bulk_data = True
# ----------------------------------
as... | [
"llama_index.VectorStoreIndex.from_documents",
"llama_index.storage.storage_context.StorageContext.from_defaults",
"llama_index.vector_stores.ElasticsearchStore",
"llama_index.SimpleDirectoryReader",
"llama_index.ServiceContext.from_defaults",
"llama_index.llms.OpenAI",
"llama_index.set_global_handler",... | [((27, 86), 'logging.basicConfig', 'logging.basicConfig', ([], {'stream': 'sys.stdout', 'level': 'logging.DEBUG'}), '(stream=sys.stdout, level=logging.DEBUG)\n', (46, 86), False, 'import logging\n'), ((202, 215), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (213, 215), False, 'from dotenv import load_dotenv\n... |
import argparse
from llama_index import (
SimpleDirectoryReader,
VectorStoreIndex,
ServiceContext,
)
from llama_index.llms import LlamaCPP
# use Huggingface embeddings
from llama_index.embeddings import HuggingFaceEmbedding
from llama_index.llms.llama_utils import messages_to_prompt, completion_to_prompt
fr... | [
"llama_index.VectorStoreIndex.from_documents",
"llama_index.SimpleDirectoryReader",
"llama_index.ServiceContext.from_defaults",
"llama_index.llms.LlamaCPP",
"llama_index.embeddings.HuggingFaceEmbedding"
] | [((693, 718), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (716, 718), False, 'import argparse\n'), ((1711, 2046), 'llama_index.llms.LlamaCPP', 'LlamaCPP', ([], {'model_url': 'None', 'model_path': 'args.language_model_path', 'temperature': '(0.1)', 'max_new_tokens': 'args.max_new_tokens', 'co... |
"""Global eval handlers."""
from typing import Any
from llama_index.callbacks.argilla_callback import argilla_callback_handler
from llama_index.callbacks.arize_phoenix_callback import arize_phoenix_callback_handler
from llama_index.callbacks.base_handler import BaseCallbackHandler
from llama_index.callbacks.deepeval_... | [
"llama_index.callbacks.wandb_callback.WandbCallbackHandler",
"llama_index.callbacks.honeyhive_callback.honeyhive_callback_handler",
"llama_index.callbacks.simple_llm_handler.SimpleLLMHandler",
"llama_index.callbacks.arize_phoenix_callback.arize_phoenix_callback_handler",
"llama_index.callbacks.promptlayer_h... | [((1144, 1179), 'llama_index.callbacks.wandb_callback.WandbCallbackHandler', 'WandbCallbackHandler', ([], {}), '(**eval_params)\n', (1164, 1179), False, 'from llama_index.callbacks.wandb_callback import WandbCallbackHandler\n'), ((1237, 1280), 'llama_index.callbacks.open_inference_callback.OpenInferenceCallbackHandler'... |
import os
import glob
import llama_index
from llama_index.core import ServiceContext
from llama_index.llms.gemini import Gemini
from llama_index.core import SimpleDirectoryReader
from llama_index.core.response_synthesizers import TreeSummarize
MODEL = "Gemini"
DATA_DIR = "data"
SUMMARY_ROOT = "summaries"
SUMMARY_DIR =... | [
"llama_index.core.SimpleDirectoryReader",
"llama_index.llms.gemini.Gemini",
"llama_index.core.response_synthesizers.TreeSummarize",
"llama_index.core.ServiceContext.from_defaults"
] | [((374, 413), 'os.makedirs', 'os.makedirs', (['SUMMARY_DIR'], {'exist_ok': '(True)'}), '(SUMMARY_DIR, exist_ok=True)\n', (385, 413), False, 'import os\n'), ((1344, 1352), 'llama_index.llms.gemini.Gemini', 'Gemini', ([], {}), '()\n', (1350, 1352), False, 'from llama_index.llms.gemini import Gemini\n'), ((1371, 1429), 'l... |
import llama_index
import weaviate
from importlib.metadata import version
print(f"LlamaIndex version: {version('llama_index')}")
print(f"Weaviate version: {version('weaviate-client')}")
# Load API key from .env file
import os
from dotenv import load_dotenv, find_dotenv
load_dotenv(find_dotenv())
# Define embedding... | [
"llama_index.vector_stores.weaviate.WeaviateVectorStore",
"llama_index.llms.openai.OpenAI",
"llama_index.core.VectorStoreIndex",
"llama_index.core.postprocessor.MetadataReplacementPostProcessor",
"llama_index.core.StorageContext.from_defaults",
"llama_index.core.node_parser.SentenceWindowNodeParser.from_d... | [((500, 546), 'llama_index.llms.openai.OpenAI', 'OpenAI', ([], {'model': '"""gpt-3.5-turbo"""', 'temperature': '(0.1)'}), "(model='gpt-3.5-turbo', temperature=0.1)\n", (506, 546), False, 'from llama_index.llms.openai import OpenAI\n'), ((570, 587), 'llama_index.embeddings.openai.OpenAIEmbedding', 'OpenAIEmbedding', ([]... |
import llama_index
from llama_index import GPTVectorStoreIndex, Document, SimpleDirectoryReader, LlamaIndex
import os
import openai
os.environ['OPENAI_API_KEY'] = 'sk-YOUR-API-KEY'
# Loading from a directory
documents = SimpleDirectoryReader('data').load_data()
index = LlamaIndex()
documents = [Document(text="What i... | [
"llama_index.SimpleDirectoryReader",
"llama_index.LlamaIndex",
"llama_index.GPTVectorStoreIndex.load_from_disk",
"llama_index.GPTVectorStoreIndex.from_documents",
"llama_index.Document"
] | [((273, 285), 'llama_index.LlamaIndex', 'LlamaIndex', ([], {}), '()\n', (283, 285), False, 'from llama_index import GPTVectorStoreIndex, Document, SimpleDirectoryReader, LlamaIndex\n'), ((501, 542), 'llama_index.GPTVectorStoreIndex.from_documents', 'GPTVectorStoreIndex.from_documents', (['nodes'], {}), '(nodes)\n', (53... |
"""Elasticsearch vector store."""
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.schema import BaseNode, MetadataMode, TextNode
from llama_index.vector_stores.types import (
... | [
"llama_index.vector_stores.utils.metadata_dict_to_node",
"llama_index.schema.TextNode",
"llama_index.vector_stores.utils.node_to_metadata_dict"
] | [((534, 553), 'logging.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (543, 553), False, 'from logging import getLogger\n'), ((2379, 2432), 'elasticsearch.AsyncElasticsearch', 'elasticsearch.AsyncElasticsearch', ([], {}), '(**connection_params)\n', (2411, 2432), False, 'import elasticsearch\n'), ((3666, 3... |
get_ipython().run_line_magic('pip', 'install llama-index-vector-stores-pinecone')
import phoenix as px
import llama_index.core
px.launch_app()
llama_index.core.set_global_handler("arize_phoenix")
import os
os.environ[
"PINECONE_API_KEY"
] = "<Your Pinecone API key, from app.pinecone.io>"
from pinecone i... | [
"llama_index.core.schema.TextNode",
"llama_index.core.VectorStoreIndex",
"llama_index.core.StorageContext.from_defaults",
"llama_index.vector_stores.pinecone.PineconeVectorStore",
"llama_index.core.prompts.display_prompt_dict",
"llama_index.core.PromptTemplate",
"llama_index.core.vector_stores.MetadataI... | [((134, 149), 'phoenix.launch_app', 'px.launch_app', ([], {}), '()\n', (147, 149), True, 'import phoenix as px\n'), ((418, 443), 'pinecone.Pinecone', 'Pinecone', ([], {'api_key': 'api_key'}), '(api_key=api_key)\n', (426, 443), False, 'from pinecone import Pinecone\n'), ((2239, 2307), 'llama_index.vector_stores.pinecone... |
"""Elasticsearch vector store."""
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.schema import BaseNode, MetadataMode, TextNode
from llama_index.vector_stores.types import (
... | [
"llama_index.vector_stores.utils.metadata_dict_to_node",
"llama_index.schema.TextNode",
"llama_index.vector_stores.utils.node_to_metadata_dict"
] | [((534, 553), 'logging.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (543, 553), False, 'from logging import getLogger\n'), ((2379, 2432), 'elasticsearch.AsyncElasticsearch', 'elasticsearch.AsyncElasticsearch', ([], {}), '(**connection_params)\n', (2411, 2432), False, 'import elasticsearch\n'), ((3755, 3... |
from llama_index_manager import LLAMA_Index_Manager
from llama_index import SimpleDirectoryReader
manager = LLAMA_Index_Manager('vigilant-yeti-400300', 'oi-hackathon', 'blah/blah/eriks_vector_index')
# Retrieve vector store (If you put a path that doesen't exist, it will return a new empty index)
index = manager.retr... | [
"llama_index.SimpleDirectoryReader",
"llama_index_manager.LLAMA_Index_Manager"
] | [((109, 204), 'llama_index_manager.LLAMA_Index_Manager', 'LLAMA_Index_Manager', (['"""vigilant-yeti-400300"""', '"""oi-hackathon"""', '"""blah/blah/eriks_vector_index"""'], {}), "('vigilant-yeti-400300', 'oi-hackathon',\n 'blah/blah/eriks_vector_index')\n", (128, 204), False, 'from llama_index_manager import LLAMA_I... |
get_ipython().run_line_magic('pip', 'install llama-index-llms-openai')
import os
from getpass import getpass
if os.getenv("OPENAI_API_KEY") is None:
os.environ["OPENAI_API_KEY"] = getpass(
"Paste your OpenAI key from:"
" https://platform.openai.com/account/api-keys\n"
)
assert os.getenv("OPEN... | [
"llama_index.core.VectorStoreIndex.from_documents",
"llama_index.llms.openai.OpenAI",
"llama_index.core.callbacks.CallbackManager",
"llama_index.core.set_global_handler",
"llama_index.core.SimpleDirectoryReader",
"llama_index.core.callbacks.LlamaDebugHandler"
] | [((1229, 1265), 'llama_index.llms.openai.OpenAI', 'OpenAI', ([], {'model': '"""gpt-4"""', 'temperature': '(0)'}), "(model='gpt-4', temperature=0)\n", (1235, 1265), False, 'from llama_index.llms.openai import OpenAI\n'), ((1343, 1484), 'llama_index.core.set_global_handler', 'set_global_handler', (['"""honeyhive"""'], {'... |
from llama_index.core import KnowledgeGraphIndex
from llama_index.core import StorageContext, load_index_from_storage
import llama_index.core
llama_index.core.set_global_handler("langfuse")
# rebuild storage context
storage_context = StorageContext.from_defaults(persist_dir="math_index_persist")
# load index
query_e... | [
"llama_index.core.StorageContext.from_defaults",
"llama_index.core.load_index_from_storage"
] | [((236, 298), 'llama_index.core.StorageContext.from_defaults', 'StorageContext.from_defaults', ([], {'persist_dir': '"""math_index_persist"""'}), "(persist_dir='math_index_persist')\n", (264, 298), False, 'from llama_index.core import StorageContext, load_index_from_storage\n'), ((328, 368), 'llama_index.core.load_inde... |
"""Global eval handlers."""
from typing import Any
from llama_index.callbacks.arize_phoenix_callback import arize_phoenix_callback_handler
from llama_index.callbacks.base_handler import BaseCallbackHandler
from llama_index.callbacks.honeyhive_callback import honeyhive_callback_handler
from llama_index.callbacks.open_... | [
"llama_index.callbacks.wandb_callback.WandbCallbackHandler",
"llama_index.callbacks.honeyhive_callback.honeyhive_callback_handler",
"llama_index.callbacks.simple_llm_handler.SimpleLLMHandler",
"llama_index.callbacks.arize_phoenix_callback.arize_phoenix_callback_handler",
"llama_index.callbacks.promptlayer_h... | [((990, 1025), 'llama_index.callbacks.wandb_callback.WandbCallbackHandler', 'WandbCallbackHandler', ([], {}), '(**eval_params)\n', (1010, 1025), False, 'from llama_index.callbacks.wandb_callback import WandbCallbackHandler\n'), ((1083, 1126), 'llama_index.callbacks.open_inference_callback.OpenInferenceCallbackHandler',... |
"""
File name: prepare_chain_4_chat.py
Author: Luigi Saetta
Date created: 2023-01-04
Date last modified: 2023-03-03
Python Version: 3.9
Description:
This module provides a function to initialize the RAG chain
for chat using the message history
Usage:
Import this module into other scripts to use its func... | [
"llama_index.memory.ChatMemoryBuffer.from_defaults",
"llama_index.callbacks.TokenCountingHandler",
"llama_index.VectorStoreIndex.from_vector_store",
"llama_index.ServiceContext.from_defaults",
"llama_index.set_global_handler",
"llama_index.llms.MistralAI",
"llama_index.callbacks.CallbackManager",
"lla... | [((1998, 2094), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO', 'format': '"""%(asctime)s - %(levelname)s - %(message)s"""'}), "(level=logging.INFO, format=\n '%(asctime)s - %(levelname)s - %(message)s')\n", (2017, 2094), False, 'import logging\n'), ((5459, 5506), 'logging.info', 'loggin... |
# -*- coding: utf-8 -*-
"""llama_2_llama_cpp.ipynb
Automatically generated by Colaboratory.
# LlamaCPP
How to use the [llama-cpp-python](https://github.com/abetlen/llama-cpp-python) library with LlamaIndex.
We use the [`llama-2-chat-13b-ggml`](https://huggingface.co/TheBloke/Llama-2-13B-chat-GGML) model, along with... | [
"llama_index.VectorStoreIndex.from_documents",
"llama_index.SimpleDirectoryReader",
"llama_index.ServiceContext.from_defaults",
"llama_index.llms.LlamaCPP",
"llama_index.embeddings.HuggingFaceEmbedding"
] | [((1295, 1561), 'llama_index.llms.LlamaCPP', 'LlamaCPP', ([], {'model_url': 'model_url', 'model_path': 'None', 'temperature': '(0.1)', 'max_new_tokens': '(256)', 'context_window': '(3900)', 'generate_kwargs': '{}', 'model_kwargs': "{'n_gpu_layers': 1}", 'messages_to_prompt': 'messages_to_prompt', 'completion_to_prompt'... |
from fastapi import FastAPI, HTTPException, Request
from fastapi.responses import JSONResponse
import os.path
import llama_index
from llama_index import (
VectorStoreIndex,
SimpleDirectoryReader,
StorageContext,
ServiceContext,
load_index_from_storage,
set_global_service_context,
PromptTemp... | [
"llama_index.VectorStoreIndex.from_documents",
"llama_index.SimpleDirectoryReader",
"llama_index.ServiceContext.from_defaults",
"llama_index.set_global_handler",
"llama_index.StorageContext.from_defaults",
"llama_index.set_global_service_context",
"llama_index.PromptTemplate",
"llama_index.load_index_... | [((423, 482), 'logging.basicConfig', 'logging.basicConfig', ([], {'stream': 'sys.stdout', 'level': 'logging.DEBUG'}), '(stream=sys.stdout, level=logging.DEBUG)\n', (442, 482), False, 'import logging\n'), ((594, 634), 'llama_index.set_global_handler', 'llama_index.set_global_handler', (['"""simple"""'], {}), "('simple')... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.