code
stringlengths
161
233k
apis
listlengths
1
24
extract_api
stringlengths
162
68.5k
"""Answer inserter.""" from abc import abstractmethod from typing import Any, Dict, List, Optional from llama_index.core.llms.llm import LLM from llama_index.core.prompts.base import BasePromptTemplate, PromptTemplate from llama_index.core.prompts.mixin import ( PromptDictType, PromptMixin, PromptMixinTyp...
[ "llama_index.core.prompts.base.PromptTemplate", "llama_index.core.settings.llm_from_settings_or_context" ]
[((4287, 4336), 'llama_index.core.prompts.base.PromptTemplate', 'PromptTemplate', (['DEFAULT_ANSWER_INSERT_PROMPT_TMPL'], {}), '(DEFAULT_ANSWER_INSERT_PROMPT_TMPL)\n', (4301, 4336), False, 'from llama_index.core.prompts.base import BasePromptTemplate, PromptTemplate\n'), ((4860, 4915), 'llama_index.core.settings.llm_fr...
"""Retrieval evaluators.""" from typing import Any, List, Optional, Sequence, Tuple from llama_index.legacy.bridge.pydantic import Field from llama_index.legacy.core.base_retriever import BaseRetriever from llama_index.legacy.evaluation.retrieval.base import ( BaseRetrievalEvaluator, RetrievalEvalMode, ) from...
[ "llama_index.legacy.bridge.pydantic.Field" ]
[((1038, 1085), 'llama_index.legacy.bridge.pydantic.Field', 'Field', (['...'], {'description': '"""Retriever to evaluate"""'}), "(..., description='Retriever to evaluate')\n", (1043, 1085), False, 'from llama_index.legacy.bridge.pydantic import Field\n'), ((1151, 1209), 'llama_index.legacy.bridge.pydantic.Field', 'Fiel...
"""Retrieval evaluators.""" from typing import Any, List, Optional, Sequence, Tuple from llama_index.legacy.bridge.pydantic import Field from llama_index.legacy.core.base_retriever import BaseRetriever from llama_index.legacy.evaluation.retrieval.base import ( BaseRetrievalEvaluator, RetrievalEvalMode, ) from...
[ "llama_index.legacy.bridge.pydantic.Field" ]
[((1038, 1085), 'llama_index.legacy.bridge.pydantic.Field', 'Field', (['...'], {'description': '"""Retriever to evaluate"""'}), "(..., description='Retriever to evaluate')\n", (1043, 1085), False, 'from llama_index.legacy.bridge.pydantic import Field\n'), ((1151, 1209), 'llama_index.legacy.bridge.pydantic.Field', 'Fiel...
from typing import Any, List, Optional from llama_index.legacy.bridge.pydantic import Field, PrivateAttr from llama_index.legacy.callbacks import CallbackManager from llama_index.legacy.core.embeddings.base import ( DEFAULT_EMBED_BATCH_SIZE, BaseEmbedding, ) from llama_index.legacy.embeddings.huggingface_utils...
[ "llama_index.legacy.embeddings.huggingface_utils.format_query", "llama_index.legacy.embeddings.huggingface_utils.get_pooling_mode", "llama_index.legacy.embeddings.pooling.Pooling", "llama_index.legacy.bridge.pydantic.PrivateAttr", "llama_index.legacy.bridge.pydantic.Field", "llama_index.legacy.embeddings....
[((567, 613), 'llama_index.legacy.bridge.pydantic.Field', 'Field', ([], {'description': '"""Folder name to load from."""'}), "(description='Folder name to load from.')\n", (572, 613), False, 'from llama_index.legacy.bridge.pydantic import Field, PrivateAttr\n'), ((636, 681), 'llama_index.legacy.bridge.pydantic.Field', ...
from typing import Any, List, Optional from llama_index.legacy.bridge.pydantic import Field, PrivateAttr from llama_index.legacy.callbacks import CallbackManager from llama_index.legacy.core.embeddings.base import ( DEFAULT_EMBED_BATCH_SIZE, BaseEmbedding, ) from llama_index.legacy.embeddings.huggingface_utils...
[ "llama_index.legacy.embeddings.huggingface_utils.format_query", "llama_index.legacy.embeddings.huggingface_utils.get_pooling_mode", "llama_index.legacy.embeddings.pooling.Pooling", "llama_index.legacy.bridge.pydantic.PrivateAttr", "llama_index.legacy.bridge.pydantic.Field", "llama_index.legacy.embeddings....
[((567, 613), 'llama_index.legacy.bridge.pydantic.Field', 'Field', ([], {'description': '"""Folder name to load from."""'}), "(description='Folder name to load from.')\n", (572, 613), False, 'from llama_index.legacy.bridge.pydantic import Field, PrivateAttr\n'), ((636, 681), 'llama_index.legacy.bridge.pydantic.Field', ...
"""Autoretriever prompts.""" from llama_index.legacy.prompts.base import PromptTemplate from llama_index.legacy.prompts.prompt_type import PromptType from llama_index.legacy.vector_stores.types import ( FilterOperator, MetadataFilter, MetadataInfo, VectorStoreInfo, VectorStoreQuerySpec, ) # NOTE: ...
[ "llama_index.legacy.vector_stores.types.MetadataInfo", "llama_index.legacy.vector_stores.types.MetadataFilter", "llama_index.legacy.prompts.base.PromptTemplate" ]
[((3927, 4033), 'llama_index.legacy.prompts.base.PromptTemplate', 'PromptTemplate', ([], {'template': 'DEFAULT_VECTARA_QUERY_PROMPT_TMPL', 'prompt_type': 'PromptType.VECTOR_STORE_QUERY'}), '(template=DEFAULT_VECTARA_QUERY_PROMPT_TMPL, prompt_type=\n PromptType.VECTOR_STORE_QUERY)\n', (3941, 4033), False, 'from llama...
"""Autoretriever prompts.""" from llama_index.legacy.prompts.base import PromptTemplate from llama_index.legacy.prompts.prompt_type import PromptType from llama_index.legacy.vector_stores.types import ( FilterOperator, MetadataFilter, MetadataInfo, VectorStoreInfo, VectorStoreQuerySpec, ) # NOTE: ...
[ "llama_index.legacy.vector_stores.types.MetadataInfo", "llama_index.legacy.vector_stores.types.MetadataFilter", "llama_index.legacy.prompts.base.PromptTemplate" ]
[((3927, 4033), 'llama_index.legacy.prompts.base.PromptTemplate', 'PromptTemplate', ([], {'template': 'DEFAULT_VECTARA_QUERY_PROMPT_TMPL', 'prompt_type': 'PromptType.VECTOR_STORE_QUERY'}), '(template=DEFAULT_VECTARA_QUERY_PROMPT_TMPL, prompt_type=\n PromptType.VECTOR_STORE_QUERY)\n', (3941, 4033), False, 'from llama...
"""Faithfulness evaluation.""" from __future__ import annotations from typing import Any, List, Optional, Sequence, Union from llama_index.core.evaluation.base import BaseEvaluator, EvaluationResult from llama_index.core.multi_modal_llms.base import MultiModalLLM from llama_index.core.prompts import BasePromptTempla...
[ "llama_index.core.prompts.PromptTemplate", "llama_index.core.evaluation.base.EvaluationResult", "llama_index.core.schema.ImageNode", "llama_index.multi_modal_llms.openai.OpenAIMultiModal" ]
[((468, 1757), 'llama_index.core.prompts.PromptTemplate', 'PromptTemplate', (['"""Please tell if a given piece of information is supported by the visual as well as textual context information.\nYou need to answer with either YES or NO.\nAnswer YES if any of the image(s) and textual context supports the information, eve...
"""Faithfulness evaluation.""" from __future__ import annotations from typing import Any, List, Optional, Sequence, Union from llama_index.core.evaluation.base import BaseEvaluator, EvaluationResult from llama_index.core.multi_modal_llms.base import MultiModalLLM from llama_index.core.prompts import BasePromptTempla...
[ "llama_index.core.prompts.PromptTemplate", "llama_index.core.evaluation.base.EvaluationResult", "llama_index.core.schema.ImageNode", "llama_index.multi_modal_llms.openai.OpenAIMultiModal" ]
[((468, 1757), 'llama_index.core.prompts.PromptTemplate', 'PromptTemplate', (['"""Please tell if a given piece of information is supported by the visual as well as textual context information.\nYou need to answer with either YES or NO.\nAnswer YES if any of the image(s) and textual context supports the information, eve...
"""Faithfulness evaluation.""" from __future__ import annotations from typing import Any, List, Optional, Sequence, Union from llama_index.core.evaluation.base import BaseEvaluator, EvaluationResult from llama_index.core.multi_modal_llms.base import MultiModalLLM from llama_index.core.prompts import BasePromptTempla...
[ "llama_index.core.prompts.PromptTemplate", "llama_index.core.evaluation.base.EvaluationResult", "llama_index.core.schema.ImageNode", "llama_index.multi_modal_llms.openai.OpenAIMultiModal" ]
[((468, 1757), 'llama_index.core.prompts.PromptTemplate', 'PromptTemplate', (['"""Please tell if a given piece of information is supported by the visual as well as textual context information.\nYou need to answer with either YES or NO.\nAnswer YES if any of the image(s) and textual context supports the information, eve...
"""RAG LLM.""" from typing import Any from llama_index.core.constants import DEFAULT_CONTEXT_WINDOW from llama_index.core.llms import ( CompletionResponse, CompletionResponseGen, CustomLLM, LLMMetadata, ) from llama_index.core.llms.callbacks import llm_completion_callback from pydantic import Field f...
[ "llama_index.core.llms.CompletionResponse", "llama_index.core.llms.callbacks.llm_completion_callback", "llama_index.core.llms.LLMMetadata" ]
[((751, 795), 'pydantic.Field', 'Field', (['...'], {'description': '"""The MetaGPT\'s LLM."""'}), '(..., description="The MetaGPT\'s LLM.")\n', (756, 795), False, 'from pydantic import Field\n'), ((822, 877), 'metagpt.utils.token_counter.TOKEN_MAX.get', 'TOKEN_MAX.get', (['config.llm.model', 'DEFAULT_CONTEXT_WINDOW'], ...
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.storage.storage_context.StorageContext.from_defaults", "llama_index.llm_predictor.StructuredLLMPredictor", "llama_index.llms.openai.OpenAI", "llama_index.LLMPredictor", "llama_index.ServiceContext.from_defaults", "llama_index.indices.loading.load_index_from_storage", "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'}),...
import logging import tempfile from pathlib import Path from typing import AnyStr, BinaryIO from injector import inject, singleton from llama_index.core.node_parser import SentenceWindowNodeParser from llama_index.core.storage import StorageContext from private_gpt.components.embedding.embedding_component import Embe...
[ "llama_index.core.storage.StorageContext.from_defaults", "llama_index.core.node_parser.SentenceWindowNodeParser.from_defaults" ]
[((788, 815), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (805, 815), False, 'import logging\n'), ((1171, 1346), 'llama_index.core.storage.StorageContext.from_defaults', 'StorageContext.from_defaults', ([], {'vector_store': 'vector_store_component.vector_store', 'docstore': 'node_store...
import logging from llama_index.prompts.prompts import QuestionAnswerPrompt QUESTION_ANSWER_PROMPT_TMPL_CN = ( "上下文信息如下所示: \n" "---------------------\n" "{context_str}" "\n---------------------\n" "我的问题是:{query_str}\n" ) QUESTION_ANSWER_PROMPT_TMPL_EN = ( "Context information is below. \n" ...
[ "llama_index.prompts.prompts.QuestionAnswerPrompt" ]
[((510, 561), 'logging.info', 'logging.info', (['"""=====> Use English prompt template!"""'], {}), "('=====> Use English prompt template!')\n", (522, 561), False, 'import logging\n'), ((577, 629), 'llama_index.prompts.prompts.QuestionAnswerPrompt', 'QuestionAnswerPrompt', (['QUESTION_ANSWER_PROMPT_TMPL_EN'], {}), '(QUE...
from llama_index.core import Document from llama_index.core.node_parser import CodeSplitter from llama_index.retrievers.bm25 import BM25Retriever from llama_index.core import VectorStoreIndex from llama_index.core.query_engine import RetrieverQueryEngine from llama_index.core import get_response_synthesizer from llama_...
[ "llama_index.core.node_parser.CodeSplitter", "llama_index.core.query_engine.RetrieverQueryEngine", "llama_index.retrievers.bm25.BM25Retriever.from_defaults", "llama_index.core.VectorStoreIndex", "llama_index.core.PromptTemplate", "llama_index.core.Document", "llama_index.core.get_response_synthesizer" ]
[((869, 964), 'llama_index.core.node_parser.CodeSplitter', 'CodeSplitter', ([], {'language': '"""html"""', 'chunk_lines': '(40)', 'chunk_lines_overlap': '(200)', 'max_chars': 'MAX_CHARS'}), "(language='html', chunk_lines=40, chunk_lines_overlap=200,\n max_chars=MAX_CHARS)\n", (881, 964), False, 'from llama_index.cor...
import io from pathlib import Path from typing import List import requests ## TODO: Make this token-aware. def convert_messages_to_str(messages: List[dict]) -> str: """convert messages in OpenAI API format into a single string. Args: messages List[dict]: A list of dictionary in the following format: ...
[ "llama_index.core.node_parser.text.SentenceSplitter", "llama_index.core.readers.download.download_loader", "llama_index.core.Document" ]
[((3916, 3994), 'llama_index.core.node_parser.text.SentenceSplitter', 'SentenceSplitter', ([], {'chunk_size': 'chunk_size', 'chunk_overlap': 'chunk_overlap'}), '(chunk_size=chunk_size, chunk_overlap=chunk_overlap, **kwargs)\n', (3932, 3994), False, 'from llama_index.core.node_parser.text import SentenceSplitter\n'), ((...
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'}), '([], ...
import datetime import io import json import os import sys import tempfile import traceback from typing import Optional, Dict, Any import aiohttp import re import discord import openai from bs4 import BeautifulSoup from discord.ext import pages from langchain.utilities import ( GoogleSearchAPIWrapper, ) from langc...
[ "llama_index.SimpleDirectoryReader", "llama_index.response_synthesizers.get_response_synthesizer", "llama_index.ServiceContext.from_defaults", "llama_index.OpenAIEmbedding", "llama_index.retrievers.VectorIndexRetriever", "llama_index.GPTVectorStoreIndex.from_documents", "llama_index.query_engine.Retriev...
[((3894, 3925), 'services.environment_service.EnvService.get_allowed_guilds', 'EnvService.get_allowed_guilds', ([], {}), '()\n', (3923, 3925), False, 'from services.environment_service import EnvService\n'), ((3948, 3984), 'services.environment_service.EnvService.get_user_input_api_keys', 'EnvService.get_user_input_api...
"""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.vector_stores.lancedb._to_llama_similarities", "llama_index.schema.RelatedNodeInfo", "llama_index.vector_stores.lancedb._to_lance_filter" ]
[((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 llama_index import ( VectorStoreIndex, SimpleDirectoryReader, load_index_from_storage, StorageContext, Prompt, ) from agenta import post, FloatParam, TextParam import os def ingest(): if not os.path.exists("./storage"): documents = SimpleDirectoryReader("data").load_data() ...
[ "llama_index.VectorStoreIndex.from_documents", "llama_index.SimpleDirectoryReader", "llama_index.StorageContext.from_defaults", "llama_index.Prompt", "llama_index.load_index_from_storage" ]
[((957, 971), 'llama_index.Prompt', 'Prompt', (['prompt'], {}), '(prompt)\n', (963, 971), False, 'from llama_index import VectorStoreIndex, SimpleDirectoryReader, load_index_from_storage, StorageContext, Prompt\n'), ((222, 249), 'os.path.exists', 'os.path.exists', (['"""./storage"""'], {}), "('./storage')\n", (236, 249...
from typing import Dict, List, Optional import logging from pathlib import Path from datetime import datetime import s3fs from fsspec.asyn import AsyncFileSystem from llama_index import ( ServiceContext, VectorStoreIndex, StorageContext, load_indices_from_storage, ) from llama_index.vector_stores.types ...
[ "llama_index.VectorStoreIndex.from_documents", "llama_index.readers.file.docs_reader.PDFReader", "llama_index.ServiceContext.from_defaults", "llama_index.llms.OpenAI", "llama_index.StorageContext.from_defaults", "llama_index.llms.ChatMessage", "llama_index.load_indices_from_storage", "llama_index.node...
[((1919, 1946), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1936, 1946), False, 'import logging\n'), ((1994, 2014), 'nest_asyncio.apply', 'nest_asyncio.apply', ([], {}), '()\n', (2012, 2014), False, 'import nest_asyncio\n'), ((2151, 2261), 's3fs.S3FileSystem', 's3fs.S3FileSystem', ([]...
# SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: MIT # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without res...
[ "llama_index.VectorStoreIndex.from_documents", "llama_index.SimpleDirectoryReader", "llama_index.vector_stores.FaissVectorStore", "llama_index.vector_stores.FaissVectorStore.from_persist_dir", "llama_index.StorageContext.from_defaults", "llama_index.load_index_from_storage" ]
[((1848, 1881), 'os.path.exists', 'os.path.exists', (['"""storage-default"""'], {}), "('storage-default')\n", (1862, 1881), False, 'import faiss, os\n'), ((1886, 1915), 'os.listdir', 'os.listdir', (['"""storage-default"""'], {}), "('storage-default')\n", (1896, 1915), False, 'import faiss, os\n'), ((1991, 2043), 'llama...
"""Memory for agents.""" import os from llama_index.core import GPTVectorStoreIndex, GPTListIndex from llama_index.core import Document, ServiceContext from llama_index.legacy import LLMPredictor from llama_index.core import StorageContext, load_index_from_storage from langchain_community.chat_models import ChatOpenAI ...
[ "llama_index.core.StorageContext.from_defaults", "llama_index.core.load_index_from_storage", "llama_index.core.ServiceContext.from_defaults", "llama_index.core.Document" ]
[((337, 376), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (356, 376), False, 'import logging\n'), ((386, 413), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (403, 413), False, 'import logging\n'), ((1330, 1377), 'llama_index.co...
import logging from typing import List, Optional import requests from llama_index.callbacks.base import CallbackManager from llama_index.constants import DEFAULT_SIMILARITY_TOP_K from llama_index.core.base_retriever import BaseRetriever from llama_index.indices.managed.zilliz.base import ZillizCloudPipelineIndex from...
[ "llama_index.schema.TextNode" ]
[((511, 538), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (528, 538), False, 'import logging\n'), ((1978, 2052), 'requests.post', 'requests.post', (['self.search_pipeline_url'], {'headers': 'self.headers', 'json': 'params'}), '(self.search_pipeline_url, headers=self.headers, json=param...
import sys import os # this is needed to import classes from the API. it will be removed when the worker is refactored sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../'))) import logging import json import pika import time import fitz from pathlib import Path from shared.job_status impo...
[ "llama_index.download_loader" ]
[((847, 916), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': '"""./extract-log.txt"""', 'level': 'logging.INFO'}), "(filename='./extract-log.txt', level=logging.INFO)\n", (866, 916), False, 'import logging\n'), ((917, 993), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': '"""./extract-e...
import os import json import time from typing import List import faiss import pypdf import random import itertools import text_utils import pandas as pd import altair as alt import streamlit as st from io import StringIO from llama_index import Document from langchain.llms import Anthropic from langchain.chains import ...
[ "llama_index.LangchainEmbedding" ]
[((13312, 13350), 'streamlit.sidebar.image', 'st.sidebar.image', (['"""img/diagnostic.jpg"""'], {}), "('img/diagnostic.jpg')\n", (13328, 13350), True, 'import streamlit as st\n'), ((15130, 15159), 'streamlit.header', 'st.header', (['"""`Auto-evaluator`"""'], {}), "('`Auto-evaluator`')\n", (15139, 15159), True, 'import ...
import numpy as np import json from fastapi import HTTPException, FastAPI, websockets import json # for JSON parsing and packing # for easy async code # for absolute project paths import os # astro chat engines from chat_objects import * from chat_engine import ChatEngine from vedastro import * # install via pip...
[ "llama_index.core.VectorStoreIndex.from_documents", "llama_index.core.SimpleDirectoryReader", "llama_index.core.SummaryIndex.from_documents" ]
[((816, 841), 'fastapi.FastAPI', 'FastAPI', ([], {'title': '"""Chat API"""'}), "(title='Chat API')\n", (823, 841), False, 'from fastapi import HTTPException, FastAPI, websockets\n'), ((1553, 1570), 'chat_engine.ChatEngine', 'ChatEngine', (['"""MK7"""'], {}), "('MK7')\n", (1563, 1570), False, 'from chat_engine import Ch...
import os import pygments from prompt_toolkit import print_formatted_text from prompt_toolkit.formatted_text import PygmentsTokens from pygments_markdown_lexer import MarkdownLexer from typing import Any from langchain import ConversationChain, OpenAI from langchain.chat_models import ChatOpenAI from langchain.chains.c...
[ "llama_index.VectorStoreIndex.from_documents", "llama_index.SimpleDirectoryReader", "llama_index.ServiceContext.from_defaults", "llama_index.StorageContext.from_defaults", "llama_index.load_index_from_storage" ]
[((2499, 2523), 'gpttrace.config.cfg.get', 'cfg.get', (['"""DEFAULT_MODEL"""'], {}), "('DEFAULT_MODEL')\n", (2506, 2523), False, 'from gpttrace.config import cfg\n'), ((2534, 2582), 'langchain.chat_models.ChatOpenAI', 'ChatOpenAI', ([], {'model_name': 'model_name', 'temperature': '(0)'}), '(model_name=model_name, tempe...
from typing import List import streamlit as st import os, shutil from llama_index import VectorStoreIndex, ServiceContext, Document from llama_index.llms import OpenAI from llama_index import SimpleDirectoryReader def load_data(): reader = SimpleDirectoryReader(input_dir="src/data", recursive=True) docs = rea...
[ "llama_index.VectorStoreIndex.from_documents", "llama_index.SimpleDirectoryReader", "llama_index.llms.OpenAI" ]
[((246, 305), 'llama_index.SimpleDirectoryReader', 'SimpleDirectoryReader', ([], {'input_dir': '"""src/data"""', 'recursive': '(True)'}), "(input_dir='src/data', recursive=True)\n", (267, 305), False, 'from llama_index import SimpleDirectoryReader\n'), ((695, 766), 'llama_index.VectorStoreIndex.from_documents', 'Vector...
import os import logging from typing import Iterator from llama_index import ( LLMPredictor, StorageContext, VectorStoreIndex, load_index_from_storage, get_response_synthesizer, ServiceContext, ) from langchain.chat_models import ChatOpenAI from llama_index.indices.postprocessor import Similarit...
[ "llama_index.get_response_synthesizer", "llama_index.ServiceContext.from_defaults", "llama_index.retrievers.VectorIndexRetriever", "llama_index.StorageContext.from_defaults", "llama_index.text_splitter.TokenTextSplitter", "llama_index.node_parser.SimpleNodeParser.from_defaults", "llama_index.callbacks.b...
[((780, 819), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (799, 819), False, 'import logging\n'), ((829, 856), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (846, 856), False, 'import logging\n'), ((2237, 2264), 'os.walk', 'os....
import json from typing import Any, Hashable import nest_asyncio import pandas as pd import requests from llama_index import ServiceContext from llama_index.llms import OpenAI from ragas import metrics from tenacity import retry, stop_after_attempt, wait_random_exponential from tqdm import tqdm from wandbot.evaluatio...
[ "llama_index.llms.OpenAI" ]
[((689, 709), 'wandbot.utils.get_logger', 'get_logger', (['__name__'], {}), '(__name__)\n', (699, 709), False, 'from wandbot.utils import cachew, get_logger\n'), ((711, 731), 'nest_asyncio.apply', 'nest_asyncio.apply', ([], {}), '()\n', (729, 731), False, 'import nest_asyncio\n'), ((885, 989), 'wandbot.evaluation.eval....
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.llms.OpenAI", "llama_index.vector_stores.types.MetadataInfo", "llama_index.set_global_service_context", "llama_index.indices.vector_store.retrievers.VectorIndexAutoRetriever", "llama_index.agent.OpenAIAgent.from_tools", "llama_...
[((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', (['"""#...
from langchain.prompts import PromptTemplate from langchain.output_parsers import PydanticOutputParser from llama_index import VectorStoreIndex, ServiceContext, StorageContext from llama_index.vector_stores import FaissVectorStore from llama_index.tools import QueryEngineTool, ToolMetadata from llama_index.query_engin...
[ "llama_index.VectorStoreIndex.from_documents", "llama_index.vector_stores.FaissVectorStore", "llama_index.node_parser.UnstructuredElementNodeParser", "llama_index.ServiceContext.from_defaults", "llama_index.tools.ToolMetadata", "llama_index.StorageContext.from_defaults", "llama_index.VectorStoreIndex", ...
[((1272, 1416), 'streamlit.set_page_config', 'st.set_page_config', ([], {'page_title': '"""Annual Report Analyzer"""', 'page_icon': '""":card_index_dividers:"""', 'initial_sidebar_state': '"""expanded"""', 'layout': '"""wide"""'}), "(page_title='Annual Report Analyzer', page_icon=\n ':card_index_dividers:', initial_...
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.tools.ToolOutput", "llama_index.core.chat_engine.utils.response_gen_from_query_engine", "llama_index.core.prompts.base.PromptTemplate", "llama_index.core.callbacks.CallbackManager", "llama_index.core.settings.callback_manager_from_settings_or_context", "llama_index.core.base.llms.types.C...
[((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 Settings import settings from llama_index.core import VectorStoreIndex, StorageContext, load_index_from_storage, SimpleDirectoryReader, Settings, get_response_synthesizer from llama_index.embeddings.ollama import OllamaEmbedding from llama_index.llms.ollama import Ollama from llama_index.readers.web import MainCon...
[ "llama_index.core.VectorStoreIndex.from_documents", "llama_index.readers.web.MainContentExtractorReader", "llama_index.core.StorageContext.from_defaults", "llama_index.core.load_index_from_storage", "llama_index.core.postprocessor.SimilarityPostprocessor", "llama_index.core.SimpleDirectoryReader", "llam...
[((608, 678), 'llama_index.embeddings.ollama.OllamaEmbedding', 'OllamaEmbedding', ([], {'base_url': 'settings.host', 'model_name': '"""nomic-embed-text"""'}), "(base_url=settings.host, model_name='nomic-embed-text')\n", (623, 678), False, 'from llama_index.embeddings.ollama import OllamaEmbedding\n'), ((861, 909), 'lla...
import logging import os import sys from pathlib import Path from dotenv import load_dotenv from langchain.llms.octoai_endpoint import OctoAIEndpoint as OctoAiCloudLLM from langchain.embeddings.octoai_embeddings import OctoAIEmbeddings from llama_index import ( LLMPredictor, ServiceContext, download_loade...
[ "llama_index.ServiceContext.from_defaults", "llama_index.GPTVectorStoreIndex.from_documents", "llama_index.download_loader", "llama_index.LLMPredictor" ]
[((557, 578), 'os.chdir', 'os.chdir', (['current_dir'], {}), '(current_dir)\n', (565, 578), False, 'import os\n'), ((611, 654), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.CRITICAL'}), '(level=logging.CRITICAL)\n', (630, 654), False, 'import logging\n'), ((685, 698), 'dotenv.load_dotenv', 'loa...
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')]
# Databricks notebook source # MAGIC %md # MAGIC # Understanding Embeddings # MAGIC Embeddings are just vectors and we can visualise and analyse them as such \ # MAGIC A common way to look at and explore embeddings is to use TSNE visualisations. \ # MAGIC This can be applied to our VectorDB Data too. # MAGIC # MAGIC Se...
[ "llama_index.VectorStoreIndex.from_documents", "llama_index.evaluation.DatasetGenerator.from_documents", "llama_index.download_loader", "llama_index.LLMPredictor", "llama_index.ServiceContext.from_defaults", "llama_index.callbacks.OpenInferenceCallbackHandler", "llama_index.set_global_service_context", ...
[((3171, 3216), 'numpy.array', 'np.array', (['encoded_sentences'], {'dtype': 'np.float32'}), '(encoded_sentences, dtype=np.float32)\n', (3179, 3216), True, 'import numpy as np\n'), ((3349, 3397), 'faiss.IndexFlatIP', 'faiss.IndexFlatIP', (['vector_format_encode.shape[1]'], {}), '(vector_format_encode.shape[1])\n', (336...
import asyncio import io import json import logging import os import tempfile import time from logging import getLogger from fastapi import APIRouter, Request, status from fastapi.encoders import jsonable_encoder from typing import List, Tuple # This is here to satisfy runtime import needs # that pyinstaller appears...
[ "llama_index.schema.TextNode", "llama_index.schema.RelatedNodeInfo", "llama_index.Document" ]
[((975, 986), 'logging.getLogger', 'getLogger', ([], {}), '()\n', (984, 986), False, 'from logging import getLogger\n'), ((1001, 1023), 'snowflake.SnowflakeGenerator', 'SnowflakeGenerator', (['(42)'], {}), '(42)\n', (1019, 1023), False, 'from snowflake import SnowflakeGenerator\n'), ((1034, 1045), 'fastapi.APIRouter', ...
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...
# coding=utf-8 import glob, pprint, traceback, pydoc, threading, asyncio import os, re, webbrowser, platform, zipfile, subprocess, config from prompt_toolkit.input import create_input from prompt_toolkit.keys import Keys from datetime import date from db.StatisticsWordsSqlite import StatisticsWordsSqlite from util.Vlc...
[ "llama_index.SimpleDirectoryReader", "llama_index.ServiceContext.from_defaults", "llama_index.llms.OpenAI", "llama_index.StorageContext.from_defaults", "llama_index.load_index_from_storage", "llama_index.GPTVectorStoreIndex.from_documents" ]
[((63135, 63172), 're.split', 're.split', (['"""[ ]*?:::[ ]*?"""', 'command', '(1)'], {}), "('[ ]*?:::[ ]*?', command, 1)\n", (63143, 63172), False, 'import os, re, webbrowser, platform, zipfile, subprocess, config\n'), ((65168, 65182), 'db.BiblesSqlite.BiblesSqlite', 'BiblesSqlite', ([], {}), '()\n', (65180, 65182), F...
import os import pickle import requests from flask import Flask, jsonify, request from flask_cors import CORS from google.auth.transport.requests import Request from google_auth_oauthlib.flow import InstalledAppFlow from llama_index import GPTSimpleVectorIndex, download_loader os.environ['OPENAI_API_KEY'] = 'xxxx' d...
[ "llama_index.GPTSimpleVectorIndex", "llama_index.download_loader" ]
[((969, 984), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (974, 984), False, 'from flask import Flask, jsonify, request\n'), ((985, 994), 'flask_cors.CORS', 'CORS', (['app'], {}), '(app)\n', (989, 994), False, 'from flask_cors import CORS\n'), ((461, 491), 'os.path.exists', 'os.path.exists', (['"""token...
import os import zipfile from pathlib import Path from dotenv import load_dotenv from llama_index.core import (KnowledgeGraphIndex, SimpleDirectoryReader, StorageContext, load_index_from_storage) from llama_index.graph_stores.neo4j import Neo4jGraphStore from llama_index.llms.openai impor...
[ "llama_index.core.KnowledgeGraphIndex.from_documents", "llama_index.core.StorageContext.from_defaults", "llama_index.core.SimpleDirectoryReader", "llama_index.graph_stores.neo4j.Neo4jGraphStore" ]
[((464, 497), 'dotenv.load_dotenv', 'load_dotenv', ([], {'dotenv_path': 'env_path'}), '(dotenv_path=env_path)\n', (475, 497), False, 'from dotenv import load_dotenv\n'), ((508, 530), 'os.getenv', 'os.getenv', (['"""NEO4J_URI"""'], {}), "('NEO4J_URI')\n", (517, 530), False, 'import os\n'), ((541, 568), 'os.getenv', 'os....
import tempfile, os from routers.utils.engine import Engine from llama_index import download_loader from fastapi import APIRouter, UploadFile, HTTPException engine = Engine() router = APIRouter() @router.post("/pdf") async def file(upload_file: UploadFile, namespace: str): """ Loader: https://llamahub.ai/l/fi...
[ "llama_index.download_loader" ]
[((167, 175), 'routers.utils.engine.Engine', 'Engine', ([], {}), '()\n', (173, 175), False, 'from routers.utils.engine import Engine\n'), ((185, 196), 'fastapi.APIRouter', 'APIRouter', ([], {}), '()\n', (194, 196), False, 'from fastapi import APIRouter, UploadFile, HTTPException\n'), ((380, 418), 'os.path.splitext', 'o...
import os from llama_index import GPTSimpleVectorIndex, SimpleDirectoryReader, download_loader from llama_index import Document, LLMPredictor, PromptHelper, QuestionAnswerPrompt, JSONReader from langchain.llms import OpenAIChat, OpenAI from zipfile import ZipFile from googlesearch import search as google_search from ba...
[ "llama_index.GPTSimpleVectorIndex", "llama_index.download_loader", "llama_index.QuestionAnswerPrompt", "llama_index.PromptHelper", "llama_index.GPTSimpleVectorIndex.load_from_disk", "llama_index.JSONReader", "llama_index.Document" ]
[((2322, 2382), 'llama_index.PromptHelper', 'PromptHelper', (['max_input_size', 'num_outputs', 'max_chunk_overlap'], {}), '(max_input_size, num_outputs, max_chunk_overlap)\n', (2334, 2382), False, 'from llama_index import Document, LLMPredictor, PromptHelper, QuestionAnswerPrompt, JSONReader\n'), ((2396, 2490), 'llama_...
import json from langchain.prompts import PromptTemplate import tiktoken from llama_index.callbacks import CallbackManager, TokenCountingHandler from llama_index.node_parser import SimpleNodeParser from llama_index.vector_stores import WeaviateVectorStore from llama_index import ( VectorStoreIndex, SimpleDirector...
[ "llama_index.VectorStoreIndex.from_documents", "llama_index.SimpleDirectoryReader", "llama_index.VectorStoreIndex.from_vector_store", "llama_index.VectorStoreIndex", "llama_index.ServiceContext.from_defaults", "llama_index.StorageContext.from_defaults", "llama_index.node_parser.SimpleNodeParser.from_def...
[((499, 515), 'app_state.init_app_state', 'init_app_state', ([], {}), '()\n', (513, 515), False, 'from app_state import state, init_app_state, _set_state_cb\n'), ((1129, 1175), 'streamlit.cache_data', 'st.cache_data', ([], {'ttl': '(60 * 60)', 'show_spinner': '(False)'}), '(ttl=60 * 60, show_spinner=False)\n', (1142, 1...
import logging from typing import List, Optional import tiktoken from llama_index.indices.base import BaseIndex from transformers import AutoTokenizer from tiktoken import Encoding from llama_index import ( VectorStoreIndex, SimpleDirectoryReader, ServiceContext, StorageContext, ) from llama_index.lan...
[ "llama_index.VectorStoreIndex.from_documents", "llama_index.SimpleDirectoryReader", "llama_index.langchain_helpers.text_splitter.TokenTextSplitter", "llama_index.ServiceContext.from_defaults", "llama_index.StorageContext.from_defaults", "llama_index.node_parser.SimpleNodeParser", "llama_index.load_index...
[((697, 738), 'transformers.AutoTokenizer.from_pretrained', 'AutoTokenizer.from_pretrained', (['model_name'], {}), '(model_name)\n', (726, 738), False, 'from transformers import AutoTokenizer\n'), ((1440, 1628), 'llama_index.langchain_helpers.text_splitter.TokenTextSplitter', 'TokenTextSplitter', ([], {'chunk_size': 'c...
from __future__ import annotations from typing import TYPE_CHECKING, Any, Dict, List, Tuple from uuid import uuid4 from llama_index.legacy.llm_predictor.vellum.types import ( VellumCompiledPrompt, VellumRegisteredPrompt, ) from llama_index.legacy.llm_predictor.vellum.utils import convert_to_kebab_case from ll...
[ "llama_index.legacy.llm_predictor.vellum.types.VellumCompiledPrompt", "llama_index.legacy.llm_predictor.vellum.utils.convert_to_kebab_case", "llama_index.legacy.llm_predictor.vellum.types.VellumRegisteredPrompt" ]
[((1114, 1144), 'vellum.client.Vellum', 'Vellum', ([], {'api_key': 'vellum_api_key'}), '(api_key=vellum_api_key)\n', (1120, 1144), False, 'from vellum.client import Vellum\n'), ((3100, 3187), 'llama_index.legacy.llm_predictor.vellum.types.VellumCompiledPrompt', 'VellumCompiledPrompt', ([], {'text': 'result.prompt.text'...
# 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.VectorStoreIndex.from_documents", "llama_index.SimpleDirectoryReader", "llama_index.ServiceContext.from_defaults", "llama_index.vector_stores.MilvusVectorStore", "llama_index.StorageContext.from_defaults", "llama_index.embeddings.HuggingFaceEmbedding" ]
[((946, 1086), 'llama_index.vector_stores.MilvusVectorStore', 'MilvusVectorStore', ([], {'uri': '"""http://localhost:19530"""', 'port': '(19530)', 'collection_name': '"""llama_index_prompts_all"""', 'dim': '(384)', 'similarity_metric': '"""L2"""'}), "(uri='http://localhost:19530', port=19530, collection_name\n ='lla...
import streamlit as st import logging, sys, os import openai from dotenv import load_dotenv from llama_index.agent import OpenAIAgent from llama_index.llms import OpenAI from llama_hub.tools.zapier.base import ZapierToolSpec #loads dotenv lib to retrieve API keys from .env file load_dotenv() openai.api_key = os.getenv...
[ "llama_index.llms.OpenAI" ]
[((280, 293), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (291, 293), False, 'from dotenv import load_dotenv\n'), ((311, 338), 'os.getenv', 'os.getenv', (['"""OPENAI_API_KEY"""'], {}), "('OPENAI_API_KEY')\n", (320, 338), False, 'import logging, sys, os\n'), ((368, 426), 'logging.basicConfig', 'logging.basicC...
import os from flask import Flask, render_template, request, redirect from llama_index import download_loader from llama_index import LLMPredictor, GPTSimpleVectorIndex, PromptHelper, ServiceContext from langchain import OpenAI os.environ["OPENAI_API_KEY"] = "insert_your_key_here" current_script_path = os.path.dirnam...
[ "llama_index.download_loader", "llama_index.ServiceContext.from_defaults", "llama_index.GPTSimpleVectorIndex.from_documents", "llama_index.PromptHelper", "llama_index.GPTSimpleVectorIndex.load_from_disk" ]
[((442, 457), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (447, 457), False, 'from flask import Flask, render_template, request, redirect\n'), ((322, 347), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (337, 347), False, 'import os\n'), ((360, 401), 'os.path.join', 'os.path.j...
from llama_index import ServiceContext from app.context import create_base_context from app.engine.constants import CHUNK_OVERLAP, CHUNK_SIZE def create_service_context(): base = create_base_context() return ServiceContext.from_defaults( llm=base.llm, embed_model=base.embed_model, chu...
[ "llama_index.ServiceContext.from_defaults" ]
[((186, 207), 'app.context.create_base_context', 'create_base_context', ([], {}), '()\n', (205, 207), False, 'from app.context import create_base_context\n'), ((219, 347), 'llama_index.ServiceContext.from_defaults', 'ServiceContext.from_defaults', ([], {'llm': 'base.llm', 'embed_model': 'base.embed_model', 'chunk_size'...
from portkey_ai import Message, Portkey from typing import Optional, Union, List, Any, Mapping, cast, Sequence from portkey_ai.api_resources.utils import PortkeyResponse from portkey_ai.llms.llama_index.utils import ( IMPORT_ERROR_MESSAGE, is_chat_model, modelname_to_contextsize, ) try: from llama_ind...
[ "llama_index.llms.base.llm_chat_callback", "llama_index.llms.base.CompletionResponse", "llama_index.llms.base.ChatResponse", "llama_index.bridge.pydantic.PrivateAttr", "llama_index.llms.base.llm_completion_callback", "llama_index.llms.base.ChatMessage" ]
[((866, 879), 'llama_index.bridge.pydantic.PrivateAttr', 'PrivateAttr', ([], {}), '()\n', (877, 879), False, 'from llama_index.bridge.pydantic import PrivateAttr\n'), ((2779, 2804), 'llama_index.llms.base.llm_completion_callback', 'llm_completion_callback', ([], {}), '()\n', (2802, 2804), False, 'from llama_index.llms....
# Import the required modules from the llama_index library from llama_index import GPTVectorStoreIndex, SimpleDirectoryReader, GPTListIndex # Function to perform a search query on the documents def search(query): # Load the documents from the 'data' directory documents = SimpleDirectoryReader('data').loa...
[ "llama_index.SimpleDirectoryReader", "llama_index.GPTVectorStoreIndex.from_documents" ]
[((427, 472), 'llama_index.GPTVectorStoreIndex.from_documents', 'GPTVectorStoreIndex.from_documents', (['documents'], {}), '(documents)\n', (461, 472), False, 'from llama_index import GPTVectorStoreIndex, SimpleDirectoryReader, GPTListIndex\n'), ((287, 316), 'llama_index.SimpleDirectoryReader', 'SimpleDirectoryReader',...
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.callbacks.CallbackManager", "llama_index.node_parser.SimpleNodeParser.from_defaults", "llama_index.prompts.PromptTemplate" ]
[((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.SimpleDirectoryReader", "llama_index.ServiceContext.from_defaults", "llama_index.tools.ToolMetadata", "llama_index.set_global_service_context", "llama_index.query_engine.SubQuestionQueryEngine.from_defaults", "llama_index.GPTVectorStoreIndex.from_documents" ]
[((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...
from llama_index.schema import Document from llmsherpa.readers import LayoutPDFReader import pandas as pd llmsherpa_api_url = "https://readers.llmsherpa.com/api/document/developer/parseDocument?renderFormat=all" def parse_source_item(item): documents = [] if item['type'] == 'csv': data = pd.read_cs...
[ "llama_index.schema.Document" ]
[((310, 335), 'pandas.read_csv', 'pd.read_csv', (["item['path']"], {}), "(item['path'])\n", (321, 335), True, 'import pandas as pd\n'), ((675, 709), 'llmsherpa.readers.LayoutPDFReader', 'LayoutPDFReader', (['llmsherpa_api_url'], {}), '(llmsherpa_api_url)\n', (690, 709), False, 'from llmsherpa.readers import LayoutPDFRe...
"""Adapted from https://github.com/jerryjliu/llama_index/blob/main/docs/examples/finetuning/embeddings/eval_utils.py""" from llama_index.schema import TextNode from llama_index import ServiceContext, VectorStoreIndex import pandas as pd from tqdm import tqdm def evaluate( dataset, embed_model, top_k=10, ...
[ "llama_index.ServiceContext.from_defaults", "llama_index.schema.TextNode", "llama_index.VectorStoreIndex" ]
[((446, 499), 'llama_index.ServiceContext.from_defaults', 'ServiceContext.from_defaults', ([], {'embed_model': 'embed_model'}), '(embed_model=embed_model)\n', (474, 499), False, 'from llama_index import ServiceContext, VectorStoreIndex\n'), ((587, 663), 'llama_index.VectorStoreIndex', 'VectorStoreIndex', (['nodes'], {'...
from llama_index.core.llms import ChatMessage, MessageRole from llama_index.core.prompts import ChatPromptTemplate chat_text_qa_msgs = [ ChatMessage( role=MessageRole.SYSTEM, content=("""You are an expert Q&A system that is trusted around the world. You are answering texts on Hindu scriptures. Alwa...
[ "llama_index.core.prompts.ChatPromptTemplate", "llama_index.core.llms.ChatMessage" ]
[((1612, 1649), 'llama_index.core.prompts.ChatPromptTemplate', 'ChatPromptTemplate', (['chat_text_qa_msgs'], {}), '(chat_text_qa_msgs)\n', (1630, 1649), False, 'from llama_index.core.prompts import ChatPromptTemplate\n'), ((2678, 2724), 'llama_index.core.prompts.ChatPromptTemplate', 'ChatPromptTemplate', (['training_ch...
import sys sys.stdout.reconfigure(encoding="utf-8") sys.stdin.reconfigure(encoding="utf-8") import streamlit as st import streamlit.components.v1 as components import re import random CODE_BUILD_KG = """ # 准备 GraphStore os.environ['NEBULA_USER'] = "root" os.environ['NEBULA_PASSWORD'] = "nebula" # default passwor...
[ "llama_index.storage.storage_context.StorageContext.from_defaults", "llama_index.LLMPredictor", "llama_index.graph_stores.NebulaGraphStore", "llama_index.ServiceContext.from_defaults", "llama_index.query_engine.KnowledgeGraphQueryEngine", "llama_index.llms.AzureOpenAI" ]
[((12, 52), 'sys.stdout.reconfigure', 'sys.stdout.reconfigure', ([], {'encoding': '"""utf-8"""'}), "(encoding='utf-8')\n", (34, 52), False, 'import sys\n'), ((53, 92), 'sys.stdin.reconfigure', 'sys.stdin.reconfigure', ([], {'encoding': '"""utf-8"""'}), "(encoding='utf-8')\n", (74, 92), False, 'import sys\n'), ((2988, 3...
# wget 'https://raw.githubusercontent.com/run-llama/llama_index/main/docs/examples/data/10q/uber_10q_march_2022.pdf' -O './data/uber_10q_march_2022.pdf' # wget "https://meetings.wmo.int/Cg-19/PublishingImages/SitePages/FINAC-43/7%20-%20EC-77-Doc%205%20Financial%20Statements%20for%202022%20(FINAC).pptx" -O './data/prese...
[ "llama_index.core.VectorStoreIndex.from_documents", "llama_index.core.StorageContext.from_defaults", "llama_index.embeddings.fastembed.FastEmbedEmbedding", "llama_index.vector_stores.qdrant.QdrantVectorStore", "llama_index.llms.groq.Groq" ]
[((378, 398), 'nest_asyncio.apply', 'nest_asyncio.apply', ([], {}), '()\n', (396, 398), False, 'import nest_asyncio\n'), ((466, 479), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (477, 479), False, 'from dotenv import load_dotenv\n'), ((561, 593), 'os.getenv', 'os.getenv', (['"""LLAMA_CLOUD_API_KEY"""'], {}),...
from llama_index.core import ( SimpleDirectoryReader, VectorStoreIndex, set_global_handler ) import phoenix as px px.launch_app() set_global_handler("arize_phoenix") documents = SimpleDirectoryReader('files').load_data() index = VectorStoreIndex.from_documents(documents) qe = index.as_query_engine() res...
[ "llama_index.core.VectorStoreIndex.from_documents", "llama_index.core.SimpleDirectoryReader", "llama_index.core.set_global_handler" ]
[((129, 144), 'phoenix.launch_app', 'px.launch_app', ([], {}), '()\n', (142, 144), True, 'import phoenix as px\n'), ((145, 180), 'llama_index.core.set_global_handler', 'set_global_handler', (['"""arize_phoenix"""'], {}), "('arize_phoenix')\n", (163, 180), False, 'from llama_index.core import SimpleDirectoryReader, Vect...
import os import time import asyncio from dotenv import load_dotenv from backend.eval import( generate_eval_questions ) from backend.llm import get_llm from backend.ingestion import ( load_markdown_docs, create_vector_index_locally ) from backend.eval import ( evaluate_query_engine ) from llama_index...
[ "llama_index.ServiceContext.from_defaults", "llama_index.query_engine.SubQuestionQueryEngine.from_defaults", "llama_index.evaluation.ResponseEvaluator" ]
[((786, 816), 'backend.llm.get_llm', 'get_llm', (['(1)', '"""gpt-3.5-turbo"""', '(0)'], {}), "(1, 'gpt-3.5-turbo', 0)\n", (793, 816), False, 'from backend.llm import get_llm\n'), ((837, 874), 'llama_index.ServiceContext.from_defaults', 'ServiceContext.from_defaults', ([], {'llm': 'llm'}), '(llm=llm)\n', (865, 874), Fal...
import streamlit as st import openai import os.path as op from llama_index import ServiceContext from llama_index import VectorStoreIndex,download_loader from pathlib import Path from llama_index.retrievers import VectorIndexRetriever from llama_index.llms import OpenAI # specify path to CSV file, OPENAI api_key, and...
[ "llama_index.VectorStoreIndex.from_documents", "llama_index.ServiceContext.from_defaults", "llama_index.llms.OpenAI", "llama_index.download_loader" ]
[((389, 409), 'os.path.exists', 'op.exists', (['FILE_PATH'], {}), '(FILE_PATH)\n', (398, 409), True, 'import os.path as op\n'), ((520, 669), 'streamlit.set_page_config', 'st.set_page_config', ([], {'page_title': '"""Chatbot for doctor appointment"""', 'page_icon': '"""🦙"""', 'layout': '"""centered"""', 'initial_sideba...
from llama_index.core import (ServiceContext, SQLDatabase, VectorStoreIndex, set_global_service_context) from llama_index.core.indices.struct_store.sql_query import \ SQLTableRetrieverQueryEngine from llama_index.core.objects import (ObjectIndex, SQLTableNodeMapping, ...
[ "llama_index.core.set_global_service_context", "llama_index.core.objects.SQLTableNodeMapping", "llama_index.core.objects.SQLTableSchema", "llama_index.core.ServiceContext.from_defaults", "llama_index.core.objects.ObjectIndex.from_objects", "llama_index.core.prompts.base.Prompt" ]
[((1002, 1012), 'sqlalchemy.MetaData', 'MetaData', ([], {}), '()\n', (1010, 1012), False, 'from sqlalchemy import MetaData, create_engine\n'), ((1801, 1839), 'llama_index.core.objects.SQLTableNodeMapping', 'SQLTableNodeMapping', (['self.sql_database'], {}), '(self.sql_database)\n', (1820, 1839), False, 'from llama_inde...
import os import time from dotenv import load_dotenv from llama_index.agent import ReActAgent from llama_index.tools import FunctionTool from llama_index.callbacks import LlamaDebugHandler, CallbackManager import subprocess from tools.llm import MYLLM from tools.tools import MYTOOLBOX load_dotenv() debug_mode = Tru...
[ "llama_index.callbacks.CallbackManager", "llama_index.tools.FunctionTool.from_defaults", "llama_index.callbacks.LlamaDebugHandler", "llama_index.agent.ReActAgent.from_tools" ]
[((288, 301), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (299, 301), False, 'from dotenv import load_dotenv\n'), ((336, 384), 'llama_index.callbacks.LlamaDebugHandler', 'LlamaDebugHandler', ([], {'print_trace_on_end': 'debug_mode'}), '(print_trace_on_end=debug_mode)\n', (353, 384), False, 'from llama_index....
from llama_index.core import Settings, Document, VectorStoreIndex from llama_index.core.node_parser import SentenceWindowNodeParser doc = Document( text="Sentence 1. Sentence 2. Sentence 3." ) text_splitter = SentenceWindowNodeParser.from_defaults( window_size=2 , window_metadata_key="ContextWindow", o...
[ "llama_index.core.VectorStoreIndex.from_documents", "llama_index.core.node_parser.SentenceWindowNodeParser.from_defaults", "llama_index.core.Document" ]
[((138, 190), 'llama_index.core.Document', 'Document', ([], {'text': '"""Sentence 1. Sentence 2. Sentence 3."""'}), "(text='Sentence 1. Sentence 2. Sentence 3.')\n", (146, 190), False, 'from llama_index.core import Settings, Document, VectorStoreIndex\n'), ((213, 348), 'llama_index.core.node_parser.SentenceWindowNodePa...
from key1 import KEY from llama_index import GPTVectorStoreIndex, SimpleDirectoryReader from llama_index import download_loader, StorageContext import os import openai os.environ['OPENAI_API_KEY'] = KEY def create_vector(dir): documents = SimpleDirectoryReader("data").load_data() index = GPTVectorStoreInde...
[ "llama_index.SimpleDirectoryReader", "llama_index.GPTVectorStoreIndex.from_documents", "llama_index.StorageContext.from_defaults" ]
[((302, 347), 'llama_index.GPTVectorStoreIndex.from_documents', 'GPTVectorStoreIndex.from_documents', (['documents'], {}), '(documents)\n', (336, 347), False, 'from llama_index import GPTVectorStoreIndex, SimpleDirectoryReader\n'), ((371, 401), 'llama_index.StorageContext.from_defaults', 'StorageContext.from_defaults',...
import asyncio from llama_index.core import KeywordTableIndex from llama_index.core import SimpleDirectoryReader async def retrieve(retriever, query, label): response = await retriever.aretrieve(query) print(f"{label} retrieved {str(len(response))} nodes") async def main(): reader = SimpleDirectoryReader(...
[ "llama_index.core.SimpleDirectoryReader", "llama_index.core.KeywordTableIndex.from_documents" ]
[((298, 328), 'llama_index.core.SimpleDirectoryReader', 'SimpleDirectoryReader', (['"""files"""'], {}), "('files')\n", (319, 328), False, 'from llama_index.core import SimpleDirectoryReader\n'), ((376, 419), 'llama_index.core.KeywordTableIndex.from_documents', 'KeywordTableIndex.from_documents', (['documents'], {}), '(...
import json import logging import streamlit as st import sys import os from dotenv import load_dotenv from llama_index.chat_engine.types import ChatMode from llama_index.llms import ChatMessage from libs.llama_utils import get_llama_memary_index, get_llama_store_index, create_document_index_by_texts, \ create_docum...
[ "llama_index.llms.ChatMessage" ]
[((742, 755), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (753, 755), False, 'from dotenv import load_dotenv\n'), ((719, 740), 'os.path.abspath', 'os.path.abspath', (['""".."""'], {}), "('..')\n", (734, 740), False, 'import os\n'), ((806, 831), 'libs.session.PageSessionState', 'PageSessionState', (['botname'...
"""Common settings for RAG model""" from llama_index.core import Settings from llama_index.llms.openai import OpenAI from llama_index.embeddings.openai import OpenAIEmbedding from app.logger.logger import custom_logger def settings(): """Set the settings for RAG.""" Settings.llm = OpenAI(model="gpt-3.5-turb...
[ "llama_index.llms.openai.OpenAI", "llama_index.embeddings.openai.OpenAIEmbedding" ]
[((294, 345), 'llama_index.llms.openai.OpenAI', 'OpenAI', ([], {'model': '"""gpt-3.5-turbo-1106"""', 'temperature': '(0.0)'}), "(model='gpt-3.5-turbo-1106', temperature=0.0)\n", (300, 345), False, 'from llama_index.llms.openai import OpenAI\n'), ((373, 442), 'llama_index.embeddings.openai.OpenAIEmbedding', 'OpenAIEmbed...
from src._classinits import * from src._errorsinit import * from src._readapitokens import * from src._wikidatasearch import * from llama_index import LLMPredictor,GPTSimpleVectorIndex,PromptHelper,download_loader from llama_index import GPTSimpleKeywordTableIndex,GPTListIndex from llama_index.indices.composabili...
[ "llama_index.download_loader", "llama_index.ServiceContext.from_defaults", "llama_index.GPTSimpleVectorIndex.from_documents", "llama_index.node_parser.SimpleNodeParser", "llama_index.PromptHelper", "llama_index.GPTSimpleVectorIndex.load_from_disk" ]
[((601, 654), 'warnings.filterwarnings', 'filterwarnings', (['"""ignore"""'], {'category': 'DeprecationWarning'}), "('ignore', category=DeprecationWarning)\n", (615, 654), False, 'from warnings import filterwarnings\n'), ((659, 705), 'warnings.filterwarnings', 'filterwarnings', (['"""ignore"""'], {'category': 'UserWarn...
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.VectorStoreIndex.from_documents", "llama_index.core.llms.mock.MockLLM", "llama_index.core.callbacks.CallbackManager", "llama_index.core.SimpleDirectoryReader", "llama_index.core.MockEmbedding" ]
[((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': '...
#!/usr/bin/env python3 ## # Chat with PDF document using OpenAI, LlamaIndex, and Gradio # github.com/deadbits ## import os import sys import logging import argparse import openai import gradio as gr import urllib.request from pathlib import Path from langchain import OpenAI from llama_index import GPTSimpleVectorInd...
[ "llama_index.ServiceContext.from_defaults", "llama_index.GPTSimpleVectorIndex.from_documents", "llama_index.download_loader" ]
[((496, 539), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.CRITICAL'}), '(level=logging.CRITICAL)\n', (515, 539), False, 'import logging\n'), ((797, 825), 'llama_index.download_loader', 'download_loader', (['"""PDFReader"""'], {}), "('PDFReader')\n", (812, 825), False, 'from llama_index import ...
# Import standard libraries import os import re import json import getpass import logging # Import third-party libraries for web scraping, API interactions, and data processing import requests import pandas as pd from bs4 import BeautifulSoup # Import libraries for interacting with OpenAI and other language models im...
[ "llama_index.llms.OpenAI", "llama_index.embeddings.OpenAIEmbedding" ]
[((854, 893), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (873, 893), False, 'import logging\n'), ((990, 1044), 'llama_index.llms.OpenAI', 'OpenAI', ([], {'model': '"""gpt-4"""', 'temperature': '(0.1)', 'max_tokens': '(512)'}), "(model='gpt-4', temperature=0....
import torch from langchain.llms.base import LLM from langchain.embeddings.huggingface import HuggingFaceEmbeddings from llama_index import LangchainEmbedding from llama_index import SimpleDirectoryReader, LLMPredictor, PromptHelper, GPTSimpleVectorIndex from peft import PeftModel from transformers import LlamaTo...
[ "llama_index.GPTSimpleVectorIndex.load_from_disk", "llama_index.GPTSimpleVectorIndex", "llama_index.SimpleDirectoryReader", "llama_index.PromptHelper" ]
[((460, 505), 'transformers.LlamaTokenizer.from_pretrained', 'LlamaTokenizer.from_pretrained', (['hf_model_path'], {}), '(hf_model_path)\n', (490, 505), False, 'from transformers import LlamaTokenizer, LlamaForCausalLM, GenerationConfig\n'), ((517, 606), 'transformers.LlamaForCausalLM.from_pretrained', 'LlamaForCausalL...
import os import sys from random import randrange from typing import List, Union from datetime import date from dotenv import load_dotenv from fastapi import FastAPI, File, Request, UploadFile, Path from fastapi.logger import logger from fastapi.responses import JSONResponse from pyngrok import ngrok import os import ...
[ "llama_index.vector_stores.weaviate.WeaviateVectorStore", "llama_index.core.VectorStoreIndex.from_documents", "llama_index.core.StorageContext.from_defaults", "llama_index.core.Document", "llama_index.llms.clarifai.Clarifai" ]
[((1032, 1052), 'nest_asyncio.apply', 'nest_asyncio.apply', ([], {}), '()\n', (1050, 1052), False, 'import nest_asyncio\n'), ((1109, 1123), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (1121, 1123), False, 'from datetime import datetime, timedelta, timezone\n'), ((1214, 1227), 'dotenv.load_dotenv', 'load_...
from ..launcher.processor_event import ProcessorEvent from ..launcher.event_type import EventType from ...llms.utils.max_token_for_model import max_token_for_model, nb_token_for_input from ...llms.prompt_engine.simple_prompt_engine import SimplePromptEngine from ...llms.prompt_engine.vector_index_prompt_engine import V...
[ "llama_index.llms.base.ChatMessage" ]
[((3084, 3130), 'llama_index.llms.base.ChatMessage', 'ChatMessage', ([], {'role': '"""system"""', 'content': 'system_msg'}), "(role='system', content=system_msg)\n", (3095, 3130), False, 'from llama_index.llms.base import ChatMessage\n'), ((3144, 3194), 'llama_index.llms.base.ChatMessage', 'ChatMessage', ([], {'role': ...
import json from llama_index.core.service_context_elements.llm_predictor import LLMPredictor from llama_index.core.utilities.sql_wrapper import SQLDatabase from llama_index.core.response_synthesizers import get_response_synthesizer from llama_index.embeddings.langchain import LangchainEmbedding from llama_index.core.re...
[ "llama_index.core.prompts.PromptTemplate", "llama_index.core.indices.struct_store.sql_query.NLSQLTableQueryEngine", "llama_index.postprocessor.colbert_rerank.ColbertRerank", "llama_index.core.tools.ToolMetadata", "llama_index.core.query_engine.RetrieverQueryEngine", "llama_index.core.schema.ImageDocument"...
[((3043, 3075), 'app.database.dbc.get_llm_by_name', 'dbc.get_llm_by_name', (['db', 'llmName'], {}), '(db, llmName)\n', (3062, 3075), False, 'from app.database import dbc\n'), ((4079, 4112), 'app.database.dbc.get_project_by_name', 'dbc.get_project_by_name', (['db', 'name'], {}), '(db, name)\n', (4102, 4112), False, 'fro...
from llama_index.embeddings import OpenAIEmbedding from llama_index.llms import OpenAI from llama_index.ingestion import IngestionPipeline from llama_index.extractors import TitleExtractor, SummaryExtractor from llama_index.text_splitter import SentenceSplitter from llama_index.schema import MetadataMode # from langcha...
[ "llama_index.vector_stores.AstraDBVectorStore", "llama_index.llms.Ollama", "llama_index.ServiceContext.from_defaults", "llama_index.llms.OpenAI", "llama_index.llms.LangChainLLM", "llama_index.ingestion.IngestionPipeline", "llama_index.set_global_service_context", "llama_index.extractors.TitleExtractor...
[((1967, 2029), 'llama_index.ServiceContext.from_defaults', 'ServiceContext.from_defaults', ([], {'embed_model': 'embed_model', 'llm': 'llm'}), '(embed_model=embed_model, llm=llm)\n', (1995, 2029), False, 'from llama_index import ServiceContext\n'), ((2034, 2077), 'llama_index.set_global_service_context', 'set_global_s...
# # Graph Database Ingester For 5e SRD Content # import dotenv dotenv.load_dotenv() import json from llama_index.core import Document, KnowledgeGraphIndex, StorageContext, VectorStoreIndex, load_index_from_storage, load_graph_from_storage from llama_index.core.extractors import TitleExtractor, QuestionsAnsweredExtract...
[ "llama_index.core.KnowledgeGraphIndex.build_index_from_nodes", "llama_index.core.StorageContext.from_defaults", "llama_index.core.extractors.QuestionsAnsweredExtractor", "llama_index.core.ingestion.IngestionPipeline", "llama_index.core.load_graph_from_storage", "llama_index.core.Document", "llama_index....
[((63, 83), 'dotenv.load_dotenv', 'dotenv.load_dotenv', ([], {}), '()\n', (81, 83), False, 'import dotenv\n'), ((1601, 1652), 'src.file_utils.createOutputFile', 'createOutputFile', (['"""./kg-output"""', '"""srd-graph-result"""'], {}), "('./kg-output', 'srd-graph-result')\n", (1617, 1652), False, 'from src.file_utils i...
import streamlit as st from llama_index.core import VectorStoreIndex, StorageContext from llama_index.core.agent import ReActAgent, AgentRunner, ReActChatFormatter from llama_index.core.retrievers import AutoMergingRetriever from llama_index.llms.openai import OpenAI from llama_index.core.tools import FunctionTool fro...
[ "llama_index.llms.openai.OpenAI", "llama_index.core.VectorStoreIndex.from_vector_store", "llama_index.core.StorageContext.from_defaults", "llama_index.core.agent.ReActChatFormatter.from_defaults", "llama_index.core.retrievers.AutoMergingRetriever", "llama_index.core.tools.FunctionTool.from_defaults", "l...
[((1003, 1065), 'llama_index.llms.openai.OpenAI', 'OpenAI', ([], {'model': 'HYDE_LLM_MODEL', 'temperature': 'HYDE_LLM_TEMPERATURE'}), '(model=HYDE_LLM_MODEL, temperature=HYDE_LLM_TEMPERATURE)\n', (1009, 1065), False, 'from llama_index.llms.openai import OpenAI\n'), ((1127, 1163), 'rag.weaviate_utils.get_weaviate_client...
""" Module for setting up a Streamlit application that searches and summarizes content from the Huberman Lab Podcast. Uses llama_index for data indexing and retrieval, and OpenAI for text embedding and generation. """ import streamlit as st import openai from llama_index.core import ( StorageContext, load_inde...
[ "llama_index.llms.openai.OpenAI", "llama_index.core.retrievers.VectorIndexRetriever", "llama_index.core.StorageContext.from_defaults", "llama_index.core.load_index_from_storage", "llama_index.core.get_response_synthesizer", "llama_index.core.postprocessor.SimilarityPostprocessor", "llama_index.embedding...
[((712, 838), 'streamlit.set_page_config', 'st.set_page_config', ([], {'page_title': '"""TLDHubeR"""', 'page_icon': '"""🧠"""', 'layout': '"""centered"""', 'initial_sidebar_state': '"""auto"""', 'menu_items': 'None'}), "(page_title='TLDHubeR', page_icon='🧠', layout='centered',\n initial_sidebar_state='auto', menu_i...
#! coding: utf-8 import os from typing import List from llama_index import ServiceContext, StorageContext, VectorStoreIndex, SimpleDirectoryReader, TreeIndex from llama_index.node_parser import SimpleNodeParser from llama_index.schema import BaseNode from llama_index.text_splitter import SentenceSplitter from build...
[ "llama_index.text_splitter.SentenceSplitter", "llama_index.StorageContext.from_defaults" ]
[((482, 504), 'common.llm.create_llm', 'create_llm', ([], {'timeout': '(60)'}), '(timeout=60)\n', (492, 504), False, 'from common.llm import create_llm\n'), ((1072, 1098), 'os.path.exists', 'os.path.exists', (['index_file'], {}), '(index_file)\n', (1086, 1098), False, 'import os\n'), ((1172, 1202), 'llama_index.Storage...
from llama_index.chat_engine.types import StreamingAgentChatResponse import streamlit as st from llama_index import SimpleDirectoryReader, VectorStoreIndex # TODO: this is caching the resource globally, not per-session # Each user session should have their own index @st.cache_resource(show_spinner="Indexing documents...
[ "llama_index.VectorStoreIndex.from_documents", "llama_index.SimpleDirectoryReader" ]
[((270, 325), 'streamlit.cache_resource', 'st.cache_resource', ([], {'show_spinner': '"""Indexing documents..."""'}), "(show_spinner='Indexing documents...')\n", (287, 325), True, 'import streamlit as st\n'), ((430, 472), 'llama_index.VectorStoreIndex.from_documents', 'VectorStoreIndex.from_documents', (['documents'], ...
from pathlib import Path from typing import Dict, Iterator, List, cast from llama_index import ServiceContext, StorageContext from llama_index.embeddings.cohereai import CohereEmbedding from llama_index.indices.loading import load_index_from_storage from llama_index.indices.vector_store import VectorStoreIndex from ll...
[ "llama_index.embeddings.cohereai.CohereEmbedding", "llama_index.response_synthesizers.get_response_synthesizer", "llama_index.ServiceContext.from_defaults", "llama_index.llms.OpenAI", "llama_index.llms.ChatMessage", "llama_index.node_parser.SimpleNodeParser.from_defaults" ]
[((801, 869), 'pydantic.Field', 'Field', ([], {'description': '"""The question to ask the parental leave statute."""'}), "(description='The question to ask the parental leave statute.')\n", (806, 869), False, 'from pydantic import BaseModel, Field\n'), ((971, 998), 'pydantic.Field', 'Field', ([], {'default_factory': 'd...
import chromadb from chromadb.config import Settings from llama_index.vector_stores import ChromaVectorStore from llama_index import VectorStoreIndex, SimpleDirectoryReader, ServiceContext from langchain.embeddings.huggingface import HuggingFaceEmbeddings from llama_index.embeddings import LangchainEmbedding from...
[ "llama_index.ServiceContext.from_defaults", "llama_index.VectorStoreIndex.from_vector_store", "llama_index.vector_stores.ChromaVectorStore" ]
[((384, 421), 'chromadb.PersistentClient', 'chromadb.PersistentClient', (['"""src/data"""'], {}), "('src/data')\n", (409, 421), False, 'import chromadb\n'), ((608, 661), 'llama_index.ServiceContext.from_defaults', 'ServiceContext.from_defaults', ([], {'embed_model': 'embed_model'}), '(embed_model=embed_model)\n', (636,...
import os import requests from dotenv import load_dotenv from llama_index import SimpleDirectoryReader, StorageContext, VectorStoreIndex, load_index_from_storage from pathlib import Path import helper.data as dhelp load_dotenv() LOCAL_FILE_NAME = 'data/TR-61850.pdf' INDEX_STORAGE_DIR = './storage' def build_inde...
[ "llama_index.VectorStoreIndex.from_documents", "llama_index.load_index_from_storage", "llama_index.SimpleDirectoryReader", "llama_index.StorageContext.from_defaults" ]
[((219, 232), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (230, 232), False, 'from dotenv import load_dotenv\n'), ((531, 590), 'helper.data.get_service_context', 'dhelp.get_service_context', ([], {'chunk_size': '(512)', 'chunk_overlap': '(75)'}), '(chunk_size=512, chunk_overlap=75)\n', (556, 590), True, 'imp...
from approaches.index.store.cosmos_index_store import CosmosIndexStore from llama_index import StorageContext from approaches.index.store.cosmos_doc_store import CosmosDocumentStore from llama_index import load_index_from_storage import os import openai from langchain.chat_models import AzureChatOpenAI from langchain....
[ "llama_index.indices.knowledge_graph.base.GPTKnowledgeGraphIndex", "llama_index.langchain_helpers.text_splitter.TokenTextSplitter", "llama_index.LLMPredictor", "llama_index.ServiceContext.from_defaults", "llama_index.StorageContext.from_defaults", "llama_index.load_index_from_storage", "llama_index.Docu...
[((832, 845), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (843, 845), False, 'from dotenv import load_dotenv\n'), ((1039, 1074), 'os.environ.get', 'os.environ.get', (['"""AZURE_OPENAI_BASE"""'], {}), "('AZURE_OPENAI_BASE')\n", (1053, 1074), False, 'import os\n'), ((1098, 1153), 'os.environ.get', 'os.environ....
""" Chat with transcripts stored by Llamaindex in Weaviate Cloud """ import openai import streamlit as st import weaviate from llama_index import ServiceContext from llama_index import VectorStoreIndex from llama_index.llms import OpenAI from llama_index.vector_stores import WeaviateVectorStore st.set_page_config( ...
[ "llama_index.VectorStoreIndex.from_vector_store", "llama_index.llms.OpenAI", "llama_index.vector_stores.WeaviateVectorStore" ]
[((297, 443), 'streamlit.set_page_config', 'st.set_page_config', ([], {'page_title': '"""Chat with my Youtube Channel"""', 'page_icon': '"""🦙"""', 'layout': '"""centered"""', 'initial_sidebar_state': '"""auto"""', 'menu_items': 'None'}), "(page_title='Chat with my Youtube Channel', page_icon='🦙',\n layout='centere...
# Debug stuff import os import readline print("Current Working Directory:", os.getcwd()) #env_var = os.getenv('OPENAI_API_KEY') #print(env_var) # Sets llama-index import logging import sys logging.basicConfig(stream=sys.stdout, level=logging.DEBUG) logging.getLogger().addHandler(logging.StreamHandler(stream=sys.stdou...
[ "llama_index.VectorStoreIndex.from_documents", "llama_index.SimpleDirectoryReader" ]
[((191, 250), 'logging.basicConfig', 'logging.basicConfig', ([], {'stream': 'sys.stdout', 'level': 'logging.DEBUG'}), '(stream=sys.stdout, level=logging.DEBUG)\n', (210, 250), False, 'import logging\n'), ((459, 501), 'llama_index.VectorStoreIndex.from_documents', 'VectorStoreIndex.from_documents', (['documents'], {}), ...
import base64 import nest_asyncio import streamlit as st from llama_index import (LLMPredictor, ServiceContext, StorageContext, load_index_from_storage, set_global_service_context) from llama_index.llms import LlamaCPP from llama_index.memory import ChatMemoryBuffer nest_asyncio.apply() # ht...
[ "llama_index.memory.ChatMemoryBuffer.from_defaults", "llama_index.LLMPredictor", "llama_index.ServiceContext.from_defaults", "llama_index.llms.LlamaCPP", "llama_index.StorageContext.from_defaults", "llama_index.set_global_service_context", "llama_index.load_index_from_storage" ]
[((293, 313), 'nest_asyncio.apply', 'nest_asyncio.apply', ([], {}), '()\n', (311, 313), False, 'import nest_asyncio\n'), ((679, 751), 'streamlit.set_page_config', 'st.set_page_config', ([], {'page_title': '"""UTPL Chat"""', 'page_icon': '"""🤖"""', 'layout': '"""wide"""'}), "(page_title='UTPL Chat', page_icon='🤖', lay...
import streamlit as st import os import sys import logging from llama_index import TreeIndex, SimpleDirectoryReader, StorageContext, get_response_synthesizer, load_index_from_storage, ServiceContext from llama_index.llms import OpenAI, ChatMessage from llama_index.query_engine import RetrieverQueryEngine from llama_ind...
[ "llama_index.SimpleDirectoryReader", "llama_index.text_splitter.CodeSplitter", "llama_index.ServiceContext.from_defaults", "llama_index.TreeIndex.from_documents", "llama_index.llms.OpenAI", "llama_index.StorageContext.from_defaults", "llama_index.llms.ChatMessage", "llama_index.node_parser.SimpleNodeP...
[((457, 477), 'nest_asyncio.apply', 'nest_asyncio.apply', ([], {}), '()\n', (475, 477), False, 'import nest_asyncio\n'), ((478, 536), 'logging.basicConfig', 'logging.basicConfig', ([], {'stream': 'sys.stdout', 'level': 'logging.INFO'}), '(stream=sys.stdout, level=logging.INFO)\n', (497, 536), False, 'import logging\n')...
import sounddevice as sd import wavio import whisper from llama_index.llms import LlamaCPP from llama_index.llms.base import ChatMessage import streamlit as st # Function to record audio def record_audio(output_filename, duration, sample_rate): st.write("Recording...") audio_data = sd.rec(int(duratio...
[ "llama_index.llms.LlamaCPP", "llama_index.llms.base.ChatMessage" ]
[((259, 283), 'streamlit.write', 'st.write', (['"""Recording..."""'], {}), "('Recording...')\n", (267, 283), True, 'import streamlit as st\n'), ((404, 413), 'sounddevice.wait', 'sd.wait', ([], {}), '()\n', (411, 413), True, 'import sounddevice as sd\n'), ((455, 486), 'streamlit.write', 'st.write', (['"""Recording finis...
import os import sys import shutil import openai from dotenv import load_dotenv load_dotenv() openai.api_key = os.getenv("OPENAI_API_KEY") os.environ["OPENAI_API_KEY"] = os.getenv("OPENAI_API_KEY") import langchain from llama_index import StorageContext, load_index_from_storage from llama_index import ( VectorStore...
[ "llama_index.SimpleDirectoryReader", "llama_index.get_response_synthesizer", "llama_index.retrievers.VectorIndexRetriever", "llama_index.StorageContext.from_defaults", "llama_index.indices.postprocessor.SimilarityPostprocessor", "llama_index.load_index_from_storage" ]
[((80, 93), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (91, 93), False, 'from dotenv import load_dotenv\n'), ((111, 138), 'os.getenv', 'os.getenv', (['"""OPENAI_API_KEY"""'], {}), "('OPENAI_API_KEY')\n", (120, 138), False, 'import os\n'), ((170, 197), 'os.getenv', 'os.getenv', (['"""OPENAI_API_KEY"""'], {})...
import logging import os from typing import List from decouple import config from langchain import OpenAI from llama_index import GPTSimpleVectorIndex, LLMPredictor, PromptHelper from llama_index.response.schema import Response, SourceNode from pydantic import BaseModel from data_provider import LlamaDataProvider, Lo...
[ "llama_index.GPTSimpleVectorIndex", "llama_index.PromptHelper" ]
[((384, 408), 'decouple.config', 'config', (['"""OPENAI_API_KEY"""'], {}), "('OPENAI_API_KEY')\n", (390, 408), False, 'from decouple import config\n'), ((699, 797), 'llama_index.PromptHelper', 'PromptHelper', (['max_input_size', 'num_output', 'max_chunk_overlap'], {'chunk_size_limit': 'chunk_size_limit'}), '(max_input_...
import os import json from urllib.parse import urlparse import streamlit as st from scrape_utils import scrape from llama_index import download_loader, GPTSimpleVectorIndex, SimpleDirectoryReader, ServiceContext, LLMPredictor, PromptHelper from llama_index.llm_predictor.chatgpt import ChatGPTLLMPredictor from llama_ind...
[ "llama_index.download_loader", "llama_index.GPTSimpleVectorIndex.load_from_disk", "llama_index.ServiceContext.from_defaults", "llama_index.node_parser.SimpleNodeParser", "llama_index.PromptHelper", "llama_index.GPTSimpleVectorIndex", "llama_index.langchain_helpers.memory_wrapper.GPTIndexChatMemory" ]
[((4729, 4759), 'streamlit.header', 'st.header', (['"""LearnWithGPT Demo"""'], {}), "('LearnWithGPT Demo')\n", (4738, 4759), True, 'import streamlit as st\n'), ((4809, 4856), 'streamlit.text_area', 'st.text_area', (['"""Enter a URL to scrape and index"""'], {}), "('Enter a URL to scrape and index')\n", (4821, 4856), Tr...
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.settings.llm_from_settings_or_context", "llama_index.core.settings.callback_manager_from_settings_or_context", "llama_index.core.response_synthesizers.get_response_synthesizer" ]
[((4987, 5055), 'llama_index.core.settings.callback_manager_from_settings_or_context', 'callback_manager_from_settings_or_context', (['Settings', 'service_context'], {}), '(Settings, service_context)\n', (5028, 5055), False, 'from llama_index.core.settings import Settings, callback_manager_from_settings_or_context, llm...
import os from starlette.concurrency import run_in_threadpool import google.generativeai as genai from llama_index.llms.gemini import Gemini from llama_index.embeddings import GooglePaLMEmbedding from gateway_llms.app.utils.logs import LogApplication, log_function GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY") genai....
[ "llama_index.embeddings.GooglePaLMEmbedding", "llama_index.llms.gemini.Gemini" ]
[((285, 312), 'os.getenv', 'os.getenv', (['"""GOOGLE_API_KEY"""'], {}), "('GOOGLE_API_KEY')\n", (294, 312), False, 'import os\n'), ((314, 353), 'google.generativeai.configure', 'genai.configure', ([], {'api_key': 'GOOGLE_API_KEY'}), '(api_key=GOOGLE_API_KEY)\n', (329, 353), True, 'import google.generativeai as genai\n'...