code
stringlengths
141
97.3k
apis
listlengths
1
24
extract_api
stringlengths
113
214k
""" This script demonstrates how to use the llama_index library to create and query a vector store index. It loads documents from a directory, creates an index, and allows querying the index. usage: python hello_persist.py "What is the author's name and job now?" """ import os import sys import argparse import loggin...
[ "llama_index.core.StorageContext.from_defaults", "llama_index.core.VectorStoreIndex.from_documents", "llama_index.core.SimpleDirectoryReader", "llama_index.core.load_index_from_storage", "llama_index.embeddings.openai.OpenAIEmbedding" ]
[((1804, 1870), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Query a vector store index."""'}), "(description='Query a vector store index.')\n", (1827, 1870), False, 'import argparse\n'), ((628, 641), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (639, 641), False, 'from doten...
import streamlit as st from llama_hub.youtube_transcript import YoutubeTranscriptReader from llama_hub.youtube_transcript import is_youtube_video from llama_index import ( VectorStoreIndex, StorageContext, load_index_from_storage, ) from llama_index.prompts import ChatMessage, MessageRole from llama_index....
[ "llama_index.VectorStoreIndex.from_documents", "llama_index.StorageContext.from_defaults", "llama_index.load_index_from_storage", "llama_index.tools.ToolMetadata" ]
[((1466, 1499), 'streamlit.session_state.get', 'st.session_state.get', (['"""video_url"""'], {}), "('video_url')\n", (1486, 1499), True, 'import streamlit as st\n'), ((1684, 1749), 'streamlit.header', 'st.header', (['f"""This page has run {st.session_state.counter} times."""'], {}), "(f'This page has run {st.session_st...
import os from typing import Any, Optional from llama_index.core.readers.base import BasePydanticReader from llama_index.core.schema import Document DEFAULT_TOKEN_JSON_PATH = 'token.json' DEFAULT_SERVICE_ACCOUNT_JSON_PATH = 'service_account.json' DEFAULT_CREDENTIALS_JSON_PATH = 'credentials.json' HEADING_STYLE_TEMPL...
[ "llama_index.core.schema.Document" ]
[((3044, 3098), 'googleapiclient.discovery.build', 'discovery.build', (['"""docs"""', '"""v1"""'], {'credentials': 'credentials'}), "('docs', 'v1', credentials=credentials)\n", (3059, 3098), True, 'import googleapiclient.discovery as discovery\n'), ((4002, 4038), 'os.path.exists', 'os.path.exists', (['self.token_json_p...
import utils import os import openai import sys from dotenv import load_dotenv load_dotenv() api_key = os.getenv("API_KEY") openai.api_key os.environ['OPENAI_API_KEY'] = api_key # # examples # https://github.com/kevintsai/Building-and-Evaluating-Advanced-RAG-Applications # # SimpleDirectoryReader is a class that rea...
[ "llama_index.VectorStoreIndex.from_documents", "llama_index.llms.OpenAI", "llama_index.ServiceContext.from_defaults", "llama_index.SimpleDirectoryReader" ]
[((82, 95), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (93, 95), False, 'from dotenv import load_dotenv\n'), ((106, 126), 'os.getenv', 'os.getenv', (['"""API_KEY"""'], {}), "('API_KEY')\n", (115, 126), False, 'import os\n'), ((1774, 1825), 'llama_index.llms.OpenAI', 'OpenAI', ([], {'model': '"""gpt-4-1106-p...
# Import the necessary libraries import random import time from llama_index.llms import OpenAI import streamlit as st from llama_index import VectorStoreIndex, ServiceContext, StorageContext, set_global_service_context from langchain.embeddings.huggingface import HuggingFaceEmbeddings from llama_index.embeddings import...
[ "llama_index.vector_stores.ChromaVectorStore", "llama_index.llms.OpenAI", "llama_index.indices.prompt_helper.PromptHelper", "llama_index.indices.vector_store.retrievers.VectorIndexRetriever", "llama_index.node_parser.SentenceSplitter", "llama_index.set_global_service_context" ]
[((855, 895), 'streamlit.title', 'st.title', (['"""🦜🔗 Tourism Assistant Chatbot"""'], {}), "('🦜🔗 Tourism Assistant Chatbot')\n", (863, 895), True, 'import streamlit as st\n'), ((5721, 5781), 'llama_index.set_global_service_context', 'set_global_service_context', (['st.session_state.service_context'], {}), '(st.sess...
import os import json import logging import sys import requests from dotenv import load_dotenv from requests.adapters import HTTPAdapter from urllib3.util.retry import Retry from llama_index.core import VectorStoreIndex, Document from llama_index.tools.brave_search import BraveSearchToolSpec from llama_index.readers.we...
[ "llama_index.core.Document", "llama_index.core.VectorStoreIndex.from_documents", "llama_index.tools.brave_search.BraveSearchToolSpec" ]
[((496, 569), 'urllib3.util.retry.Retry', 'Retry', ([], {'total': '(5)', 'backoff_factor': '(0.1)', 'status_forcelist': '[500, 502, 503, 504]'}), '(total=5, backoff_factor=0.1, status_forcelist=[500, 502, 503, 504])\n', (501, 569), False, 'from urllib3.util.retry import Retry\n'), ((675, 733), 'logging.basicConfig', 'l...
import qdrant_client from llama_index.llms import Ollama from llama_index import ( VectorStoreIndex, ServiceContext, ) from llama_index.vector_stores.qdrant import QdrantVectorStore # re-initialize the vector store client = qdrant_client.QdrantClient( path="./qdrant_data" ) vector_store = QdrantVectorStore...
[ "llama_index.vector_stores.qdrant.QdrantVectorStore", "llama_index.VectorStoreIndex.from_vector_store", "llama_index.ServiceContext.from_defaults", "llama_index.llms.Ollama" ]
[((233, 281), 'qdrant_client.QdrantClient', 'qdrant_client.QdrantClient', ([], {'path': '"""./qdrant_data"""'}), "(path='./qdrant_data')\n", (259, 281), False, 'import qdrant_client\n'), ((303, 361), 'llama_index.vector_stores.qdrant.QdrantVectorStore', 'QdrantVectorStore', ([], {'client': 'client', 'collection_name': ...
import os from llama_index.core import StorageContext, VectorStoreIndex, load_index_from_storage from llama_index.readers.file import PDFReader # def get_index(data, index_name): # index = None # if not os.path.exists(index_name): # print('Building index', index_name) # index = VectorStoreIn...
[ "llama_index.readers.file.PDFReader", "llama_index.core.StorageContext.from_defaults", "llama_index.core.VectorStoreIndex.from_documents" ]
[((1404, 1440), 'os.path.join', 'os.path.join', (['"""data"""', '"""Malaysia.pdf"""'], {}), "('data', 'Malaysia.pdf')\n", (1416, 1440), False, 'import os\n'), ((952, 963), 'llama_index.readers.file.PDFReader', 'PDFReader', ([], {}), '()\n', (961, 963), False, 'from llama_index.readers.file import PDFReader\n'), ((1030,...
from llama_index.retrievers import BaseRetriever from llama_index import QueryBundle from llama_index.schema import NodeWithScore from llama_index.vector_stores import VectorStoreQuery from typing import List, Sequence, Any from llama_index.tools import BaseTool, adapt_to_async_tool from llama_index import Document, Ve...
[ "llama_index.VectorStoreIndex.from_documents", "llama_index.tools.adapt_to_async_tool", "llama_index.retrievers.VectorIndexRetriever", "llama_index.Document" ]
[((1143, 1228), 'llama_index.retrievers.VectorIndexRetriever', 'VectorIndexRetriever', ([], {'index': 'self._index', 'similarity_top_k': 'self._similarity_top_k'}), '(index=self._index, similarity_top_k=self._similarity_top_k\n )\n', (1163, 1228), False, 'from llama_index.retrievers import VectorIndexRetriever\n'), ...
from typing import List from fastapi.responses import StreamingResponse from app.utils.json import json_to_model from app.utils.index import get_index from fastapi import APIRouter, Depends, HTTPException, Request, status from llama_index import VectorStoreIndex from llama_index.llms.base import MessageRole, ChatMess...
[ "llama_index.llms.base.ChatMessage" ]
[((374, 385), 'fastapi.APIRouter', 'APIRouter', ([], {}), '()\n', (383, 385), False, 'from fastapi import APIRouter, Depends, HTTPException, Request, status\n'), ((798, 816), 'fastapi.Depends', 'Depends', (['get_index'], {}), '(get_index)\n', (805, 816), False, 'from fastapi import APIRouter, Depends, HTTPException, Re...
import os from llama_index import ( VectorStoreIndex, SimpleDirectoryReader, StorageContext, load_index_from_storage, ) BOT_NAME = os.environ["BOT_NAME"] def construct_index(directory_data, directory_index, force_reload=False): # check if storage already exists if not os.path.exists(directory...
[ "llama_index.VectorStoreIndex.from_documents", "llama_index.StorageContext.from_defaults", "llama_index.load_index_from_storage", "llama_index.SimpleDirectoryReader" ]
[((541, 583), 'llama_index.VectorStoreIndex.from_documents', 'VectorStoreIndex.from_documents', (['documents'], {}), '(documents)\n', (572, 583), False, 'from llama_index import VectorStoreIndex, SimpleDirectoryReader, StorageContext, load_index_from_storage\n'), ((871, 928), 'llama_index.StorageContext.from_defaults',...
from llama_index import SimpleDirectoryReader, ServiceContext, VectorStoreIndex from llama_index.llms import OpenAI, ChatMessage, MessageRole from llama_index.chat_engine.condense_plus_context import CondensePlusContextChatEngine from dotenv import load_dotenv import os load_dotenv() vector_index = None history = [] ...
[ "llama_index.VectorStoreIndex.from_documents", "llama_index.ServiceContext.from_defaults", "llama_index.chat_engine.condense_plus_context.CondensePlusContextChatEngine.from_defaults", "llama_index.SimpleDirectoryReader", "llama_index.llms.OpenAI", "llama_index.llms.ChatMessage" ]
[((271, 284), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (282, 284), False, 'from dotenv import load_dotenv\n'), ((379, 425), 'llama_index.llms.OpenAI', 'OpenAI', ([], {'model': '"""gpt-3.5-turbo"""', 'temperature': '(0.5)'}), "(model='gpt-3.5-turbo', temperature=0.5)\n", (385, 425), False, 'from llama_inde...
import streamlit as st import openai from llama_index.storage.docstore import SimpleDocumentStore from llama_index.vector_stores import FaissVectorStore from llama_index.storage.index_store import SimpleIndexStore from llama_index import load_index_from_storage from llama_index.storage.storage_context import StorageCo...
[ "llama_index.storage.docstore.SimpleDocumentStore.from_persist_dir", "llama_index.vector_stores.FaissVectorStore.from_persist_dir", "llama_index.query_engine.CitationQueryEngine.from_args", "llama_index.storage.index_store.SimpleIndexStore.from_persist_dir", "llama_index.load_index_from_storage" ]
[((983, 1050), 'streamlit.set_page_config', 'st.set_page_config', ([], {'layout': '"""wide"""', 'page_title': '"""Precedents Database"""'}), "(layout='wide', page_title='Precedents Database')\n", (1001, 1050), True, 'import streamlit as st\n'), ((1056, 1084), 'streamlit.title', 'st.title', (['"""Query Precedents"""'], ...
import streamlit as st from dotenv import load_dotenv load_dotenv() import os import tempfile from llama_index import SimpleDirectoryReader, StorageContext, LLMPredictor from llama_index import VectorStoreIndex from llama_index import ServiceContext from llama_index.embeddings.langchain import LangchainEmbedding from...
[ "llama_index.VectorStoreIndex.from_documents", "llama_index.ServiceContext.from_defaults", "llama_index.StorageContext.from_defaults", "llama_index.SimpleDirectoryReader" ]
[((55, 68), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (66, 68), False, 'from dotenv import load_dotenv\n'), ((860, 890), 'llama_index.StorageContext.from_defaults', 'StorageContext.from_defaults', ([], {}), '()\n', (888, 890), False, 'from llama_index import SimpleDirectoryReader, StorageContext, LLMPredic...
from dotenv import load_dotenv import os import streamlit as st import pandas as pd from llama_index.core.query_engine import PandasQueryEngine from llama_index.core.tools import QueryEngineTool, ToolMetadata from llama_index.core.agent import ReActAgent from llama_index.llms.openai import OpenAI from prompts import ...
[ "llama_index.core.agent.ReActAgent.from_tools", "llama_index.core.query_engine.PandasQueryEngine", "llama_index.core.tools.ToolMetadata", "llama_index.llms.openai.OpenAI" ]
[((468, 481), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (479, 481), False, 'from dotenv import load_dotenv\n'), ((501, 539), 'os.path.join', 'os.path.join', (['"""data"""', '"""population.csv"""'], {}), "('data', 'population.csv')\n", (513, 539), False, 'import os\n'), ((556, 584), 'pandas.read_csv', 'pd.r...
# general imports from constants import * # streamlit imports import streamlit as st from utils import * from streamlit_lottie import st_lottie # llama index imports import openai from llama_index import ( VectorStoreIndex, download_loader, ServiceContext, set_global_service_context, ) from llama_inde...
[ "llama_index.VectorStoreIndex.from_documents", "llama_index.ServiceContext.from_defaults", "llama_index.llms.OpenAI", "llama_index.download_loader", "llama_index.set_global_service_context" ]
[((1017, 1080), 'llama_index.llms.OpenAI', 'OpenAI', ([], {'model': '"""gpt-4-1106-preview"""', 'system_prompt': 'system_prompt'}), "(model='gpt-4-1106-preview', system_prompt=system_prompt)\n", (1023, 1080), False, 'from llama_index.llms import OpenAI\n'), ((1187, 1248), 'llama_index.ServiceContext.from_defaults', 'Se...
import pathlib import tempfile from io import BytesIO import openai import streamlit as st from llama_index.core import SimpleDirectoryReader, VectorStoreIndex from llama_index.core.chat_engine import ContextChatEngine from llama_index.llms.openai import OpenAI from sidebar import sidebar_params st.set_page_config(p...
[ "llama_index.core.VectorStoreIndex.from_documents", "llama_index.core.SimpleDirectoryReader", "llama_index.llms.openai.OpenAI" ]
[((300, 386), 'streamlit.set_page_config', 'st.set_page_config', ([], {'page_title': '"""Chat with Documents"""', 'layout': '"""wide"""', 'page_icon': '"""🔥"""'}), "(page_title='Chat with Documents', layout='wide',\n page_icon='🔥')\n", (318, 386), True, 'import streamlit as st\n'), ((383, 414), 'streamlit.title', ...
import logging from llama_index import VectorStoreIndex, SimpleDirectoryReader, ServiceContext from llama_index.vector_stores import ChromaVectorStore from llama_index.storage.storage_context import StorageContext # from IPython.display import Markdown, display from llama_index.node_parser import SentenceSplitter from ...
[ "llama_index.node_parser.SentenceSplitter", "llama_index.SimpleDirectoryReader" ]
[((373, 412), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (392, 412), False, 'import logging\n'), ((422, 449), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (439, 449), False, 'import logging\n'), ((740, 790), 'llama_index.Simp...
from dotenv import load_dotenv import os from typing import List from llama_index.core.node_parser import SimpleNodeParser from llama_index.core.settings import Settings from llama_index.llms.openai import OpenAI from llama_index.core.embeddings import resolve_embed_model from llama_index.core import VectorStoreIndex ...
[ "llama_index.core.embeddings.resolve_embed_model", "llama_index.core.response.notebook_utils.display_source_node", "llama_index.llms.openai.OpenAI" ]
[((1816, 1829), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (1827, 1829), False, 'from dotenv import load_dotenv\n'), ((1862, 1889), 'llama_index.llms.openai.OpenAI', 'OpenAI', ([], {'model': 'open_ai_model'}), '(model=open_ai_model)\n', (1868, 1889), False, 'from llama_index.llms.openai import OpenAI\n'), (...
from fastapi import FastAPI, File, UploadFile, HTTPException import openai from dotenv import load_dotenv import os import json from llama_index.core import SimpleDirectoryReader from llama_index.core.node_parser import SimpleFileNodeParser from llama_index.vector_stores.weaviate import WeaviateVectorStore from llama_i...
[ "llama_index.core.StorageContext.from_defaults", "llama_index.core.VectorStoreIndex.from_vector_store", "llama_index.core.VectorStoreIndex.from_documents", "llama_index.core.SimpleDirectoryReader", "llama_index.vector_stores.weaviate.WeaviateVectorStore" ]
[((402, 415), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (413, 415), False, 'from dotenv import load_dotenv\n'), ((423, 432), 'fastapi.FastAPI', 'FastAPI', ([], {}), '()\n', (430, 432), False, 'from fastapi import FastAPI, File, UploadFile, HTTPException\n'), ((444, 476), 'os.environ.get', 'os.environ.get',...
from init import * from llama_index import SimpleDirectoryReader, LLMPredictor, ServiceContext from llama_index.node_parser import SimpleNodeParser from llama_index import VectorStoreIndex from llama_index.llms import OpenAI from llama_index import download_loader class Index: def __init__(self, dir="data"): ...
[ "llama_index.ServiceContext.from_defaults", "llama_index.VectorStoreIndex", "llama_index.llms.OpenAI", "llama_index.download_loader", "llama_index.node_parser.SimpleNodeParser.from_defaults" ]
[((653, 727), 'llama_index.ServiceContext.from_defaults', 'ServiceContext.from_defaults', ([], {'llm_predictor': 'llm_predictor', 'chunk_size': '(1000)'}), '(llm_predictor=llm_predictor, chunk_size=1000)\n', (681, 727), False, 'from llama_index import SimpleDirectoryReader, LLMPredictor, ServiceContext\n'), ((749, 810)...
def get_agent(list_filters,openai_key,pinecone_key): import logging import sys import os import pandas as pd import pinecone import openai from llama_index import VectorStoreIndex from llama_index.vector_stores import PineconeVectorStore from llama_index.query_engine import Retrieve...
[ "llama_index.tools.FunctionTool.from_defaults", "llama_index.vector_stores.PineconeVectorStore", "llama_index.tools.ToolMetadata", "llama_index.query_engine.RetrieverQueryEngine", "llama_index.VectorStoreIndex.from_vector_store", "llama_index.llms.OpenAI", "llama_index.llms.ChatMessage", "llama_index....
[((721, 779), 'logging.basicConfig', 'logging.basicConfig', ([], {'stream': 'sys.stdout', 'level': 'logging.INFO'}), '(stream=sys.stdout, level=logging.INFO)\n', (740, 779), False, 'import logging\n'), ((1006, 1063), 'pinecone.init', 'pinecone.init', ([], {'api_key': 'api_key', 'environment': '"""gcp-starter"""'}), "(a...
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' This script allows you to ask questions to the Alice in Wonderland book. It uses the GPT-3 model to create a vector index of the book, and then allows you to ask questions to the index. ''' import os import yaml import openai from llama_index import ( GPTVectorSto...
[ "llama_index.storage.docstore.SimpleDocumentStore.from_persist_dir", "llama_index.GPTVectorStoreIndex.from_documents", "llama_index.storage.index_store.SimpleIndexStore.from_persist_dir", "llama_index.download_loader", "llama_index.load_index_from_storage", "llama_index.vector_stores.SimpleVectorStore.fro...
[((862, 885), 'os.path.expanduser', 'os.path.expanduser', (['"""~"""'], {}), "('~')\n", (880, 885), False, 'import os\n'), ((1376, 1404), 'llama_index.download_loader', 'download_loader', (['"""PDFReader"""'], {}), "('PDFReader')\n", (1391, 1404), False, 'from llama_index import GPTVectorStoreIndex, StorageContext, Sim...
import os from dotenv import load_dotenv from IPython.display import Markdown, display from llama_index.legacy import VectorStoreIndex, ServiceContext from llama_index.legacy.vector_stores import ChromaVectorStore from llama_index.legacy.storage.storage_context import StorageContext from llama_index.legacy.embeddings ...
[ "llama_index.legacy.VectorStoreIndex.from_documents", "llama_index.legacy.readers.web.BeautifulSoupWebReader", "llama_index.legacy.embeddings.HuggingFaceEmbedding", "llama_index.legacy.node_parser.SimpleNodeParser", "llama_index.legacy.ServiceContext.from_defaults", "llama_index.legacy.storage.storage_con...
[((846, 905), 'logging.basicConfig', 'logging.basicConfig', ([], {'stream': 'sys.stdout', 'level': 'logging.DEBUG'}), '(stream=sys.stdout, level=logging.DEBUG)\n', (865, 905), False, 'import logging\n'), ((1029, 1042), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (1040, 1042), False, 'from dotenv import load_...
# Just runs .complete to make sure the LLM is listening from llama_index.llms import Ollama from pathlib import Path import qdrant_client from llama_index import ( VectorStoreIndex, ServiceContext, download_loader, ) from llama_index.llms import Ollama from llama_index.storage.storage_context import Storage...
[ "llama_index.VectorStoreIndex.from_documents", "llama_index.vector_stores.qdrant.QdrantVectorStore", "llama_index.ServiceContext.from_defaults", "llama_index.storage.storage_context.StorageContext.from_defaults", "llama_index.llms.Ollama", "llama_index.download_loader" ]
[((406, 435), 'llama_index.download_loader', 'download_loader', (['"""JSONReader"""'], {}), "('JSONReader')\n", (421, 435), False, 'from llama_index import VectorStoreIndex, ServiceContext, download_loader\n'), ((539, 558), 'llama_index.llms.Ollama', 'Ollama', ([], {'model': 'model'}), '(model=model)\n', (545, 558), Fa...
from pathlib import Path from llama_hub.file.unstructured import UnstructuredReader from pathlib import Path from llama_index import download_loader from llama_index import SimpleDirectoryReader, VectorStoreIndex from dotenv import load_dotenv import os from llama_index.node_parser import SimpleNodeParser import pineco...
[ "llama_index.GPTVectorStoreIndex.from_documents", "llama_index.vector_stores.PineconeVectorStore", "llama_index.ServiceContext.from_defaults", "llama_index.StorageContext.from_defaults", "llama_index.SimpleDirectoryReader", "llama_index.download_loader", "llama_index.embeddings.openai.OpenAIEmbedding" ]
[((796, 809), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (807, 809), False, 'from dotenv import load_dotenv\n'), ((827, 847), 'os.getenv', 'os.getenv', (['"""api_key"""'], {}), "('api_key')\n", (836, 847), False, 'import os\n'), ((926, 955), 'os.getenv', 'os.getenv', (['"""pinecone_api_key"""'], {}), "('pin...
"""Read PDF files.""" import shutil from pathlib import Path from typing import Any, List from llama_index.langchain_helpers.text_splitter import SentenceSplitter from llama_index.readers.base import BaseReader from llama_index.readers.schema.base import Document # https://github.com/emptycrown/llama-hub/blob/main/l...
[ "llama_index.langchain_helpers.text_splitter.SentenceSplitter", "llama_index.readers.schema.base.Document" ]
[((1102, 1122), 'pdfminer.pdfinterp.PDFResourceManager', 'PDFResourceManager', ([], {}), '()\n', (1120, 1122), False, 'from pdfminer.pdfinterp import PDFPageInterpreter, PDFResourceManager\n'), ((1185, 1195), 'io.StringIO', 'StringIO', ([], {}), '()\n', (1193, 1195), False, 'from io import StringIO\n'), ((1273, 1283), ...
import chromadb from llama_index.core import VectorStoreIndex, SimpleDirectoryReader from llama_index.vector_stores.chroma import ChromaVectorStore from llama_index.core import StorageContext from llama_index.embeddings.huggingface import HuggingFaceEmbedding from llama_index.core.indices.service_context import Service...
[ "llama_index.core.StorageContext.from_defaults", "llama_index.embeddings.huggingface.HuggingFaceEmbedding", "llama_index.core.VectorStoreIndex.from_documents", "llama_index.vector_stores.chroma.ChromaVectorStore", "llama_index.core.SimpleDirectoryReader", "llama_index.core.indices.service_context.ServiceC...
[((403, 420), 'chromadb.Client', 'chromadb.Client', ([], {}), '()\n', (418, 420), False, 'import chromadb\n'), ((555, 611), 'llama_index.embeddings.huggingface.HuggingFaceEmbedding', 'HuggingFaceEmbedding', ([], {'model_name': '"""BAAI/bge-base-en-v1.5"""'}), "(model_name='BAAI/bge-base-en-v1.5')\n", (575, 611), False,...
from llama_index.llms import OpenAI from llama_index.embeddings import HuggingFaceEmbedding from llama_index import VectorStoreIndex, SimpleDirectoryReader, ServiceContext import os documents = SimpleDirectoryReader("./competition").load_data() os.environ['OPENAI_API_KEY'] = 'sk-QnjWfyoAPGLysSCIfjozT3BlbkFJ4A0TyC0ZzaV...
[ "llama_index.VectorStoreIndex.from_documents", "llama_index.ServiceContext.from_defaults", "llama_index.SimpleDirectoryReader", "llama_index.llms.OpenAI", "llama_index.embeddings.HuggingFaceEmbedding" ]
[((346, 403), 'llama_index.embeddings.HuggingFaceEmbedding', 'HuggingFaceEmbedding', ([], {'model_name': '"""BAAI/bge-large-en-v1.5"""'}), "(model_name='BAAI/bge-large-en-v1.5')\n", (366, 403), False, 'from llama_index.embeddings import HuggingFaceEmbedding\n'), ((411, 457), 'llama_index.llms.OpenAI', 'OpenAI', ([], {'...
import os import openai import tiktoken import logging import sys from dotenv import load_dotenv from threading import Lock from llama_index import (SimpleDirectoryReader, VectorStoreIndex, ServiceContext, StorageContext, ...
[ "llama_index.VectorStoreIndex.from_documents", "llama_index.tools.query_engine.QueryEngineTool.from_defaults", "llama_index.ServiceContext.from_defaults", "llama_index.StorageContext.from_defaults", "llama_index.selectors.pydantic_selectors.PydanticSingleSelector.from_defaults", "llama_index.SimpleDirecto...
[((991, 1049), 'logging.basicConfig', 'logging.basicConfig', ([], {'stream': 'sys.stdout', 'level': 'logging.INFO'}), '(stream=sys.stdout, level=logging.INFO)\n', (1010, 1049), False, 'import logging\n'), ((1162, 1175), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (1173, 1175), False, 'from dotenv import load...
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader documents = SimpleDirectoryReader("./data").load_data() index = VectorStoreIndex.from_documents(documents) query_engine = index.as_query_engine() response = query_engine.query("What did the author do growing up?") print(response)
[ "llama_index.core.VectorStoreIndex.from_documents", "llama_index.core.SimpleDirectoryReader" ]
[((134, 176), 'llama_index.core.VectorStoreIndex.from_documents', 'VectorStoreIndex.from_documents', (['documents'], {}), '(documents)\n', (165, 176), False, 'from llama_index.core import VectorStoreIndex, SimpleDirectoryReader\n'), ((82, 113), 'llama_index.core.SimpleDirectoryReader', 'SimpleDirectoryReader', (['"""./...
from typing import List from llama_index import Document, TwitterTweetReader from social_gpt.ingestion.scraper.social_scraper import SocialScraper class TwitterScraper(SocialScraper): def scrape(self) -> List[Document]: TwitterTweetReader()
[ "llama_index.TwitterTweetReader" ]
[((237, 257), 'llama_index.TwitterTweetReader', 'TwitterTweetReader', ([], {}), '()\n', (255, 257), False, 'from llama_index import Document, TwitterTweetReader\n')]
import os from typing import List import googleapiclient from dotenv import load_dotenv from llama_index import Document from progress.bar import IncrementalBar from youtube_transcript_api import YouTubeTranscriptApi from social_gpt.ingestion.scraper.social_scraper import SocialScraper load_dotenv() YOUTUBE_API_SER...
[ "llama_index.Document" ]
[((290, 303), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (301, 303), False, 'from dotenv import load_dotenv\n'), ((644, 689), 'youtube_transcript_api.YouTubeTranscriptApi.get_transcript', 'YouTubeTranscriptApi.get_transcript', (['video_id'], {}), '(video_id)\n', (679, 689), False, 'from youtube_transcript_a...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import logging import sys from llama_index import SimpleDirectoryReader, GPTSimpleVectorIndex logging.basicConfig(stream=sys.stdout, level=logging.INFO) logging.getLogger().addHandler(logging.StreamHandler(stream=sys.stdout)) # read the document of data dir do...
[ "llama_index.GPTSimpleVectorIndex", "llama_index.SimpleDirectoryReader" ]
[((153, 211), 'logging.basicConfig', 'logging.basicConfig', ([], {'stream': 'sys.stdout', 'level': 'logging.INFO'}), '(stream=sys.stdout, level=logging.INFO)\n', (172, 211), False, 'import logging\n'), ((457, 488), 'llama_index.GPTSimpleVectorIndex', 'GPTSimpleVectorIndex', (['documents'], {}), '(documents)\n', (477, 4...
import dotenv import os from llama_index.readers.github import GithubRepositoryReader, GithubClient from llama_index.core import (VectorStoreIndex, StorageContext, PromptTemplate, load_index_from_storage, Settings) from llama_index.embeddings.huggingface import HuggingFaceEmbedding from llama_index.llms.ollama import ...
[ "llama_index.core.StorageContext.from_defaults", "llama_index.llms.ollama.Ollama", "llama_index.embeddings.huggingface.HuggingFaceEmbedding", "llama_index.readers.github.GithubClient", "llama_index.readers.github.GithubRepositoryReader", "llama_index.core.PromptTemplate", "llama_index.core.VectorStoreIn...
[((415, 435), 'dotenv.load_dotenv', 'dotenv.load_dotenv', ([], {}), '()\n', (433, 435), False, 'import dotenv\n'), ((886, 912), 'llama_index.readers.github.GithubClient', 'GithubClient', (['github_token'], {}), '(github_token)\n', (898, 912), False, 'from llama_index.readers.github import GithubRepositoryReader, Github...
import os from dotenv import load_dotenv load_dotenv() import s3fs from llama_index import ( SimpleDirectoryReader, VectorStoreIndex, StorageContext, load_index_from_storage ) # load documents documents = SimpleDirectoryReader('../../../examples/paul_graham_essay/data/').load_data() print(len(documents))...
[ "llama_index.VectorStoreIndex.from_documents", "llama_index.StorageContext.from_defaults", "llama_index.load_index_from_storage", "llama_index.SimpleDirectoryReader" ]
[((41, 54), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (52, 54), False, 'from dotenv import load_dotenv\n'), ((329, 371), 'llama_index.VectorStoreIndex.from_documents', 'VectorStoreIndex.from_documents', (['documents'], {}), '(documents)\n', (360, 371), False, 'from llama_index import SimpleDirectoryReader,...
import sys import logging import chromadb import streamlit as st from llama_index.llms import OpenAI from llama_index import SimpleDirectoryReader, VectorStoreIndex from llama_index.vector_stores import ChromaVectorStore from llama_index.storage.storage_context import StorageContext from llama_index import ServiceCon...
[ "llama_index.VectorStoreIndex.from_documents", "llama_index.ServiceContext.from_defaults", "llama_index.vector_stores.ChromaVectorStore", "llama_index.storage.storage_context.StorageContext.from_defaults", "llama_index.VectorStoreIndex.from_vector_store", "llama_index.node_parser.file.markdown.MarkdownNod...
[((553, 572), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (570, 572), False, 'import logging\n'), ((5510, 5544), 'llama_index.node_parser.file.markdown.MarkdownNodeParser.from_defaults', 'MarkdownNodeParser.from_defaults', ([], {}), '()\n', (5542, 5544), False, 'from llama_index.node_parser.file.markdow...
from flask_restx import Resource from flask import request, render_template, Response import openai import os import json from llama_index import GPTSimpleVectorIndex from llama_index import Document from furl import furl from PyPDF2 import PdfReader os.environ["OPENAI_API_KEY"] = "sk-MEVQvovmcLV7uodMC2aTT3BlbkFJRbhfQ...
[ "llama_index.GPTSimpleVectorIndex.from_documents", "llama_index.GPTSimpleVectorIndex.load_from_disk", "llama_index.Document" ]
[((407, 434), 'os.getenv', 'os.getenv', (['"""OPENAI_API_KEY"""'], {}), "('OPENAI_API_KEY')\n", (416, 434), False, 'import os\n'), ((491, 501), 'furl.furl', 'furl', (['link'], {}), '(link)\n', (495, 501), False, 'from furl import furl\n'), ((653, 664), 'furl.furl', 'furl', (['title'], {}), '(title)\n', (657, 664), Fals...
from __future__ import annotations import os import dataclasses from typing import TYPE_CHECKING, ClassVar import time import httpx from rich import print from xiaogpt.bot.base_bot import BaseBot, ChatHistoryMixin from xiaogpt.utils import split_sentences if TYPE_CHECKING: import openai from llama_index.embedd...
[ "llama_index.core.StorageContext.from_defaults", "llama_index.llms.azure_openai.AzureOpenAI", "llama_index.embeddings.azure_openai.AzureOpenAIEmbedding", "llama_index.core.PromptTemplate", "llama_index.core.VectorStoreIndex.from_documents", "llama_index.core.SimpleDirectoryReader", "llama_index.core.loa...
[((1030, 1081), 'dataclasses.field', 'dataclasses.field', ([], {'default_factory': 'list', 'init': '(False)'}), '(default_factory=list, init=False)\n', (1047, 1081), False, 'import dataclasses\n'), ((6247, 6286), 'dataclasses.field', 'dataclasses.field', ([], {'default_factory': 'dict'}), '(default_factory=dict)\n', (6...
import logging import sys import requests import os from llama_index import VectorStoreIndex, SimpleDirectoryReader, ServiceContext import torch from llama_index.llms import LlamaCPP from llama_index.llms.llama_utils import messages_to_prompt, completion_to_prompt from langchain.embeddings.huggingface import HuggingFac...
[ "llama_index.llms.LlamaCPP" ]
[((511, 570), 'logging.basicConfig', 'logging.basicConfig', ([], {'stream': 'sys.stdout', 'level': 'logging.DEBUG'}), '(stream=sys.stdout, level=logging.DEBUG)\n', (530, 570), False, 'import logging\n'), ((854, 886), 'os.path.join', 'os.path.join', (['"""Data"""', '"""test.pdf"""'], {}), "('Data', 'test.pdf')\n", (866,...
from llama_index import SimpleDirectoryReader, VectorStoreIndex, LLMPredictor, PromptHelper from langchain.chat_models import ChatOpenAI import gradio as gr from pprint import pprint; import IPython import sys import os from pathlib import Path # Check if the environment variable exists if "OPENAIKEY" in os.environ: ...
[ "llama_index.GPTVectorStoreIndex.from_documents", "llama_index.SimpleDirectoryReader" ]
[((745, 790), 'llama_index.GPTVectorStoreIndex.from_documents', 'GPTVectorStoreIndex.from_documents', (['documents'], {}), '(documents)\n', (779, 790), False, 'from llama_index import GPTVectorStoreIndex, SimpleDirectoryReader\n'), ((1396, 1411), 'IPython.embed', 'IPython.embed', ([], {}), '()\n', (1409, 1411), False, ...
import argparse import copy import logging import os import sys import warnings from typing import Optional, List, Callable from langchain.llms import OpenAI import faiss import gradio as gr import torch import torch.distributed as dist import transformers from accelerate import dispatch_model, infer_auto_device_map fr...
[ "llama_index.GPTFaissIndex.load_from_disk", "llama_index.SimpleDirectoryReader", "llama_index.LLMPredictor", "llama_index.PromptHelper" ]
[((13996, 14021), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (14019, 14021), False, 'import argparse\n'), ((14291, 14338), 'transformers.LlamaTokenizer.from_pretrained', 'LlamaTokenizer.from_pretrained', (['args.model_path'], {}), '(args.model_path)\n', (14321, 14338), False, 'from transfor...
from typing import List, Set from llama_index.core import Document, KnowledgeGraphIndex, StorageContext from llama_index.core.query_engine import BaseQueryEngine from llama_index.core import load_index_from_storage import os def load_kg_graph_index_storage_context(kg_graph_storage_dir: str) -> StorageContext: retu...
[ "llama_index.core.StorageContext.from_defaults", "llama_index.core.KnowledgeGraphIndex.from_documents" ]
[((323, 385), 'llama_index.core.StorageContext.from_defaults', 'StorageContext.from_defaults', ([], {'persist_dir': 'kg_graph_storage_dir'}), '(persist_dir=kg_graph_storage_dir)\n', (351, 385), False, 'from llama_index.core import Document, KnowledgeGraphIndex, StorageContext\n'), ((782, 818), 'os.path.exists', 'os.pat...
from llama_index import SimpleDirectoryReader, GPTSimpleVectorIndex, LLMPredictor, PromptHelper from langchain import OpenAI import sys import os def construct_index(src_path, out_path): # set maximum input size max_input_size = 4096 # set number of output tokens num_outputs = 512 # set maximum chu...
[ "llama_index.PromptHelper", "llama_index.GPTSimpleVectorIndex", "llama_index.SimpleDirectoryReader" ]
[((565, 664), 'llama_index.PromptHelper', 'PromptHelper', (['max_input_size', 'num_outputs', 'max_chunk_overlap'], {'chunk_size_limit': 'chunk_size_limit'}), '(max_input_size, num_outputs, max_chunk_overlap,\n chunk_size_limit=chunk_size_limit)\n', (577, 664), False, 'from llama_index import SimpleDirectoryReader, G...
import streamlit as st from llama_index import VectorStoreIndex, ServiceContext, Document from llama_index.llms import OpenAI import openai from llama_index import SimpleDirectoryReader st.set_page_config(page_title="Chat with the docs, powered by LlamaIndex") openai.api_key = st.secrets.openai_key st.title("C...
[ "llama_index.VectorStoreIndex.from_documents", "llama_index.llms.OpenAI", "llama_index.SimpleDirectoryReader" ]
[((193, 267), 'streamlit.set_page_config', 'st.set_page_config', ([], {'page_title': '"""Chat with the docs, powered by LlamaIndex"""'}), "(page_title='Chat with the docs, powered by LlamaIndex')\n", (211, 267), True, 'import streamlit as st\n'), ((309, 365), 'streamlit.title', 'st.title', (['"""Chat with the custom do...
from llama_index import StorageContext, load_index_from_storage, ServiceContext import gradio as gr import sys import os import logging from utils import get_automerging_query_engine from utils import get_sentence_window_query_engine import configparser from TTS.api import TTS from gtts import gTTS import simpleaudio a...
[ "llama_index.prompts.base.PromptTemplate", "llama_index.ServiceContext.from_defaults", "llama_index.StorageContext.from_defaults", "llama_index.load_index_from_storage" ]
[((1610, 1637), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (1635, 1637), False, 'import configparser\n'), ((4094, 4149), 'logging.basicConfig', 'logging.basicConfig', ([], {'stream': 'sys.stdout', 'level': 'log_level'}), '(stream=sys.stdout, level=log_level)\n', (4113, 4149), False, 'im...
from llama_index import SimpleDirectoryReader, GPTListIndex, readers, GPTSimpleVectorIndex, LLMPredictor, PromptHelper from langchain import OpenAI import os def construct_index(directory_path): # set maximum input size max_input_size = 4096 # set number of output tokens num_outputs = 2000 # set ma...
[ "llama_index.PromptHelper", "llama_index.GPTSimpleVectorIndex", "llama_index.GPTSimpleVectorIndex.load_from_disk", "llama_index.SimpleDirectoryReader" ]
[((577, 676), 'llama_index.PromptHelper', 'PromptHelper', (['max_input_size', 'num_outputs', 'max_chunk_overlap'], {'chunk_size_limit': 'chunk_size_limit'}), '(max_input_size, num_outputs, max_chunk_overlap,\n chunk_size_limit=chunk_size_limit)\n', (589, 676), False, 'from llama_index import SimpleDirectoryReader, G...
import os import streamlit as st from dotenv import load_dotenv from llama_index import GPTVectorStoreIndex, LLMPredictor, PromptHelper, ServiceContext from langchain.llms.openai import OpenAI from biorxiv_manager import BioRxivManager load_dotenv() openai_api_key = os.getenv("OPENAI_API_KEY") st.title("Ask BioRxiv"...
[ "llama_index.PromptHelper", "llama_index.GPTVectorStoreIndex.from_documents", "llama_index.ServiceContext.from_defaults" ]
[((238, 251), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (249, 251), False, 'from dotenv import load_dotenv\n'), ((269, 296), 'os.getenv', 'os.getenv', (['"""OPENAI_API_KEY"""'], {}), "('OPENAI_API_KEY')\n", (278, 296), False, 'import os\n'), ((298, 321), 'streamlit.title', 'st.title', (['"""Ask BioRxiv"""'...
import logging from llama_index.langchain_helpers.agents.tools import LlamaIndexTool from llama_index.vector_stores.types import ExactMatchFilter, MetadataFilters from app.llama_index.index import setup_index from app.llama_index.query_engine import setup_query_engine from app.database.crud import get_vectorized_elect...
[ "llama_index.langchain_helpers.agents.tools.LlamaIndexTool", "llama_index.vector_stores.types.ExactMatchFilter" ]
[((424, 433), 'app.database.database.Session', 'Session', ([], {}), '()\n', (431, 433), False, 'from app.database.database import Session\n'), ((469, 518), 'app.database.crud.get_vectorized_election_programs_from_db', 'get_vectorized_election_programs_from_db', (['session'], {}), '(session)\n', (509, 518), False, 'from...
import os from configparser import ConfigParser, SectionProxy from typing import Any, Type from llama_index import ( LLMPredictor, ServiceContext, VectorStoreIndex, ) from llama_index.embeddings.base import BaseEmbedding from llama_index.embeddings.openai import OpenAIEmbedding from llama_index.indices imp...
[ "llama_index.LLMPredictor", "llama_index.ServiceContext.from_defaults", "llama_index.storage.storage_context.StorageContext.from_defaults", "llama_index.llm_predictor.StructuredLLMPredictor", "llama_index.indices.loading.load_index_from_storage", "llama_index.llms.openai.OpenAI", "llama_index.embeddings...
[((1023, 1037), 'configparser.ConfigParser', 'ConfigParser', ([], {}), '()\n', (1035, 1037), False, 'from configparser import ConfigParser, SectionProxy\n'), ((2725, 2812), 'llama_index.ServiceContext.from_defaults', 'ServiceContext.from_defaults', ([], {'llm_predictor': 'llm_predictor', 'embed_model': 'embed_model'}),...
from components.store import get_storage_context from llama_index import VectorStoreIndex from llama_index.retrievers import ( VectorIndexRetriever, ) from models.gpts import get_gpts_by_uuids def search_gpts(question): storage_context = get_storage_context() index = VectorStoreIndex.from_documents([], st...
[ "llama_index.VectorStoreIndex.from_documents", "llama_index.retrievers.VectorIndexRetriever" ]
[((248, 269), 'components.store.get_storage_context', 'get_storage_context', ([], {}), '()\n', (267, 269), False, 'from components.store import get_storage_context\n'), ((282, 350), 'llama_index.VectorStoreIndex.from_documents', 'VectorStoreIndex.from_documents', (['[]'], {'storage_context': 'storage_context'}), '([], ...
"""LanceDB vector store with cloud storage support.""" import os from typing import Any, Optional from dotenv import load_dotenv from llama_index.schema import NodeRelationship, RelatedNodeInfo, TextNode from llama_index.vector_stores import LanceDBVectorStore as LanceDBVectorStoreBase from llama_index.vector_stores.l...
[ "llama_index.schema.RelatedNodeInfo", "llama_index.vector_stores.lancedb._to_lance_filter", "llama_index.vector_stores.lancedb._to_llama_similarities" ]
[((490, 503), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (501, 503), False, 'from dotenv import load_dotenv\n'), ((1464, 1492), 'os.getenv', 'os.getenv', (['"""LANCEDB_API_KEY"""'], {}), "('LANCEDB_API_KEY')\n", (1473, 1492), False, 'import os\n'), ((1520, 1547), 'os.getenv', 'os.getenv', (['"""LANCEDB_REGI...
from typing import List from fastapi.responses import StreamingResponse from llama_index.chat_engine.types import BaseChatEngine from app.engine.index import get_chat_engine from fastapi import APIRouter, Depends, HTTPException, Request, status from llama_index.llms.base import ChatMessage from llama_index.llms.types...
[ "llama_index.llms.base.ChatMessage" ]
[((390, 401), 'fastapi.APIRouter', 'APIRouter', ([], {}), '()\n', (399, 401), False, 'from fastapi import APIRouter, Depends, HTTPException, Request, status\n'), ((636, 660), 'fastapi.Depends', 'Depends', (['get_chat_engine'], {}), '(get_chat_engine)\n', (643, 660), False, 'from fastapi import APIRouter, Depends, HTTPE...
from typing import List from fastapi.responses import StreamingResponse from llama_index.chat_engine.types import BaseChatEngine from app.engine.index import get_chat_engine from fastapi import APIRouter, Depends, HTTPException, Request, status from llama_index.llms.base import ChatMessage from llama_index.llms.types...
[ "llama_index.llms.base.ChatMessage" ]
[((390, 401), 'fastapi.APIRouter', 'APIRouter', ([], {}), '()\n', (399, 401), False, 'from fastapi import APIRouter, Depends, HTTPException, Request, status\n'), ((636, 660), 'fastapi.Depends', 'Depends', (['get_chat_engine'], {}), '(get_chat_engine)\n', (643, 660), False, 'from fastapi import APIRouter, Depends, HTTPE...
from typing import List from fastapi.responses import StreamingResponse from llama_index.chat_engine.types import BaseChatEngine from app.engine.index import get_chat_engine from fastapi import APIRouter, Depends, HTTPException, Request, status from llama_index.llms.base import ChatMessage from llama_index.llms.types...
[ "llama_index.llms.base.ChatMessage" ]
[((390, 401), 'fastapi.APIRouter', 'APIRouter', ([], {}), '()\n', (399, 401), False, 'from fastapi import APIRouter, Depends, HTTPException, Request, status\n'), ((636, 660), 'fastapi.Depends', 'Depends', (['get_chat_engine'], {}), '(get_chat_engine)\n', (643, 660), False, 'from fastapi import APIRouter, Depends, HTTPE...
# Copyright (c) Timescale, Inc. (2023) # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in...
[ "llama_index.tools.query_engine.QueryEngineTool.from_defaults", "llama_index.indices.vector_store.VectorStoreIndex.from_vector_store", "llama_index.indices.vector_store.retrievers.VectorIndexAutoRetriever", "llama_index.llms.OpenAI", "llama_index.vector_stores.types.MetadataInfo", "llama_index.agent.OpenA...
[((7098, 7170), 'streamlit.set_page_config', 'st.set_page_config', ([], {'page_title': '"""Time machine demo"""', 'page_icon': '"""🧑\u200d💼"""'}), "(page_title='Time machine demo', page_icon='🧑\\u200d💼')\n", (7116, 7170), True, 'import streamlit as st\n'), ((7166, 7195), 'streamlit.markdown', 'st.markdown', (['"""#...
# Copyright (c) Timescale, Inc. (2023) # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in...
[ "llama_index.tools.query_engine.QueryEngineTool.from_defaults", "llama_index.indices.vector_store.VectorStoreIndex.from_vector_store", "llama_index.indices.vector_store.retrievers.VectorIndexAutoRetriever", "llama_index.llms.OpenAI", "llama_index.vector_stores.types.MetadataInfo", "llama_index.agent.OpenA...
[((7098, 7170), 'streamlit.set_page_config', 'st.set_page_config', ([], {'page_title': '"""Time machine demo"""', 'page_icon': '"""🧑\u200d💼"""'}), "(page_title='Time machine demo', page_icon='🧑\\u200d💼')\n", (7116, 7170), True, 'import streamlit as st\n'), ((7166, 7195), 'streamlit.markdown', 'st.markdown', (['"""#...
import logging from threading import Thread from typing import Any, List, Optional, Type from llama_index.core.base.base_query_engine import BaseQueryEngine from llama_index.core.base.llms.types import ChatMessage, MessageRole from llama_index.core.base.response.schema import RESPONSE_TYPE, StreamingResponse from llam...
[ "llama_index.core.callbacks.CallbackManager", "llama_index.core.base.llms.generic_utils.messages_to_history_str", "llama_index.core.settings.callback_manager_from_settings_or_context", "llama_index.core.base.llms.types.ChatMessage", "llama_index.core.prompts.base.PromptTemplate", "llama_index.core.embeddi...
[((1220, 1247), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1237, 1247), False, 'import logging\n'), ((1579, 1611), 'llama_index.core.prompts.base.PromptTemplate', 'PromptTemplate', (['DEFAULT_TEMPLATE'], {}), '(DEFAULT_TEMPLATE)\n', (1593, 1611), False, 'from llama_index.core.prompts...
from typing import List from llama_index.readers.base import BaseReader from llama_index.readers.youtube_transcript import YoutubeTranscriptReader from llama_index.schema import Document class LyzrYoutubeReader(BaseReader): def __init__(self) -> None: try: from youtube_transcript_api import Y...
[ "llama_index.readers.youtube_transcript.YoutubeTranscriptReader" ]
[((623, 648), 'llama_index.readers.youtube_transcript.YoutubeTranscriptReader', 'YoutubeTranscriptReader', ([], {}), '()\n', (646, 648), False, 'from llama_index.readers.youtube_transcript import YoutubeTranscriptReader\n')]
from typing import List from llama_index.readers.base import BaseReader from llama_index.readers.youtube_transcript import YoutubeTranscriptReader from llama_index.schema import Document class LyzrYoutubeReader(BaseReader): def __init__(self) -> None: try: from youtube_transcript_api import Y...
[ "llama_index.readers.youtube_transcript.YoutubeTranscriptReader" ]
[((623, 648), 'llama_index.readers.youtube_transcript.YoutubeTranscriptReader', 'YoutubeTranscriptReader', ([], {}), '()\n', (646, 648), False, 'from llama_index.readers.youtube_transcript import YoutubeTranscriptReader\n')]
from typing import List from llama_index.readers.base import BaseReader from llama_index.readers.youtube_transcript import YoutubeTranscriptReader from llama_index.schema import Document class LyzrYoutubeReader(BaseReader): def __init__(self) -> None: try: from youtube_transcript_api import Y...
[ "llama_index.readers.youtube_transcript.YoutubeTranscriptReader" ]
[((623, 648), 'llama_index.readers.youtube_transcript.YoutubeTranscriptReader', 'YoutubeTranscriptReader', ([], {}), '()\n', (646, 648), False, 'from llama_index.readers.youtube_transcript import YoutubeTranscriptReader\n')]
import sys import asyncio import logging import warnings import nest_asyncio from typing import List, Set from bs4 import BeautifulSoup, Tag from typing import List from llama_index.schema import Document IS_IPYKERNEL = "ipykernel_launcher" in sys.argv[0] if IS_IPYKERNEL: nest_asyncio.apply() logger = logging....
[ "llama_index.schema.Document" ]
[((312, 339), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (329, 339), False, 'import logging\n'), ((281, 301), 'nest_asyncio.apply', 'nest_asyncio.apply', ([], {}), '()\n', (299, 301), False, 'import nest_asyncio\n'), ((676, 710), 'bs4.BeautifulSoup', 'BeautifulSoup', (['html', '"""htm...
import sys import asyncio import logging import warnings import nest_asyncio from typing import List, Set from bs4 import BeautifulSoup, Tag from typing import List from llama_index.schema import Document IS_IPYKERNEL = "ipykernel_launcher" in sys.argv[0] if IS_IPYKERNEL: nest_asyncio.apply() logger = logging....
[ "llama_index.schema.Document" ]
[((312, 339), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (329, 339), False, 'import logging\n'), ((281, 301), 'nest_asyncio.apply', 'nest_asyncio.apply', ([], {}), '()\n', (299, 301), False, 'import nest_asyncio\n'), ((676, 710), 'bs4.BeautifulSoup', 'BeautifulSoup', (['html', '"""htm...
import sys import asyncio import logging import warnings import nest_asyncio from typing import List, Set from bs4 import BeautifulSoup, Tag from typing import List from llama_index.schema import Document IS_IPYKERNEL = "ipykernel_launcher" in sys.argv[0] if IS_IPYKERNEL: nest_asyncio.apply() logger = logging....
[ "llama_index.schema.Document" ]
[((312, 339), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (329, 339), False, 'import logging\n'), ((281, 301), 'nest_asyncio.apply', 'nest_asyncio.apply', ([], {}), '()\n', (299, 301), False, 'import nest_asyncio\n'), ((676, 710), 'bs4.BeautifulSoup', 'BeautifulSoup', (['html', '"""htm...
import logging 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.llms.utils import LLMType from llama_index.prompts import PromptTemplate from llama_index.prompts.base import Ba...
[ "llama_index.ServiceContext.from_defaults", "llama_index.prompts.PromptTemplate", "llama_index.callbacks.CallbackManager", "llama_index.node_parser.SimpleNodeParser.from_defaults" ]
[((409, 436), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (426, 436), False, 'import logging\n'), ((1016, 1120), 'llama_index.node_parser.SimpleNodeParser.from_defaults', 'SimpleNodeParser.from_defaults', ([], {'chunk_size': '(750)', 'chunk_overlap': '(100)', 'callback_manager': 'callb...
from llama_index import SimpleDirectoryReader, LLMPredictor, ServiceContext, GPTVectorStoreIndex from llama_index.response.pprint_utils import pprint_response from langchain.chat_models import ChatOpenAI from llama_index.tools import QueryEngineTool, ToolMetadata from llama_index.query_engine import SubQuestionQueryEng...
[ "llama_index.GPTVectorStoreIndex.from_documents", "llama_index.tools.ToolMetadata", "llama_index.query_engine.SubQuestionQueryEngine.from_defaults", "llama_index.ServiceContext.from_defaults", "llama_index.SimpleDirectoryReader", "llama_index.set_global_service_context" ]
[((460, 473), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (471, 473), False, 'from dotenv import load_dotenv\n'), ((503, 561), 'logging.basicConfig', 'logging.basicConfig', ([], {'stream': 'sys.stdout', 'level': 'logging.INFO'}), '(stream=sys.stdout, level=logging.INFO)\n', (522, 561), False, 'import logging...
import tiktoken from llama_index.core import MockEmbedding, VectorStoreIndex, SimpleDirectoryReader, Settings from llama_index.core.callbacks import CallbackManager, TokenCountingHandler from llama_index.core.llms.mock import MockLLM embed_model = MockEmbedding(embed_dim=1536) llm = MockLLM(max_tokens=256) token_count...
[ "llama_index.core.callbacks.CallbackManager", "llama_index.core.MockEmbedding", "llama_index.core.llms.mock.MockLLM", "llama_index.core.VectorStoreIndex.from_documents", "llama_index.core.SimpleDirectoryReader" ]
[((249, 278), 'llama_index.core.MockEmbedding', 'MockEmbedding', ([], {'embed_dim': '(1536)'}), '(embed_dim=1536)\n', (262, 278), False, 'from llama_index.core import MockEmbedding, VectorStoreIndex, SimpleDirectoryReader, Settings\n'), ((285, 308), 'llama_index.core.llms.mock.MockLLM', 'MockLLM', ([], {'max_tokens': '...
from llama_index.core import SimpleDirectoryReader from llama_index.core.node_parser import SentenceSplitter from llama_index.core.extractors import SummaryExtractor reader = SimpleDirectoryReader('files') documents = reader.load_data() parser = SentenceSplitter(include_prev_next_rel=True) nodes = parser.get_nodes_fro...
[ "llama_index.core.node_parser.SentenceSplitter", "llama_index.core.extractors.SummaryExtractor", "llama_index.core.SimpleDirectoryReader" ]
[((176, 206), 'llama_index.core.SimpleDirectoryReader', 'SimpleDirectoryReader', (['"""files"""'], {}), "('files')\n", (197, 206), False, 'from llama_index.core import SimpleDirectoryReader\n'), ((247, 291), 'llama_index.core.node_parser.SentenceSplitter', 'SentenceSplitter', ([], {'include_prev_next_rel': '(True)'}), ...
from llama_index.readers.file import FlatReader from pathlib import Path reader = FlatReader() document = reader.load_data(Path("files/sample_document1.txt")) print(f"Metadata: {document[0].metadata}") print(f"Text: {document[0].text}")
[ "llama_index.readers.file.FlatReader" ]
[((83, 95), 'llama_index.readers.file.FlatReader', 'FlatReader', ([], {}), '()\n', (93, 95), False, 'from llama_index.readers.file import FlatReader\n'), ((124, 158), 'pathlib.Path', 'Path', (['"""files/sample_document1.txt"""'], {}), "('files/sample_document1.txt')\n", (128, 158), False, 'from pathlib import Path\n')]
"""Read PDF files.""" import shutil from pathlib import Path from typing import Any, List from llama_index.langchain_helpers.text_splitter import SentenceSplitter from llama_index.readers.base import BaseReader from llama_index.readers.schema.base import Document # https://github.com/emptycrown/llama-hub/blob/main/l...
[ "llama_index.langchain_helpers.text_splitter.SentenceSplitter", "llama_index.readers.schema.base.Document" ]
[((1102, 1122), 'pdfminer.pdfinterp.PDFResourceManager', 'PDFResourceManager', ([], {}), '()\n', (1120, 1122), False, 'from pdfminer.pdfinterp import PDFPageInterpreter, PDFResourceManager\n'), ((1185, 1195), 'io.StringIO', 'StringIO', ([], {}), '()\n', (1193, 1195), False, 'from io import StringIO\n'), ((1273, 1283), ...
"""Read PDF files.""" import shutil from pathlib import Path from typing import Any, List from llama_index.langchain_helpers.text_splitter import SentenceSplitter from llama_index.readers.base import BaseReader from llama_index.readers.schema.base import Document # https://github.com/emptycrown/llama-hub/blob/main/l...
[ "llama_index.langchain_helpers.text_splitter.SentenceSplitter", "llama_index.readers.schema.base.Document" ]
[((1102, 1122), 'pdfminer.pdfinterp.PDFResourceManager', 'PDFResourceManager', ([], {}), '()\n', (1120, 1122), False, 'from pdfminer.pdfinterp import PDFPageInterpreter, PDFResourceManager\n'), ((1185, 1195), 'io.StringIO', 'StringIO', ([], {}), '()\n', (1193, 1195), False, 'from io import StringIO\n'), ((1273, 1283), ...
"""Read PDF files.""" import shutil from pathlib import Path from typing import Any, List from llama_index.langchain_helpers.text_splitter import SentenceSplitter from llama_index.readers.base import BaseReader from llama_index.readers.schema.base import Document # https://github.com/emptycrown/llama-hub/blob/main/l...
[ "llama_index.langchain_helpers.text_splitter.SentenceSplitter", "llama_index.readers.schema.base.Document" ]
[((1102, 1122), 'pdfminer.pdfinterp.PDFResourceManager', 'PDFResourceManager', ([], {}), '()\n', (1120, 1122), False, 'from pdfminer.pdfinterp import PDFPageInterpreter, PDFResourceManager\n'), ((1185, 1195), 'io.StringIO', 'StringIO', ([], {}), '()\n', (1193, 1195), False, 'from io import StringIO\n'), ((1273, 1283), ...
from typing import Any, List import tiktoken from bs4 import BeautifulSoup from llama_index.readers.base import BaseReader from llama_index.readers.schema.base import Document staticPath = "static" def encode_string(string: str, encoding_name: str = "p50k_base"): encoding = tiktoken.get_encoding(encoding_name) ...
[ "llama_index.readers.schema.base.Document" ]
[((283, 319), 'tiktoken.get_encoding', 'tiktoken.get_encoding', (['encoding_name'], {}), '(encoding_name)\n', (304, 319), False, 'import tiktoken\n'), ((437, 473), 'tiktoken.get_encoding', 'tiktoken.get_encoding', (['encoding_name'], {}), '(encoding_name)\n', (458, 473), False, 'import tiktoken\n'), ((664, 700), 'tikto...
from typing import Any, List import tiktoken from bs4 import BeautifulSoup from llama_index.readers.base import BaseReader from llama_index.readers.schema.base import Document staticPath = "static" def encode_string(string: str, encoding_name: str = "p50k_base"): encoding = tiktoken.get_encoding(encoding_name) ...
[ "llama_index.readers.schema.base.Document" ]
[((283, 319), 'tiktoken.get_encoding', 'tiktoken.get_encoding', (['encoding_name'], {}), '(encoding_name)\n', (304, 319), False, 'import tiktoken\n'), ((437, 473), 'tiktoken.get_encoding', 'tiktoken.get_encoding', (['encoding_name'], {}), '(encoding_name)\n', (458, 473), False, 'import tiktoken\n'), ((664, 700), 'tikto...
from typing import Any, List import tiktoken from bs4 import BeautifulSoup from llama_index.readers.base import BaseReader from llama_index.readers.schema.base import Document staticPath = "static" def encode_string(string: str, encoding_name: str = "p50k_base"): encoding = tiktoken.get_encoding(encoding_name) ...
[ "llama_index.readers.schema.base.Document" ]
[((283, 319), 'tiktoken.get_encoding', 'tiktoken.get_encoding', (['encoding_name'], {}), '(encoding_name)\n', (304, 319), False, 'import tiktoken\n'), ((437, 473), 'tiktoken.get_encoding', 'tiktoken.get_encoding', (['encoding_name'], {}), '(encoding_name)\n', (458, 473), False, 'import tiktoken\n'), ((664, 700), 'tikto...
from typing import Any, List import tiktoken from bs4 import BeautifulSoup from llama_index.readers.base import BaseReader from llama_index.readers.schema.base import Document staticPath = "static" def encode_string(string: str, encoding_name: str = "p50k_base"): encoding = tiktoken.get_encoding(encoding_name) ...
[ "llama_index.readers.schema.base.Document" ]
[((283, 319), 'tiktoken.get_encoding', 'tiktoken.get_encoding', (['encoding_name'], {}), '(encoding_name)\n', (304, 319), False, 'import tiktoken\n'), ((437, 473), 'tiktoken.get_encoding', 'tiktoken.get_encoding', (['encoding_name'], {}), '(encoding_name)\n', (458, 473), False, 'import tiktoken\n'), ((664, 700), 'tikto...
import os # Uncomment to specify your OpenAI API key here (local testing only, not in production!), or add corresponding environment variable (recommended) # os.environ['OPENAI_API_KEY']= "" from llama_index import LLMPredictor, PromptHelper, ServiceContext from langchain.llms.openai import OpenAI from llama_index ...
[ "llama_index.PromptHelper", "llama_index.ServiceContext.from_defaults", "llama_index.StorageContext.from_defaults", "llama_index.load_index_from_storage" ]
[((380, 441), 'os.environ.get', 'os.environ.get', (['"""OPENAI_API_BASE"""', '"""http://localhost:8080/v1"""'], {}), "('OPENAI_API_BASE', 'http://localhost:8080/v1')\n", (394, 441), False, 'import os\n'), ((766, 825), 'llama_index.PromptHelper', 'PromptHelper', (['max_input_size', 'num_output', 'max_chunk_overlap'], {}...
from llama_index.embeddings.huggingface import HuggingFaceEmbedding from llama_index.llms.huggingface import HuggingFaceLLM from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig from llama_index.llms.huggingface import HuggingFaceInferenceAPI from llama_index.llms.azure_openai import AzureOpe...
[ "llama_index.core.base.llms.types.CompletionResponse" ]
[((443, 456), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (454, 456), False, 'from dotenv import load_dotenv\n'), ((662, 687), 'os.getenv', 'os.getenv', (['"""HF_TOKEN"""', '""""""'], {}), "('HF_TOKEN', '')\n", (671, 687), False, 'import os\n'), ((698, 733), 'os.getenv', 'os.getenv', (['"""AZURE_OPENAI_TOKEN...
from dotenv import load_dotenv load_dotenv() from llama_index import GPTVectorStoreIndex, SimpleDirectoryReader, load_index_from_storage, StorageContext from llama_index.storage.docstore import SimpleDocumentStore from llama_index.vector_stores import SimpleVectorStore from llama_index.storage.index_store import Simpl...
[ "llama_index.storage.docstore.SimpleDocumentStore.from_persist_dir", "llama_index.GPTVectorStoreIndex.from_documents", "llama_index.graph_stores.SimpleGraphStore.from_persist_dir", "llama_index.SimpleDirectoryReader", "llama_index.storage.index_store.SimpleIndexStore.from_persist_dir", "llama_index.load_i...
[((31, 44), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (42, 44), False, 'from dotenv import load_dotenv\n'), ((450, 495), 'llama_index.GPTVectorStoreIndex.from_documents', 'GPTVectorStoreIndex.from_documents', (['documents'], {}), '(documents)\n', (484, 495), False, 'from llama_index import GPTVectorStoreIn...
from rag.agents.interface import Pipeline from rich.progress import Progress, SpinnerColumn, TextColumn from typing import Any from pydantic import create_model from typing import List import warnings import box import yaml import timeit from rich import print from llama_index.core import SimpleDirectoryReader from lla...
[ "llama_index.multi_modal_llms.ollama.OllamaMultiModal", "llama_index.core.output_parsers.PydanticOutputParser", "llama_index.core.SimpleDirectoryReader" ]
[((512, 574), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'DeprecationWarning'}), "('ignore', category=DeprecationWarning)\n", (535, 574), False, 'import warnings\n'), ((575, 630), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'UserWarnin...
import functools import os import random import tempfile import traceback import asyncio from collections import defaultdict import aiohttp import discord import aiofiles import httpx import openai import tiktoken from functools import partial from typing import List, Optional, cast from pathlib import Path from datet...
[ "llama_index.GPTVectorStoreIndex.from_documents", "llama_index.langchain_helpers.agents.IndexToolConfig", "llama_index.GithubRepositoryReader", "llama_index.OpenAIEmbedding", "llama_index.query_engine.RetrieverQueryEngine", "llama_index.SimpleDirectoryReader", "llama_index.download_loader", "llama_ind...
[((2731, 2770), 'services.environment_service.EnvService.get_max_deep_compose_price', 'EnvService.get_max_deep_compose_price', ([], {}), '()\n', (2768, 2770), False, 'from services.environment_service import EnvService\n'), ((2784, 2813), 'llama_index.download_loader', 'download_loader', (['"""EpubReader"""'], {}), "('...
import os from langchain import OpenAI from llama_index import GPTSimpleVectorIndex, SimpleDirectoryReader, LLMPredictor, download_loader, SQLDatabase, GPTSQLStructStoreIndex import sqlalchemy import time DatabaseReader = download_loader('DatabaseReader') databasePath = f'sqlite:///{os.path.dirname(__file__)}/vulns.db...
[ "llama_index.GPTSQLStructStoreIndex", "llama_index.download_loader", "llama_index.SQLDatabase" ]
[((223, 256), 'llama_index.download_loader', 'download_loader', (['"""DatabaseReader"""'], {}), "('DatabaseReader')\n", (238, 256), False, 'from llama_index import GPTSimpleVectorIndex, SimpleDirectoryReader, LLMPredictor, download_loader, SQLDatabase, GPTSQLStructStoreIndex\n'), ((372, 410), 'sqlalchemy.create_engine'...
# https://blog.streamlit.io/build-a-chatbot-with-custom-data-sources-powered-by-llamaindex/ import os import streamlit as st from llama_index.core import ServiceContext, Document, SimpleDirectoryReader, VectorStoreIndex, Settings from llama_index.llms.ollama import Ollama from llama_index.embeddings.huggingface import...
[ "llama_index.embeddings.huggingface.HuggingFaceEmbedding", "llama_index.core.VectorStoreIndex.from_documents", "llama_index.llms.ollama.Ollama", "llama_index.core.SimpleDirectoryReader" ]
[((357, 394), 'os.getenv', 'os.getenv', (['"""OLLAMA_HOST"""', '"""localhost"""'], {}), "('OLLAMA_HOST', 'localhost')\n", (366, 394), False, 'import os\n'), ((506, 573), 'llama_index.llms.ollama.Ollama', 'Ollama', ([], {'model': '"""zephyr"""', 'base_url': "('http://' + OLLAMA_HOST + ':11434')"}), "(model='zephyr', bas...
import argparse import logging import sys import re import os import argparse import requests from pathlib import Path from urllib.parse import urlparse from llama_index import ServiceContext, StorageContext from llama_index import set_global_service_context from llama_index import VectorStoreIndex, SimpleDirectoryRe...
[ "llama_index.postprocessor.MetadataReplacementPostProcessor", "llama_index.readers.file.flat_reader.FlatReader", "llama_index.prompts.ChatMessage", "llama_index.ServiceContext.from_defaults", "llama_index.StorageContext.from_defaults", "llama_index.VectorStoreIndex", "llama_index.SimpleDirectoryReader",...
[((2448, 2465), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (2460, 2465), False, 'import requests\n'), ((2063, 2076), 'urllib.parse.urlparse', 'urlparse', (['url'], {}), '(url)\n', (2071, 2076), False, 'from urllib.parse import urlparse\n'), ((3032, 3049), 'requests.get', 'requests.get', (['url'], {}), '(...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # ================================================== # # This file is a part of PYGPT package # # Website: https://pygpt.net # # GitHub: https://github.com/szczyglis-dev/py-gpt # # MIT License ...
[ "llama_index.core.StorageContext.from_defaults", "llama_index.core.indices.vector_store.base.VectorStoreIndex", "llama_index.core.load_index_from_storage" ]
[((3613, 3659), 'llama_index.core.StorageContext.from_defaults', 'StorageContext.from_defaults', ([], {'persist_dir': 'path'}), '(persist_dir=path)\n', (3641, 3659), False, 'from llama_index.core import StorageContext, load_index_from_storage\n'), ((3792, 3865), 'llama_index.core.load_index_from_storage', 'load_index_f...
from __future__ import annotations from typing import Optional import os from llama_index.core import ServiceContext from llama_index.embeddings.azure_openai import AzureOpenAIEmbedding from llama_index.embeddings.openai import OpenAIEmbedding from llama_index.llms.azure_openai import AzureOpenAI from llama_index.core....
[ "llama_index.llms.azure_openai.AzureOpenAI", "llama_index.core.ServiceContext.from_defaults", "llama_index.embeddings.azure_openai.AzureOpenAIEmbedding", "llama_index.core.llms.openai_utils.CHAT_MODELS.update", "llama_index.core.llms.openai_utils.ALL_AVAILABLE_MODELS.update", "llama_index.core.llms.OpenAI...
[((948, 998), 'llama_index.core.llms.openai_utils.ALL_AVAILABLE_MODELS.update', 'ALL_AVAILABLE_MODELS.update', (['_EXTENDED_CHAT_MODELS'], {}), '(_EXTENDED_CHAT_MODELS)\n', (975, 998), False, 'from llama_index.core.llms.openai_utils import ALL_AVAILABLE_MODELS, CHAT_MODELS\n'), ((999, 1040), 'llama_index.core.llms.open...
from llama_index import SimpleDirectoryReader, LLMPredictor, ServiceContext, GPTVectorStoreIndex from langchain.chat_models import ChatOpenAI from dotenv import load_dotenv import os import graphsignal import logging import time import random load_dotenv() logging.basicConfig() logger = logging.getLogger() logger.set...
[ "llama_index.set_global_service_context", "llama_index.GPTVectorStoreIndex.from_documents", "llama_index.ServiceContext.from_defaults", "llama_index.SimpleDirectoryReader" ]
[((244, 257), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (255, 257), False, 'from dotenv import load_dotenv\n'), ((259, 280), 'logging.basicConfig', 'logging.basicConfig', ([], {}), '()\n', (278, 280), False, 'import logging\n'), ((290, 309), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (307,...
# Ref https://github.com/amrrs/QABot-LangChain/blob/main/Q%26A_Bot_with_Llama_Index_and_LangChain.ipynb #from gpt_index import SimpleDirectoryReader, GPTListIndex, GPTSimpleVectorIndex, LLMPredictor, PromptHelper from langchain import OpenAI from llama_index import SimpleDirectoryReader, LangchainEmbedding, GPTListInd...
[ "llama_index.GPTSimpleVectorIndex.from_documents", "llama_index.GPTSimpleVectorIndex.load_from_disk", "llama_index.ServiceContext.from_defaults", "llama_index.SimpleDirectoryReader", "llama_index.PromptHelper" ]
[((716, 815), 'llama_index.PromptHelper', 'PromptHelper', (['max_input_size', 'num_outputs', 'max_chunk_overlap'], {'chunk_size_limit': 'chunk_size_limit'}), '(max_input_size, num_outputs, max_chunk_overlap,\n chunk_size_limit=chunk_size_limit)\n', (728, 815), False, 'from llama_index import SimpleDirectoryReader, L...
# chroma.py import streamlit as st import os import re from pathlib import Path import chromadb from chromadb.config import Settings from llama_index import GPTVectorStoreIndex, load_index_from_storage from llama_index.vector_stores import ChromaVectorStore from utils.model_settings import sentenceTransformers, get_se...
[ "llama_index.vector_stores.ChromaVectorStore", "llama_index.load_index_from_storage", "llama_index.storage.storage_context.StorageContext.from_defaults" ]
[((665, 686), 'utils.model_settings.get_service_context', 'get_service_context', ([], {}), '()\n', (684, 686), False, 'from utils.model_settings import sentenceTransformers, get_service_context, get_embed_model\n'), ((1363, 1418), 'llama_index.vector_stores.ChromaVectorStore', 'ChromaVectorStore', ([], {'chroma_collect...
# /app/src/tools/doc_search.py import logging # Primary Components from llama_index import ServiceContext, VectorStoreIndex from llama_index.vector_stores.qdrant import QdrantVectorStore from qdrant_client import QdrantClient from src.utils.config import load_config, setup_environment_variables from src.utils.embeddi...
[ "llama_index.vector_stores.qdrant.QdrantVectorStore", "llama_index.VectorStoreIndex.from_vector_store", "llama_index.ServiceContext.from_defaults" ]
[((384, 411), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (401, 411), False, 'import logging\n'), ((1157, 1170), 'src.utils.config.load_config', 'load_config', ([], {}), '()\n', (1168, 1170), False, 'from src.utils.config import load_config, setup_environment_variables\n'), ((1179, 121...
import logging import traceback from typing import Sequence, List, Optional, Dict from llama_index import Document from llama_index.callbacks import CBEventType, CallbackManager from llama_index.callbacks.schema import EventPayload from llama_index.node_parser import NodeParser, SimpleNodeParser from llama_index.node_...
[ "llama_index.text_splitter.get_default_text_splitter", "llama_index.utils.get_tqdm_iterable", "llama_index.callbacks.CallbackManager" ]
[((893, 964), 'pydantic.Field', 'Field', ([], {'description': '"""The text splitter to use when splitting documents."""'}), "(description='The text splitter to use when splitting documents.')\n", (898, 964), False, 'from pydantic import Field\n'), ((1008, 1099), 'pydantic.Field', 'Field', ([], {'default': '(True)', 'de...
# RAG/TAG Tiger - llm.py # Copyright (c) 2024 Stuart Riffle # github.com/stuartriffle/ragtag-tiger import os import torch from .files import * from .lograg import lograg, lograg_verbose, lograg_error from .timer import TimerUntil openai_model_default = "gpt-3.5-turbo-instruct" google_model_default = "models/tex...
[ "llama_index.llms.MistralAI", "llama_index.llms.Perplexity", "llama_index.llms.Gemini", "llama_index.llms.OpenAILike", "llama_index.ServiceContext.from_defaults", "llama_index.llms.Replicate", "llama_index.llms.OpenAI", "llama_index.llms.LlamaCPP", "llama_index.llms.PaLM", "llama_index.llms.Huggin...
[((8029, 8090), 'llama_index.ServiceContext.from_defaults', 'ServiceContext.from_defaults', ([], {'embed_model': '"""local"""', 'llm': 'result'}), "(embed_model='local', llm=result)\n", (8057, 8090), False, 'from llama_index import ServiceContext, set_global_service_context\n'), ((1986, 2158), 'llama_index.llms.OpenAI'...
# 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.utils.get_tokenizer", "llama_index.callbacks.token_counting.get_llm_token_counts", "llama_index.utilities.token_counting.TokenCounter" ]
[((1450, 1483), 'contextvars.ContextVar', 'ContextVar', (['"""trace"""'], {'default': 'None'}), "('trace', default=None)\n", (1460, 1483), False, 'from contextvars import ContextVar\n'), ((2085, 2105), 'opentelemetry.trace.get_tracer', 'get_tracer', (['__name__'], {}), '(__name__)\n', (2095, 2105), False, 'from opentel...
from pathlib import Path from llama_index import download_loader ImageReader = download_loader("ImageReader") # If the Image has key-value pairs text, use text_type = "key_value" loader = ImageReader(text_type = "key_value") documents = loader.load_data(file=Path('./receipt.webp')) print(documents)
[ "llama_index.download_loader" ]
[((80, 110), 'llama_index.download_loader', 'download_loader', (['"""ImageReader"""'], {}), "('ImageReader')\n", (95, 110), False, 'from llama_index import download_loader\n'), ((261, 283), 'pathlib.Path', 'Path', (['"""./receipt.webp"""'], {}), "('./receipt.webp')\n", (265, 283), False, 'from pathlib import Path\n')]
# https://github.com/jerryjliu/llama_index/blob/main/examples/langchain_demo/LangchainDemo.ipynb # Using LlamaIndex as a Callable Tool from langchain.agents import Tool from langchain.chains.conversation.memory import ConversationBufferMemory from langchain.chat_models import ChatOpenAI from langchain.agents import i...
[ "llama_index.VectorStoreIndex.from_documents", "llama_index.tools.ToolMetadata", "llama_index.query_engine.SubQuestionQueryEngine.from_defaults", "llama_index.LLMPredictor", "llama_index.ServiceContext.from_defaults", "llama_index.SimpleDirectoryReader" ]
[((874, 992), 'langchain.HuggingFaceHub', 'HuggingFaceHub', ([], {'repo_id': 'repo_id', 'model_kwargs': "{'temperature': 0.1, 'truncation': 'only_first', 'max_length': 1024}"}), "(repo_id=repo_id, model_kwargs={'temperature': 0.1,\n 'truncation': 'only_first', 'max_length': 1024})\n", (888, 992), False, 'from langch...
"""This module provides functionality for loading chat prompts. The main function in this module is `load_chat_prompt`, which loads a chat prompt from a given JSON file. The JSON file should contain two keys: "system_template" and "human_template", which correspond to the system and user messages respectively. Typica...
[ "llama_index.llms.ChatMessage", "llama_index.ChatPromptTemplate" ]
[((626, 653), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (643, 653), False, 'import logging\n'), ((2217, 2237), 'pathlib.Path', 'pathlib.Path', (['f_name'], {}), '(f_name)\n', (2229, 2237), False, 'import pathlib\n'), ((2706, 2734), 'llama_index.ChatPromptTemplate', 'ChatPromptTemplat...
# Copyright 2023 osiworx # 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 # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software #...
[ "llama_index.embeddings.huggingface.HuggingFaceEmbedding", "llama_index.vector_stores.milvus.MilvusVectorStore", "llama_index.core.VectorStoreIndex.from_documents", "llama_index.core.SimpleDirectoryReader", "llama_index.core.storage.storage_context.StorageContext.from_defaults" ]
[((894, 1036), 'llama_index.vector_stores.milvus.MilvusVectorStore', 'MilvusVectorStore', ([], {'uri': '"""http://localhost:19530"""', 'port': '(19530)', 'collection_name': '"""llama_index_prompts_large"""', 'dim': '(384)', 'similarity_metric': '"""L2"""'}), "(uri='http://localhost:19530', port=19530, collection_name\n...
import numpy as np from llama_index.core import StorageContext, load_index_from_storage from llama_index.llms.litellm import LiteLLM from langchain_google_genai import ChatGoogleGenerativeAI from trulens_eval.feedback.provider.langchain import Langchain from trulens_eval import Tru, Feedback, TruLlama from trulens_eva...
[ "llama_index.llms.litellm.LiteLLM", "llama_index.core.StorageContext.from_defaults" ]
[((519, 570), 'llama_index.llms.litellm.LiteLLM', 'LiteLLM', ([], {'model': '"""gemini/gemini-pro"""', 'temperature': '(0.1)'}), "(model='gemini/gemini-pro', temperature=0.1)\n", (526, 570), False, 'from llama_index.llms.litellm import LiteLLM\n'), ((687, 744), 'langchain_google_genai.ChatGoogleGenerativeAI', 'ChatGoog...
import os from dotenv import load_dotenv from llama_index.chat_engine.condense_plus_context import CondensePlusContextChatEngine from llama_index.llms.openai import OpenAI from llama_index.llms.types import ChatMessage, MessageRole from llama_index.query_engine import RetrieverQueryEngine from llama_index.retrievers i...
[ "llama_index.llms.types.ChatMessage", "llama_index.chat_engine.condense_plus_context.CondensePlusContextChatEngine.from_defaults", "llama_index.retrievers.PathwayRetriever", "llama_index.query_engine.RetrieverQueryEngine.from_args", "llama_index.llms.openai.OpenAI" ]
[((443, 456), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (454, 456), False, 'from dotenv import load_dotenv\n'), ((622, 674), 'os.environ.get', 'os.environ.get', (['"""PATHWAY_HOST"""', 'DEFAULT_PATHWAY_HOST'], {}), "('PATHWAY_HOST', DEFAULT_PATHWAY_HOST)\n", (636, 674), False, 'import os\n'), ((932, 977), ...
# My OpenAI Key import logging import os import sys from IPython.display import Markdown, display from llama_index import GPTTreeIndex, SimpleDirectoryReader logging.basicConfig(stream=sys.stdout, level=logging.INFO) logging.getLogger().addHandler(logging.StreamHandler(stream=sys.stdout)) os.environ["OPENAI_API_KEY"...
[ "llama_index.SimpleDirectoryReader", "llama_index.GPTTreeIndex.load_from_disk", "llama_index.GPTTreeIndex.from_documents" ]
[((160, 218), 'logging.basicConfig', 'logging.basicConfig', ([], {'stream': 'sys.stdout', 'level': 'logging.INFO'}), '(stream=sys.stdout, level=logging.INFO)\n', (179, 218), False, 'import logging\n'), ((324, 351), 'os.getenv', 'os.getenv', (['"""OPENAI_API_KEY"""'], {}), "('OPENAI_API_KEY')\n", (333, 351), False, 'imp...