prompt
stringlengths
70
19.8k
completion
stringlengths
8
1.03k
api
stringlengths
23
93
get_ipython().run_line_magic('pip', 'install llama-index-llms-openai') get_ipython().system('pip install llama-index') qa_prompt_str = ( "Context information is below.\n" "---------------------\n" "{context_str}\n" "---------------------\n" "Given the context information and not prior knowledge...
ChatMessage(role=MessageRole.USER, content=refine_prompt_str)
llama_index.core.llms.ChatMessage
get_ipython().run_line_magic('pip', 'install llama-index-llms-openllm') get_ipython().system('pip install "openllm" # use \'openllm[vllm]\' if you have access to GPU') get_ipython().system('pip install llama-index') import os from typing import List, Optional from llama_index.llms.openllm import OpenLLM, Open...
OpenLLMAPI(address="http://localhost:3000")
llama_index.llms.openllm.OpenLLMAPI
get_ipython().run_line_magic('pip', 'install llama-index-vector-stores-weaviate') get_ipython().run_line_magic('pip', 'install llama-index-embeddings-huggingface') get_ipython().system('pip install llama-index') from llama_index.core.ingestion.cache import RedisCache from llama_index.core.ingestion import Ingesti...
RedisCache.from_host_and_port(host="127.0.0.1", port=6379)
llama_index.core.ingestion.cache.RedisCache.from_host_and_port
get_ipython().run_line_magic('pip', 'install llama-index-llms-openai') get_ipython().system('pip install llama-index') from llama_index.core import PromptTemplate text_qa_template_str = ( "Context information is" " below.\n---------------------\n{context_str}\n---------------------\nUsing" " both the ...
OpenAI(model="gpt-3.5-turbo")
llama_index.llms.openai.OpenAI
import os os.environ["OPENAI_API_KEY"] = "sk-..." from llama_index.core import VectorStoreIndex, SimpleDirectoryReader from llama_index.core.postprocessor import ( FixedRecencyPostprocessor, EmbeddingRecencyPostprocessor, ) from llama_index.core.node_parser import SentenceSplitter from llama_index.core.stora...
EmbeddingRecencyPostprocessor()
llama_index.core.postprocessor.EmbeddingRecencyPostprocessor
get_ipython().run_line_magic('pip', 'install llama-index-vector-stores-qdrant') get_ipython().run_line_magic('pip', 'install llama-index-readers-file') get_ipython().run_line_magic('pip', 'install llama-index-multi-modal-llms-replicate') get_ipython().run_line_magic('pip', 'install unstructured replicate') get_ipytho...
display_source_node(res_node, source_length=200)
llama_index.core.response.notebook_utils.display_source_node
get_ipython().run_line_magic('pip', 'install llama-index-agent-openai') get_ipython().system('pip install llama-index') from llama_index.core import ( SimpleDirectoryReader, VectorStoreIndex, StorageContext, load_index_from_storage, ) from llama_index.core.tools import QueryEngineTool, ToolMetadata...
OpenAIAgent.from_tools(query_engine_tools, verbose=True)
llama_index.agent.openai.OpenAIAgent.from_tools
get_ipython().run_line_magic('pip', 'install -q llama-index-vector-stores-chroma llama-index-llms-fireworks llama-index-embeddings-fireworks==0.1.2') get_ipython().run_line_magic('pip', 'install -q llama-index') get_ipython().system('pip install llama-index chromadb --quiet') get_ipython().system('pip install -q c...
StorageContext.from_defaults(vector_store=vector_store)
llama_index.core.StorageContext.from_defaults
get_ipython().run_line_magic('pip', 'install llama-index-llms-openai') get_ipython().run_line_magic('pip', 'install llama-index-agent-openai') get_ipython().system('pip install llama-index') from llama_index.core import VectorStoreIndex, SimpleDirectoryReader from llama_index.core import SummaryIndex from llama_ind...
OpenAI(temperature=0, model="gpt-3.5-turbo")
llama_index.llms.openai.OpenAI
get_ipython().system('pip install llama-index-multi-modal-llms-ollama') get_ipython().system('pip install llama-index-readers-file') get_ipython().system('pip install unstructured') get_ipython().system('pip install llama-index-embeddings-huggingface') get_ipython().system('pip install llama-index-vector-stores-qdrant'...
SimpleDirectoryReader("./mixed_wiki/")
llama_index.SimpleDirectoryReader
get_ipython().run_line_magic('pip', 'install llama-index-embeddings-openai') get_ipython().run_line_magic('pip', 'install llama-index-llms-openai') get_ipython().system("mkdir -p 'data/paul_graham/'") get_ipython().system("wget 'https://raw.githubusercontent.com/run-llama/llama_index/main/docs/examples/data/paul_grah...
OpenAIEmbedding(model="text-embedding-3-small")
llama_index.embeddings.openai.OpenAIEmbedding
get_ipython().run_line_magic('pip', 'install llama-index-llms-openai') get_ipython().run_line_magic('pip', 'install llama-index-llms-cohere') get_ipython().system('pip install llama-index') from llama_index.llms.cohere import Cohere api_key = "Your api key" resp = Cohere(api_key=api_key).complete("Paul Graham is "...
ChatMessage(role="user", content="What is your name")
llama_index.core.llms.ChatMessage
get_ipython().run_line_magic('pip', 'install llama-index-llms-openai') get_ipython().system("wget 'https://raw.githubusercontent.com/run-llama/llama_index/main/docs/examples/data/paul_graham/paul_graham_essay.txt' -O 'data/paul_graham/paul_graham_essay.txt' -O pg_essay.txt") from llama_index.core import SimpleDirec...
OpenAI(model="gpt-3.5-turbo")
llama_index.llms.openai.OpenAI
from llama_index.core import SQLDatabase from sqlalchemy import ( create_engine, MetaData, Table, Column, String, Integer, select, column, ) engine = create_engine("sqlite:///chinook.db") sql_database = SQLDatabase(engine) from llama_index.core.query_pipeline import QueryPipeline g...
ChatMessage(content=response_str, role=MessageRole.ASSISTANT)
llama_index.core.llms.ChatMessage
get_ipython().run_line_magic('pip', 'install llama-index-multi-modal-llms-openai') get_ipython().run_line_magic('pip', 'install llama-index-multi-modal-llms-replicate') import os OPENAI_API_TOKEN = "sk-<your-openai-api-token>" os.environ["OPENAI_API_KEY"] = OPENAI_API_TOKEN REPLICATE_API_TOKEN = "" # Your Relicat...
SimpleDirectoryReader("./restaurant_images")
llama_index.core.SimpleDirectoryReader
get_ipython().run_line_magic('pip', 'install llama-index-embeddings-openai') get_ipython().run_line_magic('pip', 'install llama-index-llms-openai') get_ipython().system('pip install llama-index') import nest_asyncio nest_asyncio.apply() import os os.environ["OPENAI_API_KEY"] = "sk-..." from llama_index.llms....
StorageContext.from_defaults()
llama_index.core.StorageContext.from_defaults
from llama_hub.openalex import OpenAlexReader from llama_index.llms import OpenAI from llama_index.query_engine import CitationQueryEngine from llama_index import ( VectorStoreIndex, ServiceContext, ) from llama_index.response.notebook_utils import display_response openalex_reader = OpenAlexReader(email="shau...
VectorStoreIndex.from_documents(works, service_context=service_context)
llama_index.VectorStoreIndex.from_documents
get_ipython().run_line_magic('pip', 'install llama-index-llms-portkey') get_ipython().system('pip install llama-index') get_ipython().system('pip install -U llama_index') get_ipython().system('pip install -U portkey-ai') from llama_index.llms.portkey import Portkey from llama_index.core.llms import ChatMessage imp...
Portkey(mode="single")
llama_index.llms.portkey.Portkey
get_ipython().run_line_magic('pip', 'install llama-index-agent-openai') get_ipython().run_line_magic('pip', 'install llama-index-llms-openai') get_ipython().system('pip install llama-index') from llama_index.core import ( VectorStoreIndex, SimpleKeywordTableIndex, SimpleDirectoryReader, ) from llama_in...
StorageContext.from_defaults(persist_dir=f"./data/{wiki_title}")
llama_index.core.StorageContext.from_defaults
get_ipython().run_line_magic('pip', 'install llama-index-llms-openai') get_ipython().run_line_magic('pip', 'install llama-index-llms-anthropic') import nest_asyncio nest_asyncio.apply() from llama_index.core import SimpleDirectoryReader, Document from llama_index.core import SummaryIndex from llama_index.llms.open...
CorrectnessEvaluator(llm=eval_llm)
llama_index.core.evaluation.CorrectnessEvaluator
from llama_index.agent import OpenAIAgent import openai openai.api_key = "sk-your-key" from llama_index.tools.yelp.base import YelpToolSpec from llama_index.tools.tool_spec.load_and_search.base import LoadAndSearchToolSpec tool_spec =
YelpToolSpec(api_key="your-key", client_id="your-id")
llama_index.tools.yelp.base.YelpToolSpec
get_ipython().system('wget "https://www.dropbox.com/s/f6bmb19xdg0xedm/paul_graham_essay.txt?dl=1" -O paul_graham_essay.txt') from llama_index.core import SimpleDirectoryReader reader =
SimpleDirectoryReader(input_files=["paul_graham_essay.txt"])
llama_index.core.SimpleDirectoryReader
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader from llama_index.core.postprocessor import TimeWeightedPostprocessor from llama_index.core.node_parser import SentenceSplitter from llama_index.core.storage.docstore import SimpleDocumentStore from llama_index.core.response.notebook_utils import displ...
display_response(response)
llama_index.core.response.notebook_utils.display_response
get_ipython().run_line_magic('pip', 'install llama-index-vector-stores-pinecone') import phoenix as px import llama_index.core px.launch_app() llama_index.core.set_global_handler("arize_phoenix") import os os.environ[ "PINECONE_API_KEY" ] = "<Your Pinecone API key, from app.pinecone.io>" from pinecone i...
MetadataFilters.from_dicts(filter_dicts)
llama_index.core.vector_stores.MetadataFilters.from_dicts
get_ipython().run_line_magic('pip', 'install llama-index-llms-fireworks') get_ipython().run_line_magic('pip', 'install llama-index') from llama_index.llms.fireworks import Fireworks resp = Fireworks().complete("Paul Graham is ") print(resp) from llama_index.core.llms import ChatMessage from llama_index.llms...
Fireworks()
llama_index.llms.fireworks.Fireworks
get_ipython().run_line_magic('pip', 'install llama-index llama-index-vector-stores-qdrant -q') import nest_asyncio nest_asyncio.apply() get_ipython().system('mkdir data') get_ipython().system('wget "https://arxiv.org/pdf/2402.09353.pdf" -O "./data/dorav1.pdf"') from llama_index.llms.openai import OpenAI llm = ...
SentenceSplitter()
llama_index.core.node_parser.SentenceSplitter
import openai openai.api_key = "sk-your-key" from llama_index.agent import OpenAIAgent from llama_index.tools.text_to_image.base import TextToImageToolSpec text_to_image_spec =
TextToImageToolSpec()
llama_index.tools.text_to_image.base.TextToImageToolSpec
get_ipython().run_line_magic('pip', 'install llama-index-llms-replicate') get_ipython().system('pip install llama-index') import os os.environ["REPLICATE_API_TOKEN"] = "<your API key>" from llama_index.llms.replicate import Replicate llm = Replicate( model="a16z-infra/llama13b-v2-chat:df7690f1994d94e96ad...
ChatMessage(role="user", content="What is your name")
llama_index.core.llms.ChatMessage
get_ipython().run_line_magic('pip', 'install llama-index-program-openai') get_ipython().run_line_magic('pip', 'install llama-index-llms-llama-api') get_ipython().system('pip install llama-index') from llama_index.llms.llama_api import LlamaAPI api_key = "LL-your-key" llm = LlamaAPI(api_key=api_key) resp = l...
LlamaAPI(api_key=api_key)
llama_index.llms.llama_api.LlamaAPI
get_ipython().run_line_magic('pip', 'install llama-index-readers-web') import logging import sys logging.basicConfig(stream=sys.stdout, level=logging.INFO) logging.getLogger().addHandler(logging.StreamHandler(stream=sys.stdout)) get_ipython().system('pip install llama-index') from llama_index.core import Summa...
SummaryIndex.from_documents(documents)
llama_index.core.SummaryIndex.from_documents
get_ipython().run_line_magic('pip', 'install llama-index-llms-openai') get_ipython().system('pip install llama-index') import nest_asyncio nest_asyncio.apply() import logging import sys logging.basicConfig(stream=sys.stdout, level=logging.INFO) logging.getLogger().handlers = [] logging.getLogger().addHandler(lo...
SimpleDirectoryReader("./data/paul_graham/")
llama_index.core.SimpleDirectoryReader
get_ipython().run_line_magic('pip', 'install llama-index-llms-openai') from llama_index.core import ( SimpleDirectoryReader, VectorStoreIndex, StorageContext, load_index_from_storage, ) from llama_index.core.tools import QueryEngineTool, ToolMetadata try: storage_context = StorageContext.from_d...
VectorStoreIndex.from_documents(uber_docs)
llama_index.core.VectorStoreIndex.from_documents
get_ipython().run_line_magic('pip', 'install llama-index-llms-rungpt') get_ipython().system('pip install llama-index') get_ipython().system('pip install rungpt') get_ipython().system('rungpt serve decapoda-research/llama-7b-hf --precision fp16 --device_map balanced') from llama_index.llms.rungpt import RunGp...
RunGptLLM()
llama_index.llms.rungpt.RunGptLLM
get_ipython().run_line_magic('pip', 'install llama-index llama-index-vector-stores-qdrant -q') import nest_asyncio nest_asyncio.apply() get_ipython().system('mkdir data') get_ipython().system('wget "https://arxiv.org/pdf/2402.09353.pdf" -O "./data/dorav1.pdf"') from llama_index.llms.openai import OpenAI llm =
OpenAI(model="gpt-4")
llama_index.llms.openai.OpenAI
get_ipython().run_line_magic('pip', 'install llama-index-llms-openai') get_ipython().run_line_magic('pip', 'install llama-hub-llama-packs-tables-chain-of-table-base') get_ipython().system('wget "https://github.com/ppasupat/WikiTableQuestions/releases/download/v1.0.2/WikiTableQuestions-1.0.2-compact.zip" -O data.zip')...
QueryPipeline(chain=[prompt_c, llm])
llama_index.core.query_pipeline.QueryPipeline
get_ipython().run_line_magic('pip', 'install llama-index-vector-stores-pinecone') get_ipython().system('pip install llama-index>=0.9.31 pinecone-client>=3.0.0') import logging import sys import os logging.basicConfig(stream=sys.stdout, level=logging.INFO) logging.getLogger().addHandler(logging.StreamHandler(stream...
SimpleDirectoryReader("./data/paul_graham")
llama_index.core.SimpleDirectoryReader
get_ipython().run_line_magic('pip', 'install llama-index-agent-openai') get_ipython().run_line_magic('pip', 'install llama-index-vector-stores-pinecone') get_ipython().run_line_magic('pip', 'install llama-index-readers-wikipedia') get_ipython().run_line_magic('pip', 'install llama-index-llms-openai') get_ipython().sy...
OpenAIAssistantAgent.from_new( name="City bot", instructions="You are a bot designed to answer questions about cities (both unstructured and structured data)
llama_index.agent.openai.OpenAIAssistantAgent.from_new
get_ipython().run_line_magic('pip', 'install llama-index-postprocessor-rankgpt-rerank') get_ipython().run_line_magic('pip', 'install llama-index-embeddings-openai') get_ipython().run_line_magic('pip', 'install llama-index-packs-infer-retrieve-rerank') get_ipython().run_line_magic('pip', 'install llama-index-llms-openai...
OpenAI(model="gpt-3.5-turbo-16k")
llama_index.llms.openai.OpenAI
get_ipython().run_line_magic('pip', 'install llama-index-embeddings-openai') get_ipython().run_line_magic('pip', 'install llama-index-vector-stores-timescalevector') get_ipython().system('pip install llama-index') import timescale_vector from llama_index.core import SimpleDirectoryReader, StorageContext from llam...
SimpleDirectoryReader("./data/paul_graham")
llama_index.core.SimpleDirectoryReader
get_ipython().run_line_magic('pip', 'install llama-index-llms-sagemaker-endpoint') get_ipython().system(' pip install llama-index') ENDPOINT_NAME = "<-YOUR-ENDPOINT-NAME->" from llama_index.llms.sagemaker_endpoint import SageMakerLLM AWS_ACCESS_KEY_ID = "<-YOUR-AWS-ACCESS-KEY-ID->" AWS_SECRET_ACCESS_KEY = "<-...
ChatMessage(role="user", content="What is your name")
llama_index.core.llms.ChatMessage
get_ipython().run_line_magic('pip', 'install llama-index-vector-stores-myscale') get_ipython().system('pip install llama-index') import logging import sys logging.basicConfig(stream=sys.stdout, level=logging.INFO) logging.getLogger().addHandler(logging.StreamHandler(stream=sys.stdout)) from os import environ im...
SimpleDirectoryReader("./data/paul_graham/")
llama_index.core.SimpleDirectoryReader
get_ipython().run_line_magic('pip', 'install llama-index-vector-stores-deeplake') get_ipython().run_line_magic('pip', 'install llama-index-llms-openai') import nest_asyncio import os import getpass nest_asyncio.apply() get_ipython().system('pip install deeplake beautifulsoup4 html2text tiktoken openai llama-index ...
SimpleNodeParser.from_defaults(chunk_size=512)
llama_index.core.node_parser.SimpleNodeParser.from_defaults
get_ipython().run_line_magic('pip', 'install llama-index-embeddings-huggingface-optimum-intel') from llama_index.embeddings.huggingface_optimum_intel import IntelEmbedding embed_model =
IntelEmbedding("Intel/bge-small-en-v1.5-rag-int8-static")
llama_index.embeddings.huggingface_optimum_intel.IntelEmbedding
get_ipython().run_line_magic('pip', 'install llama-index-readers-web') import logging import sys logging.basicConfig(stream=sys.stdout, level=logging.INFO) logging.getLogger().addHandler(logging.StreamHandler(stream=sys.stdout)) get_ipython().system('pip install llama-index') from llama_index.core import Summa...
SummaryIndex.from_documents(documents)
llama_index.core.SummaryIndex.from_documents
get_ipython().run_line_magic('pip', 'install llama-index-readers-file') get_ipython().run_line_magic('pip', 'install llama-index-llms-openai') get_ipython().system('mkdir data') get_ipython().system('wget --user-agent "Mozilla" "https://arxiv.org/pdf/2307.09288.pdf" -O "data/llama2.pdf"') from pathlib import Path f...
PyMuPDFReader()
llama_index.readers.file.PyMuPDFReader
get_ipython().run_line_magic('pip', 'install llama-index-llms-openai') get_ipython().system('pip install llama-index') import nest_asyncio nest_asyncio.apply() get_ipython().system("wget 'https://raw.githubusercontent.com/jerryjliu/llama_index/main/examples/gatsby/gatsby_full.txt' -O 'gatsby_full.txt'") fro...
LLMMultiSelector.from_defaults()
llama_index.core.selectors.LLMMultiSelector.from_defaults
get_ipython().run_line_magic('pip', 'install llama-index-multi-modal-llms-gemini') get_ipython().run_line_magic('pip', 'install llama-index-vector-stores-qdrant') get_ipython().run_line_magic('pip', 'install llama-index-embeddings-gemini') get_ipython().run_line_magic('pip', 'install llama-index-llms-gemini') get_ipy...
MetadataInfo( name="currency", description="The currency of the country the purchase was made (abbreviation)
llama_index.core.vector_stores.MetadataInfo
get_ipython().run_line_magic('pip', 'install llama-index-vector-stores-jaguar') get_ipython().system('pip install -U jaguardb-http-client') from llama_index.core import VectorStoreIndex, SimpleDirectoryReader from llama_index.core import StorageContext from llama_index.vector_stores.jaguar import JaguarVectorStore...
SimpleDirectoryReader("../data/paul_graham/")
llama_index.core.SimpleDirectoryReader
import openai openai.api_key = "sk-xxx" from llama_index.agent.openai import OpenAIAgent from llama_index.tools.brave_search.base import BraveSearchToolSpec brave_tool =
BraveSearchToolSpec(api_key="your-api-key")
llama_index.tools.brave_search.base.BraveSearchToolSpec
get_ipython().run_line_magic('pip', 'install llama-index-readers-discord') get_ipython().system('pip install llama-index') import logging import sys logging.basicConfig(stream=sys.stdout, level=logging.INFO) logging.getLogger().addHandler(logging.StreamHandler(stream=sys.stdout)) get_ipython().system('pip instal...
SummaryIndex.from_documents(documents)
llama_index.core.SummaryIndex.from_documents
get_ipython().run_line_magic('pip', 'install -q uptrain llama-index') import httpx import os import openai import pandas as pd from llama_index.core import VectorStoreIndex, SimpleDirectoryReader, Settings from uptrain import Evals, EvalLlamaIndex, Settings as UpTrainSettings url = "https://uptrain-assets.s3.ap-...
SimpleDirectoryReader("./nyc_wikipedia/")
llama_index.core.SimpleDirectoryReader
get_ipython().run_line_magic('pip', 'install llama-index-readers-file') get_ipython().run_line_magic('pip', 'install llama-index-multi-modal-llms-replicate') get_ipython().run_line_magic('load_ext', 'autoreload') get_ipython().run_line_magic('', 'autoreload 2') get_ipython().system('pip install unstructured') fro...
FlatReader()
llama_index.readers.file.FlatReader
get_ipython().run_line_magic('pip', 'install llama-index-vector-stores-tencentvectordb') get_ipython().system('pip install llama-index') get_ipython().system('pip install tcvectordb') from llama_index.core import ( VectorStoreIndex, SimpleDirectoryReader, StorageContext, ) from llama_index.vector_stor...
StorageContext.from_defaults(vector_store=vector_store)
llama_index.core.StorageContext.from_defaults
get_ipython().run_line_magic('pip', 'install llama-index-llms-openai') get_ipython().run_line_magic('pip', 'install llama-index-readers-file') import os os.environ["OPENAI_API_KEY"] = "sk-..." import nest_asyncio nest_asyncio.apply() get_ipython().system("mkdir -p 'data/'") get_ipython().system("curl 'https://ar...
OpenAI(model="gpt-3.5-turbo", max_tokens=750)
llama_index.llms.openai.OpenAI
get_ipython().run_line_magic('pip', 'install llama-index-llms-openai') get_ipython().run_line_magic('pip', 'install llama-index-embeddings-openai') get_ipython().run_line_magic('pip', 'install llama-index-graph-stores-nebula') get_ipython().run_line_magic('pip', 'install llama-index-llms-azure-openai') import os os...
OpenAI(temperature=0, model="gpt-3.5-turbo")
llama_index.llms.openai.OpenAI
get_ipython().system('pip install llama-index') from llama_index.core import VectorStoreIndex from llama_index.core import SimpleDirectoryReader import nest_asyncio nest_asyncio.apply() get_ipython().system("mkdir -p 'data/paul_graham/'") get_ipython().system("wget 'https://raw.githubusercontent.com/run-l...
RelevancyEvaluator()
llama_index.core.evaluation.RelevancyEvaluator
get_ipython().run_line_magic('pip', 'install llama-index-embeddings-huggingface') get_ipython().run_line_magic('pip', 'install llama-index-vector-stores-elasticsearch') from llama_index.core import VectorStoreIndex, SimpleDirectoryReader from llama_index.vector_stores.elasticsearch import ElasticsearchStore from ll...
SimpleDirectoryReader("./data/paul_graham/")
llama_index.core.SimpleDirectoryReader
get_ipython().system('pip install llama-index') get_ipython().system("mkdir -p 'data/paul_graham/'") get_ipython().system("wget 'https://raw.githubusercontent.com/run-llama/llama_index/main/docs/examples/data/paul_graham/paul_graham_essay.txt' -O 'data/paul_graham/paul_graham_essay.txt'") import logging import sy...
HyDEQueryTransform(include_original=True)
llama_index.core.indices.query.query_transform.HyDEQueryTransform
get_ipython().run_line_magic('pip', 'install llama-index-program-openai') get_ipython().run_line_magic('pip', 'install llama-index-llms-llama-api') get_ipython().system('pip install llama-index') from llama_index.llms.llama_api import LlamaAPI api_key = "LL-your-key" llm =
LlamaAPI(api_key=api_key)
llama_index.llms.llama_api.LlamaAPI
get_ipython().run_line_magic('pip', 'install llama-index-agent-openai') get_ipython().run_line_magic('pip', 'install llama-index-embeddings-openai') get_ipython().run_line_magic('pip', 'install llama-index-llms-openai') import os os.environ["OPENAI_API_KEY"] = "sk-..." from llama_index.embeddings.openai import Ope...
FunctionTool.from_defaults(fn=create_agent)
llama_index.core.tools.FunctionTool.from_defaults
get_ipython().run_line_magic('pip', 'install llama-index-llms-openai') import nest_asyncio from tqdm.asyncio import tqdm_asyncio nest_asyncio.apply() def displayify_df(df): """For pretty displaying DataFrame in a notebook.""" display_df = df.style.set_properties( **{ "inline-size": "300...
VectorStoreIndex.from_documents(documents=documents)
llama_index.core.VectorStoreIndex.from_documents
get_ipython().run_line_magic('pip', 'install llama-index-llms-openai') get_ipython().run_line_magic('pip', 'install llama-index-readers-file') get_ipython().run_line_magic('load_ext', 'autoreload') get_ipython().run_line_magic('autoreload', '2') get_ipython().run_line_magic('env', 'OPENAI_API_KEY=') get_ipython().run...
resolve_embed_model("local:BAAI/bge-small-en")
llama_index.core.embeddings.resolve_embed_model
import openai openai.api_key = "sk-your-key" from llama_index.agent import OpenAIAgent from llama_index.tools.azure_cv.base import AzureCVToolSpec cv_tool =
AzureCVToolSpec(api_key="your-key", resource="your-resource")
llama_index.tools.azure_cv.base.AzureCVToolSpec
get_ipython().run_line_magic('pip', 'install llama-index-llms-gemini') get_ipython().system('pip install -q llama-index google-generativeai') get_ipython().run_line_magic('env', 'GOOGLE_API_KEY=...') import os GOOGLE_API_KEY = "" # add your GOOGLE API key here os.environ["GOOGLE_API_KEY"] = GOOGLE_API_KEY f...
ChatMessage(role="user", content="Hello friend!")
llama_index.core.llms.ChatMessage
get_ipython().run_line_magic('pip', 'install llama-index-vector-stores-supabase') get_ipython().system('pip install llama-index') import logging import sys from llama_index.core import SimpleDirectoryReader, Document, StorageContext from llama_index.core import VectorStoreIndex from llama_index.vector_stores.supa...
SupabaseVectorStore( postgres_connection_string=( "postgresql://<user>:<password>@<host>:<port>/<db_name>" )
llama_index.vector_stores.supabase.SupabaseVectorStore
get_ipython().system('pip install llama-index') from llama_index.core import VectorStoreIndex, SimpleDirectoryReader from llama_index.core.postprocessor import ( PrevNextNodePostprocessor, AutoPrevNextNodePostprocessor, ) from llama_index.core.node_parser import SentenceSplitter from llama_index.core.storage....
StorageContext.from_defaults(docstore=docstore)
llama_index.core.StorageContext.from_defaults
get_ipython().run_line_magic('pip', 'install llama-index-embeddings-openai') get_ipython().run_line_magic('pip', 'install llama-index-readers-file') get_ipython().run_line_magic('pip', 'install llama-index-llms-openai') import camelot from llama_index.core import VectorStoreIndex from llama_index.core.query_engine i...
VectorStoreIndex(doc_nodes)
llama_index.core.VectorStoreIndex
get_ipython().run_line_magic('pip', 'install llama-index-readers-wikipedia') import os os.environ["OPENAI_API_KEY"] = "INSERT OPENAI KEY" get_ipython().system('pip install llama-index') from llama_index.core import download_loader from llama_index.readers.wikipedia import WikipediaReader loader = WikipediaRe...
SentenceEmbeddingOptimizer(percentile_cutoff=0.5)
llama_index.core.postprocessor.SentenceEmbeddingOptimizer
get_ipython().run_line_magic('pip', 'install llama-index-embeddings-huggingface') get_ipython().run_line_magic('pip', 'install llama-index-llms-openai') get_ipython().system('pip install llama-index') import os import openai os.environ["OPENAI_API_KEY"] = "sk-..." from llama_index.embeddings.huggingface import H...
VectorStoreIndex.from_documents(documents)
llama_index.core.VectorStoreIndex.from_documents
get_ipython().run_line_magic('pip', 'install llama-index-readers-wikipedia') get_ipython().run_line_magic('pip', 'install llama-index-llms-openai') get_ipython().system('pip install llama-index') import nest_asyncio nest_asyncio.apply() import logging import sys logging.basicConfig(stream=sys.stdout, level=loggi...
OpenAI(model="gpt-3.5-turbo")
llama_index.llms.openai.OpenAI
get_ipython().run_line_magic('pip', 'install llama-index-llms-gradient') get_ipython().run_line_magic('pip', 'install llama-index-llms-openai') get_ipython().run_line_magic('pip', 'install llama-index-readers-file') get_ipython().run_line_magic('pip', 'install llama-index-finetuning') get_ipython().system('pip instal...
CallbackManager([gradient_handler])
llama_index.core.callbacks.CallbackManager
get_ipython().run_line_magic('pip', 'install llama-index-storage-docstore-redis') get_ipython().run_line_magic('pip', 'install llama-index-vector-stores-redis') get_ipython().run_line_magic('pip', 'install llama-index-embeddings-huggingface') get_ipython().system('pip install redis') get_ipython().system('docker ru...
RedisCache.from_host_and_port("localhost", 6379)
llama_index.core.ingestion.cache.RedisCache.from_host_and_port
from llama_index import VectorStoreIndex, SimpleDirectoryReader documents = SimpleDirectoryReader( "../../examples/data/paul_graham" ).load_data() index = VectorStoreIndex.from_documents(documents) import pinecone from llama_index import VectorStoreIndex, SimpleDirectoryReader, StorageContext from llama_index.v...
get_response_synthesizer()
llama_index.get_response_synthesizer
from llama_index import VectorStoreIndex, SimpleDirectoryReader documents = SimpleDirectoryReader( "../../examples/data/paul_graham" ).load_data() index = VectorStoreIndex.from_documents(documents) import pinecone from llama_index import VectorStoreIndex, SimpleDirectoryReader, StorageContext from llama_index.v...
get_response_synthesizer()
llama_index.get_response_synthesizer
get_ipython().run_line_magic('pip', 'install llama-index-llms-openai') import os from getpass import getpass if os.getenv("OPENAI_API_KEY") is None: os.environ["OPENAI_API_KEY"] = getpass( "Paste your OpenAI key from:" " https://platform.openai.com/account/api-keys\n" ) assert os.getenv("OPEN...
SimpleDirectoryReader("./data/paul_graham/")
llama_index.core.SimpleDirectoryReader
get_ipython().run_line_magic('pip', 'install llama-index-vector-stores-supabase') get_ipython().system('pip install llama-index') import logging import sys from llama_index.core import SimpleDirectoryReader, Document, StorageContext from llama_index.core import VectorStoreIndex from llama_index.vector_stores.supa...
SupabaseVectorStore( postgres_connection_string=( "postgresql://<user>:<password>@<host>:<port>/<db_name>" )
llama_index.vector_stores.supabase.SupabaseVectorStore
get_ipython().run_line_magic('pip', 'install llama-index-readers-web') get_ipython().run_line_magic('pip', 'install llama-index-callbacks-uptrain') get_ipython().run_line_magic('pip', 'install -q html2text llama-index pandas tqdm uptrain torch sentence-transformers') from llama_index.core import Settings, VectorStor...
SimpleWebPageReader()
llama_index.readers.web.SimpleWebPageReader
get_ipython().run_line_magic('pip', 'install llama-index-storage-docstore-mongodb') get_ipython().run_line_magic('pip', 'install llama-index-storage-index-store-mongodb') get_ipython().run_line_magic('pip', 'install llama-index-llms-openai') get_ipython().system('pip install llama-index') import nest_asyncio nest_...
MongoDocumentStore.from_uri(uri=MONGO_URI)
llama_index.storage.docstore.mongodb.MongoDocumentStore.from_uri
get_ipython().system('pip install llama-index-multi-modal-llms-anthropic') get_ipython().system('pip install llama-index-vector-stores-qdrant') get_ipython().system('pip install matplotlib') import os os.environ["ANTHROPIC_API_KEY"] = "" # Your ANTHROPIC API key here from PIL import Image import matplotlib.pyplo...
StorageContext.from_defaults(vector_store=vector_store)
llama_index.core.StorageContext.from_defaults
get_ipython().run_line_magic('pip', 'install llama-index-llms-openai') get_ipython().run_line_magic('pip', 'install llama-index-indices-managed-colbert') get_ipython().run_line_magic('pip', 'install llama-index-vector-stores-qdrant') get_ipython().run_line_magic('pip', 'install llama-index-llms-gemini') get_ipython().r...
SimpleDirectoryReader("./data/paul_graham/")
llama_index.core.SimpleDirectoryReader
get_ipython().run_line_magic('pip', 'install llama-index-finetuning') get_ipython().run_line_magic('pip', 'install llama-index-llms-openai') import nest_asyncio nest_asyncio.apply() get_ipython().system('pip install llama-index') get_ipython().system('pip install spacy') wiki_titles = [ "Toronto", "S...
resolve_embed_model("local:BAAI/bge-small-en")
llama_index.core.embeddings.resolve_embed_model
get_ipython().run_line_magic('pip', 'install llama-index-llms-openllm') get_ipython().system('pip install "openllm" # use \'openllm[vllm]\' if you have access to GPU') get_ipython().system('pip install llama-index') import os from typing import List, Optional from llama_index.llms.openllm import OpenLLM, Open...
ChatMessage(role="user", content="Hi there!")
llama_index.core.llms.ChatMessage
get_ipython().run_line_magic('pip', 'install llama-index-llms-openai') get_ipython().run_line_magic('pip', 'install llama-index-indices-managed-vectara') get_ipython().system('pip install llama-index') import logging import sys logging.basicConfig(stream=sys.stdout, level=logging.INFO) logging.getLogger().addHandl...
TextNode( text=( "A pragmatic paleontologist touring an almost complete theme park on an island " + "in Central America is tasked with protecting a couple of kids after a power " + "failure causes the park's cloned dinosaurs to run loose." )
llama_index.core.schema.TextNode
get_ipython().run_line_magic('pip', 'install llama-index-llms-mistralai') get_ipython().system('pip install llama-index') from llama_index.llms.mistralai import MistralAI llm = MistralAI() resp = llm.complete("Paul Graham is ") print(resp) from llama_index.core.llms import ChatMessage from llama_index.llms...
MistralAI()
llama_index.llms.mistralai.MistralAI
get_ipython().run_line_magic('pip', 'install llama-index-vector-stores-weaviate') get_ipython().system('pip install llama-index weaviate-client') import os import openai os.environ["OPENAI_API_KEY"] = "sk-<your key here>" openai.api_key = os.environ["OPENAI_API_KEY"] import logging import sys logging.basicConf...
MetadataFilter(key="year", value=1972)
llama_index.core.vector_stores.MetadataFilter
get_ipython().run_line_magic('pip', 'install llama-index-llms-openai') get_ipython().system("wget 'https://raw.githubusercontent.com/run-llama/llama_index/main/docs/examples/data/paul_graham/paul_graham_essay.txt' -O 'data/paul_graham/paul_graham_essay.txt' -O pg_essay.txt") from llama_index.core import SimpleDirec...
OpenAI(model="gpt-3.5-turbo")
llama_index.llms.openai.OpenAI
get_ipython().run_line_magic('pip', 'install llama-index-llms-openai') get_ipython().run_line_magic('pip', 'install llama-index-readers-file') get_ipython().run_line_magic('load_ext', 'autoreload') get_ipython().run_line_magic('autoreload', '2') get_ipython().run_line_magic('env', 'OPENAI_API_KEY=') get_ipython().run...
IndexNode.from_text_node(sn, base_node.node_id)
llama_index.core.schema.IndexNode.from_text_node
get_ipython().run_line_magic('pip', 'install llama-index-vector-stores-chroma') get_ipython().system('pip install llama-index') import logging import sys logging.basicConfig(stream=sys.stdout, level=logging.INFO) logging.getLogger().addHandler(logging.StreamHandler(stream=sys.stdout)) import os import getpass o...
ChromaVectorStore(chroma_collection=chroma_collection)
llama_index.vector_stores.chroma.ChromaVectorStore
get_ipython().run_line_magic('pip', 'install llama-index-llms-gemini') get_ipython().run_line_magic('pip', 'install llama-index-vector-stores-google') get_ipython().run_line_magic('pip', 'install llama-index-indices-managed-google') get_ipython().run_line_magic('pip', 'install llama-index-response-synthesizers-google')...
GoogleVectorStore.from_corpus(corpus_id=SESSION_CORPUS_ID)
llama_index.vector_stores.google.GoogleVectorStore.from_corpus
get_ipython().run_line_magic('pip', 'install llama-index-agent-openai') get_ipython().run_line_magic('pip', 'install llama-index-vector-stores-supabase') get_ipython().system('pip install llama-index') from llama_index.agent.openai import OpenAIAssistantAgent agent = OpenAIAssistantAgent.from_new( name="Ma...
load_index_from_storage(storage_context)
llama_index.core.load_index_from_storage
get_ipython().run_line_magic('pip', 'install llama-index-llms-openai') import os from getpass import getpass if os.getenv("OPENAI_API_KEY") is None: os.environ["OPENAI_API_KEY"] = getpass( "Paste your OpenAI key from:" " https://platform.openai.com/account/api-keys\n" ) assert os.getenv("OPEN...
CallbackManager([llama_debug, hh_tracer])
llama_index.core.callbacks.CallbackManager
get_ipython().run_line_magic('pip', 'install llama-index-llms-openai') get_ipython().run_line_magic('pip', 'install llama-index-llms-cohere') get_ipython().run_line_magic('pip', 'install llama-index-llms-gemini') get_ipython().system('pip install "google-generativeai" -q') import nest_asyncio nest_asyncio.apply() ...
Gemini(model="models/gemini-pro", temperature=0)
llama_index.llms.gemini.Gemini
import openai openai.api_key = "sk-your-key" from llama_index.agent import OpenAIAgent import requests import yaml f = requests.get( "https://raw.githubusercontent.com/sisbell/chatgpt-plugin-store/main/manifests/today-currency-converter.oiconma.repl.co.json" ).text manifest = yaml.safe_load(f) from llama_inde...
ChatGPTPluginToolSpec( manifest_url="https://raw.githubusercontent.com/sisbell/chatgpt-plugin-store/main/manifests/today-currency-converter.oiconma.repl.co.json" )
llama_index.tools.chatgpt_plugin.base.ChatGPTPluginToolSpec
get_ipython().run_line_magic('pip', 'install llama-index-agent-openai') get_ipython().run_line_magic('pip', 'install llama-index-llms-openai') from llama_index.agent.openai import OpenAIAgent from llama_index.llms.openai import OpenAI from llama_index.core.tools import BaseTool, FunctionTool def multiply(a: int, b...
FunctionTool.from_defaults(fn=multiply)
llama_index.core.tools.FunctionTool.from_defaults
get_ipython().run_line_magic('pip', 'install llama-index-llms-openai') get_ipython().system("mkdir -p 'data/paul_graham/'") get_ipython().system("wget 'https://raw.githubusercontent.com/run-llama/llama_index/main/docs/examples/data/paul_graham/paul_graham_essay.txt' -O 'data/paul_graham/paul_graham_essay.txt'") im...
SimpleDirectoryReader("./data/paul_graham/")
llama_index.core.SimpleDirectoryReader
get_ipython().run_line_magic('pip', 'install llama-index-embeddings-openai') get_ipython().run_line_magic('pip', 'install llama-index-embeddings-huggingface') get_ipython().run_line_magic('pip', 'install llama-index-llms-openai') get_ipython().run_line_magic('load_ext', 'autoreload') get_ipython().run_line_magic('aut...
OpenAI(model="gpt-4")
llama_index.llms.openai.OpenAI
get_ipython().run_line_magic('pip', 'install llama-index-llms-openai') get_ipython().run_line_magic('pip', 'install llama-index-readers-wikipedia') from llama_index.core.llama_dataset import ( LabelledRagDataExample, CreatedByType, CreatedBy, ) query = "This is a test query, is it not?" query_by = Create...
OpenAI(model="gpt-3.5-turbo", temperature=0.3)
llama_index.llms.openai.OpenAI
import os import openai os.environ["OPENAI_API_KEY"] = "sk-..." openai.api_key = os.environ["OPENAI_API_KEY"] get_ipython().system('curl https://www.ipcc.ch/report/ar6/wg2/downloads/report/IPCC_AR6_WGII_Chapter03.pdf --output IPCC_AR6_WGII_Chapter03.pdf') from llama_index.core import SimpleDirectoryReader from ...
OpenAI(model=ft_model_name, temperature=0.3)
llama_index.llms.openai.OpenAI
get_ipython().run_line_magic('pip', 'install llama-index-llms-nvidia-triton') get_ipython().system('pip3 install tritonclient') from llama_index.llms.nvidia_triton import NvidiaTriton triton_url = "localhost:8001" resp = NvidiaTriton().complete("The tallest mountain in North America is ") print(resp) from lla...
NvidiaTriton()
llama_index.llms.nvidia_triton.NvidiaTriton
get_ipython().run_line_magic('pip', 'install llama-index-llms-openai') get_ipython().system('pip install llama-index') get_ipython().system("mkdir -p 'data/paul_graham/'") get_ipython().system("wget 'https://raw.githubusercontent.com/run-llama/llama_index/main/docs/examples/data/paul_graham/paul_graham_essay.txt' ...
SimpleDirectoryReader(input_dir="./data/paul_graham/")
llama_index.core.SimpleDirectoryReader