Dataset Viewer
Auto-converted to Parquet Duplicate
code
stringlengths
141
97.3k
apis
sequencelengths
1
24
extract_api
stringlengths
113
214k
"""FastAPI app creation, logger configuration and main API routes.""" import logging from fastapi import Depends, FastAPI, Request from fastapi.middleware.cors import CORSMiddleware from injector import Injector from llama_index.core.callbacks import CallbackManager from llama_index.core.callbacks.global_handlers imp...
[ "llama_index.core.callbacks.CallbackManager", "llama_index.core.callbacks.global_handlers.create_global_handler" ]
[((894, 921), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (911, 921), False, 'import logging\n'), ((1479, 1510), 'llama_index.core.callbacks.global_handlers.create_global_handler', 'create_global_handler', (['"""simple"""'], {}), "('simple')\n", (1500, 1510), False, 'from llama_index.c...
import json import os from typing import Dict, List, Optional, Type from loguru import logger from datastore.datastore import DataStore from models.models import ( DocumentChunk, DocumentChunkMetadata, DocumentChunkWithScore, DocumentMetadataFilter, Query, QueryResult, QueryWithEmbedding, ) ...
[ "llama_index.data_structs.struct_type.IndexStructType", "llama_index.indices.query.schema.QueryBundle" ]
[((860, 929), 'os.environ.get', 'os.environ.get', (['"""LLAMA_INDEX_TYPE"""', 'IndexStructType.SIMPLE_DICT.value'], {}), "('LLAMA_INDEX_TYPE', IndexStructType.SIMPLE_DICT.value)\n", (874, 929), False, 'import os\n'), ((954, 999), 'os.environ.get', 'os.environ.get', (['"""LLAMA_INDEX_JSON_PATH"""', 'None'], {}), "('LLAM...
import os import weaviate from llama_index.storage.storage_context import StorageContext from llama_index.vector_stores import WeaviateVectorStore from llama_index.query_engine.retriever_query_engine import RetrieverQueryEngine from llama_index.callbacks.base import CallbackManager from llama_index import ( LLMPr...
[ "llama_index.llms.LocalAI", "llama_index.LLMPredictor", "llama_index.StorageContext.from_defaults", "llama_index.VectorStoreIndex.from_vector_store", "llama_index.embeddings.HuggingFaceEmbedding", "llama_index.vector_stores.WeaviateVectorStore" ]
[((1360, 1409), 'llama_index.embeddings.HuggingFaceEmbedding', 'HuggingFaceEmbedding', ([], {'model_name': 'embed_model_name'}), '(model_name=embed_model_name)\n', (1380, 1409), False, 'from llama_index.embeddings import HuggingFaceEmbedding\n'), ((1418, 1534), 'llama_index.llms.LocalAI', 'LocalAI', ([], {'temperature'...
import typer import uuid from typing import Optional, List, Any import os import numpy as np from memgpt.utils import is_valid_url, printd from memgpt.data_types import EmbeddingConfig from memgpt.credentials import MemGPTCredentials from memgpt.constants import MAX_EMBEDDING_DIM, EMBEDDING_TO_TOKENIZER_MAP, EMBEDDING...
[ "llama_index.core.node_parser.SentenceSplitter", "llama_index.embeddings.huggingface.HuggingFaceEmbedding", "llama_index.embeddings.azure_openai.AzureOpenAIEmbedding", "llama_index.core.Document", "llama_index.embeddings.openai.OpenAIEmbedding" ]
[((981, 1020), 'llama_index.core.node_parser.SentenceSplitter', 'SentenceSplitter', ([], {'chunk_size': 'chunk_size'}), '(chunk_size=chunk_size)\n', (997, 1020), False, 'from llama_index.core.node_parser import SentenceSplitter\n'), ((5381, 5419), 'llama_index.embeddings.huggingface.HuggingFaceEmbedding', 'HuggingFaceE...
import logging import os from typing import Optional from typing import Type import openai from langchain.chat_models import ChatOpenAI from llama_index import VectorStoreIndex, LLMPredictor, ServiceContext from llama_index.vector_stores.types import ExactMatchFilter, MetadataFilters from pydantic import BaseModel, Fi...
[ "llama_index.VectorStoreIndex.from_vector_store", "llama_index.ServiceContext.from_defaults" ]
[((754, 816), 'pydantic.Field', 'Field', (['...'], {'description': '"""the search query to search resources"""'}), "(..., description='the search query to search resources')\n", (759, 816), False, 'from pydantic import BaseModel, Field\n'), ((1840, 1905), 'llama_index.ServiceContext.from_defaults', 'ServiceContext.from...
''' Below helper functions are implemented in this script: build_sentence_window_index - VectorStore Index for Sentence window RAG technique get_sentence_window_query_engine - query enginer for the above index build_automerging_index - VectorStore Index for Auto-merging RAG technique get_automerging_query_engine - que...
[ "llama_index.VectorStoreIndex.from_documents", "llama_index.retrievers.AutoMergingRetriever", "llama_index.node_parser.get_leaf_nodes", "llama_index.ServiceContext.from_defaults", "llama_index.StorageContext.from_defaults", "llama_index.node_parser.SentenceWindowNodeParser.from_defaults", "llama_index.V...
[((1446, 1596), 'llama_index.node_parser.SentenceWindowNodeParser.from_defaults', 'SentenceWindowNodeParser.from_defaults', ([], {'window_size': 'sentence_window_size', 'window_metadata_key': '"""window"""', 'original_text_metadata_key': '"""original_text"""'}), "(window_size=sentence_window_size,\n window_metadata_...
from typing import Callable, List def split_text_keep_separator(text: str, separator: str) -> List[str]: """Split text with separator and keep the separator at the end of each split.""" parts = text.split(separator) result = [separator + s if i > 0 else s for i, s in enumerate(parts)] return [s for s ...
[ "llama_index.utils.get_cache_dir" ]
[((876, 891), 'llama_index.utils.get_cache_dir', 'get_cache_dir', ([], {}), '()\n', (889, 891), False, 'from llama_index.utils import get_cache_dir\n'), ((912, 950), 'os.environ.get', 'os.environ.get', (['"""NLTK_DATA"""', 'cache_dir'], {}), "('NLTK_DATA', cache_dir)\n", (926, 950), False, 'import os\n'), ((1252, 1290)...
# # Copyright 2016 The BigDL Authors. # # 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.core.node_parser.SentenceSplitter", "llama_index.embeddings.huggingface.HuggingFaceEmbedding", "llama_index.readers.file.PyMuPDFReader", "llama_index.core.schema.TextNode", "llama_index.vector_stores.postgres.PGVectorStore.from_params", "llama_index.core.query_engine.RetrieverQueryEngine.from...
[((1521, 1612), 'psycopg2.connect', 'psycopg2.connect', ([], {'dbname': '"""postgres"""', 'host': 'host', 'password': 'password', 'port': 'port', 'user': 'user'}), "(dbname='postgres', host=host, password=password, port=port,\n user=user)\n", (1537, 1612), False, 'import psycopg2\n'), ((1841, 1982), 'llama_index.vec...
import os import logging import hashlib import random import uuid import openai from pathlib import Path from llama_index import ServiceContext, GPTVectorStoreIndex, LLMPredictor, RssReader, SimpleDirectoryReader, StorageContext, load_index_from_storage from llama_index.readers.schema.base import Document from langcha...
[ "llama_index.GPTVectorStoreIndex.from_documents", "llama_index.ServiceContext.from_defaults", "llama_index.readers.schema.base.Document", "llama_index.StorageContext.from_defaults", "llama_index.SimpleDirectoryReader", "llama_index.RssReader", "llama_index.load_index_from_storage" ]
[((795, 827), 'os.environ.get', 'os.environ.get', (['"""OPENAI_API_KEY"""'], {}), "('OPENAI_API_KEY')\n", (809, 827), False, 'import os\n'), ((841, 869), 'os.environ.get', 'os.environ.get', (['"""SPEECH_KEY"""'], {}), "('SPEECH_KEY')\n", (855, 869), False, 'import os\n'), ((886, 917), 'os.environ.get', 'os.environ.get'...
"""Configuration.""" import streamlit as st import os ### DEFINE BUILDER_LLM ##### ## Uncomment the LLM you want to use to construct the meta agent ## OpenAI from llama_index.llms import OpenAI # set OpenAI Key - use Streamlit secrets os.environ["OPENAI_API_KEY"] = st.secrets.openai_key # load LLM BUILDER_LLM = Open...
[ "llama_index.llms.OpenAI" ]
[((316, 350), 'llama_index.llms.OpenAI', 'OpenAI', ([], {'model': '"""gpt-4-1106-preview"""'}), "(model='gpt-4-1106-preview')\n", (322, 350), False, 'from llama_index.llms import OpenAI\n')]
from memgpt.data_types import Passage, Document, EmbeddingConfig, Source from memgpt.utils import create_uuid_from_string from memgpt.agent_store.storage import StorageConnector, TableType from memgpt.embeddings import embedding_model from memgpt.data_types import Document, Passage from typing import List, Iterator, D...
[ "llama_index.readers.web.SimpleWebPageReader", "llama_index.core.node_parser.TokenTextSplitter", "llama_index.core.Document" ]
[((1472, 1505), 'memgpt.embeddings.embedding_model', 'embedding_model', (['embedding_config'], {}), '(embedding_config)\n', (1487, 1505), False, 'from memgpt.embeddings import embedding_model\n'), ((5412, 5452), 'llama_index.core.node_parser.TokenTextSplitter', 'TokenTextSplitter', ([], {'chunk_size': 'chunk_size'}), '...
from typing import Dict, List, Type from llama_index.agent import OpenAIAgent, ReActAgent from llama_index.agent.types import BaseAgent from llama_index.llms import Anthropic, OpenAI from llama_index.llms.llama_utils import messages_to_prompt from llama_index.llms.llm import LLM from llama_index.llms.replicate import ...
[ "llama_index.llms.OpenAI", "llama_index.llms.Anthropic", "llama_index.llms.replicate.Replicate" ]
[((1116, 1135), 'llama_index.llms.OpenAI', 'OpenAI', ([], {'model': 'model'}), '(model=model)\n', (1122, 1135), False, 'from llama_index.llms import Anthropic, OpenAI\n'), ((1186, 1208), 'llama_index.llms.Anthropic', 'Anthropic', ([], {'model': 'model'}), '(model=model)\n', (1195, 1208), False, 'from llama_index.llms i...
import asyncio import os import shutil from argparse import ArgumentParser from glob import iglob from pathlib import Path from typing import Any, Callable, Dict, Optional, Union, cast from llama_index.core import ( SimpleDirectoryReader, VectorStoreIndex, ) from llama_index.core.base.embeddings.base import Ba...
[ "llama_index.core.query_pipeline.query.QueryPipeline", "llama_index.core.utils.get_cache_dir", "llama_index.core.response_synthesizers.CompactAndRefine", "llama_index.core.query_pipeline.components.function.FnComponent", "llama_index.core.bridge.pydantic.Field", "llama_index.core.VectorStoreIndex.from_vec...
[((1789, 1840), 'llama_index.core.bridge.pydantic.Field', 'Field', ([], {'description': '"""Query Pipeline to use for Q&A."""'}), "(description='Query Pipeline to use for Q&A.')\n", (1794, 1840), False, 'from llama_index.core.bridge.pydantic import BaseModel, Field, validator\n'), ((2284, 2349), 'llama_index.core.bridg...
from dataclasses import dataclass from typing import TYPE_CHECKING, Any, Callable, List, Optional if TYPE_CHECKING: from llama_index.core.service_context import ServiceContext from llama_index.core.base.embeddings.base import BaseEmbedding from llama_index.core.callbacks.base import BaseCallbackHandler, Callback...
[ "llama_index.core.embeddings.utils.resolve_embed_model", "llama_index.core.node_parser.SentenceSplitter", "llama_index.core.callbacks.base.CallbackManager", "llama_index.core.set_global_handler", "llama_index.core.indices.prompt_helper.PromptHelper.from_llm_metadata", "llama_index.core.utils.get_tokenizer...
[((1701, 1717), 'llama_index.core.llms.utils.resolve_llm', 'resolve_llm', (['llm'], {}), '(llm)\n', (1712, 1717), False, 'from llama_index.core.llms.utils import LLMType, resolve_llm\n'), ((2647, 2679), 'llama_index.core.embeddings.utils.resolve_embed_model', 'resolve_embed_model', (['embed_model'], {}), '(embed_model)...
import asyncio from llama_index.core.llama_dataset import download_llama_dataset from llama_index.core.llama_pack import download_llama_pack from llama_index.core import VectorStoreIndex async def main(): # DOWNLOAD LLAMADATASET rag_dataset, documents = download_llama_dataset("CovidQaDataset", "./data") ...
[ "llama_index.core.llama_dataset.download_llama_dataset", "llama_index.core.llama_pack.download_llama_pack", "llama_index.core.VectorStoreIndex.from_documents" ]
[((265, 315), 'llama_index.core.llama_dataset.download_llama_dataset', 'download_llama_dataset', (['"""CovidQaDataset"""', '"""./data"""'], {}), "('CovidQaDataset', './data')\n", (287, 315), False, 'from llama_index.core.llama_dataset import download_llama_dataset\n'), ((360, 412), 'llama_index.core.VectorStoreIndex.fr...
from enum import Enum from typing import Any, AsyncGenerator, Generator, Optional, Union, List from llama_index.core.bridge.pydantic import BaseModel, Field from llama_index.core.constants import DEFAULT_CONTEXT_WINDOW, DEFAULT_NUM_OUTPUTS class MessageRole(str, Enum): """Message role.""" SYSTEM = "system" ...
[ "llama_index.core.bridge.pydantic.Field" ]
[((655, 682), 'llama_index.core.bridge.pydantic.Field', 'Field', ([], {'default_factory': 'dict'}), '(default_factory=dict)\n', (660, 682), False, 'from llama_index.core.bridge.pydantic import BaseModel, Field\n'), ((1146, 1172), 'llama_index.core.bridge.pydantic.Field', 'Field', ([], {'default_factory': 'str'}), '(def...
"""Base agent type.""" import uuid from abc import abstractmethod from typing import Any, Dict, List, Optional from llama_index.core.base.base_query_engine import BaseQueryEngine from llama_index.core.base.llms.types import ChatMessage from llama_index.core.base.response.schema import RESPONSE_TYPE, Response from lla...
[ "llama_index.core.bridge.pydantic.Field", "llama_index.core.callbacks.trace_method" ]
[((1275, 1296), 'llama_index.core.callbacks.trace_method', 'trace_method', (['"""query"""'], {}), "('query')\n", (1287, 1296), False, 'from llama_index.core.callbacks import CallbackManager, trace_method\n'), ((1598, 1619), 'llama_index.core.callbacks.trace_method', 'trace_method', (['"""query"""'], {}), "('query')\n",...
import json from abc import abstractmethod from dataclasses import dataclass from typing import TYPE_CHECKING, Any, Dict, Optional, Type if TYPE_CHECKING: from llama_index.core.bridge.langchain import StructuredTool, Tool from deprecated import deprecated from llama_index.core.bridge.pydantic import BaseModel cl...
[ "llama_index.core.bridge.langchain.Tool.from_function", "llama_index.core.bridge.langchain.StructuredTool.from_function" ]
[((1581, 1670), 'deprecated.deprecated', 'deprecated', (['"""Deprecated in favor of `to_openai_tool`, which should be used instead."""'], {}), "(\n 'Deprecated in favor of `to_openai_tool`, which should be used instead.')\n", (1591, 1670), False, 'from deprecated import deprecated\n'), ((1395, 1417), 'json.dumps', '...
"""Generate SQL queries using LlamaIndex.""" import argparse import json import logging import os import re from typing import Any, cast from llama_index import LLMPredictor, SQLDatabase from llama_index.indices import SQLStructStoreIndex from llama_index.llms.openai import OpenAI from sqlalchemy import create_engine,...
[ "llama_index.LLMPredictor", "llama_index.SQLDatabase", "llama_index.indices.SQLStructStoreIndex.from_documents", "llama_index.llms.openai.OpenAI" ]
[((413, 431), 're.compile', 're.compile', (['"""\\\\s+"""'], {}), "('\\\\s+')\n", (423, 431), False, 'import re\n'), ((444, 462), 're.compile', 're.compile', (['"""\\\\n+"""'], {}), "('\\\\n+')\n", (454, 462), False, 'import re\n'), ((1926, 2003), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description...
"""Utilities for Spider module.""" import json import os from typing import Dict, Tuple from llama_index import LLMPredictor, SQLDatabase from llama_index.indices import SQLStructStoreIndex from llama_index.llms.openai import OpenAI from sqlalchemy import create_engine, text def load_examples(spider_dir: str) -> Tu...
[ "llama_index.indices.SQLStructStoreIndex", "llama_index.SQLDatabase", "llama_index.LLMPredictor" ]
[((1447, 1468), 'llama_index.LLMPredictor', 'LLMPredictor', ([], {'llm': 'llm'}), '(llm=llm)\n', (1459, 1468), False, 'from llama_index import LLMPredictor, SQLDatabase\n'), ((452, 464), 'json.load', 'json.load', (['f'], {}), '(f)\n', (461, 464), False, 'import json\n'), ((555, 567), 'json.load', 'json.load', (['f'], {...
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
19