# Wrap the Polygon API spec with LoadAndSearchToolSpec wrapped_tools = LoadAndSearchToolSpec.from_defaults( api_spec.to_tool_list()[0], ).to_tool_list() agent = ReActAgent.from_tools( [*wrapped_tools, requests_spec.to_tool_list()[0]] , verbose=True , llm=llm , context=CONTEXT , max_iterations=20 ) agent.chat("What are all the exchanges you have access to?")
File /workspaces/pye/pye/.venv/lib/python3.10/site-packages/llama_hub/tools/requests/base.py:75, in RequestsToolSpec._get_headers_for_url(self, url) 74 def _get_headers_for_url(self, url: str) -> dict: ---> 75 return self.domain_headers[self._get_domain(url)] KeyError: 'api.polygon.io'
api.polygon.io
even though I've never prompted it to do so. It also looks like its hardcoded to do this in the RequestsToolSpec object?llamaindex-cli new-package --kind "packs" --name "pack-test"
Traceback (most recent call last): File "/workspaces/llama_index/.venv/bin/llamaindex-cli", line 6, in <module> sys.exit(main()) File "/workspaces/llama_index/.venv/lib/python3.10/site-packages/llama_index/cli/command_line.py", line 269, in main args.func(args) File "/workspaces/llama_index/.venv/lib/python3.10/site-packages/llama_index/cli/command_line.py", line 263, in <lambda> new_package_parser.set_defaults(func=lambda args: handle_init_package(**vars(args))) File "/workspaces/llama_index/.venv/lib/python3.10/site-packages/llama_index/cli/command_line.py", line 26, in handle_init_package init_new_package(integration_name=name, integration_type=kind, prefix=prefix) File "/workspaces/llama_index/.venv/lib/python3.10/site-packages/llama_index/cli/new_package/base.py", line 120, in init_new_package shutil.copyfile(common_path + "/BUILD", pkg_path + "/BUILD") File "/usr/local/python/3.10.13/lib/python3.10/shutil.py", line 254, in copyfile with open(src, 'rb') as fsrc: FileNotFoundError: [Errno 2] No such file or directory: '/workspaces/llama_index/.venv/lib/python3.10/site-packages/llama_index/cli/new_package/common/BUILD'
.toml
files are a bit new to me. I think I've got the jist of it but I am not sure where I should add a dependency necessary for my tests? In my test's fixtures I use the wikipedia reader as a way to load some simple documents into a vector store. This is its own llama pack and I figure I should add that as a dependency. Where might I do that? I see multiple potential places as I look at other example packsHYBRID SEARCH
. Most of the guides online I've seen build from textnodes directly or documents directly, none of these work because the index provided in those examples does NOT support hybrid queries. I can't use free or small instances of services like Pinecone either because these are just test fixtures and I can't expect the llama-index repo to have my credentials (nor is it best practice)ValueError: Invalid query mode: hybrid
(.venv) @no-dice-io ➜ /workspaces/koda-retriever (main) $ llamaindex-cli upgrade . Module not found: VectorStoreQueryMode Switching to core Module not found: BaseNodePostprocessor Switching to core Module not found: QueryType Switching to core Module not found: Settings Switching to core New installs: pip install llama-index-llms-openai pip install llama-index-vector-stores-pinecone pip install llama-index-embeddings-openai
BaseRetriever
should be able to pass? I took a look at the tests in the /tests/retrievers/
folder in the Llama Index repo but I only see one test in there. I can certainly follow that test but I worry that's not enough? Exception: IndexError: list index out of range
404
error or APIConnectionError
depending on how I query the query engine (or when its wrapped over by a Context Augmented Agent). I've attached my code here in a text file because I don't think it'll fit. (Traceback is within the code as well) Exception: APIConnectionError: Connection error.
AzureOpenAI
class/wrapper via LangChain and it works fine on its own when in a simple notebook I create the object and prompt it. But when its wrapped in an index/engine it starts to have connection issues as shown in my code/traceback.sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedColumn) column data_vector_embeddings.text_search_tsv does not exist
from cerebro.cbcore.utils.vector_store import CerebroVectorStore #from asyncio import run from os import name query = "Who does Paul Graham think of with the word schtick" vector_store = CerebroVectorStore() #if name == 'nt': # from asyncio import set_event_loop_policy, WindowsSelectorEventLoopPolicy # set_event_loop_policy(WindowsSelectorEventLoopPolicy()) # this fixed it vector_store.hybrid_search(query)
AttributeError: 'NoneType' object has no attribute 'send' Exception ignored in: <function _SSLProtocolTransport.__del__ at 0x000001951368DB40> Traceback (most recent call last): ...character limit... Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\asyncio\base_events.py", line 515, in _check_closed RuntimeError: Event loop is closed
async def ingest(self, chunks: list[dict]): '''Ingests a list of chunks into the vector store asynchronously''' if hasattr(self, 'ingestion_pipeline') == False: self.init_ingestion_pipeline() print('################ vector store and ingestion pipeline initialized') processed_chunks = await process_chunks(chunks) print('################ chunks processed') return await self.ingestion_pipeline.arun(documents=processed_chunks)
vector_store = PFVectorStore() #custom class I was referring to run(vector_store.ingest(test_data)) #asyncio
def init_ingestion_pipeline(self) -> IngestionPipeline: '''Initializes the ingestion pipeline for the vector store''' pipeline = IngestionPipeline( transformations=[ AzureOpenAIEmbedding( model="text-embedding-ada-002" , azure_deployment="text-embedding-ada-002" , azure_endpoint=str(settings.azure_openai_api_base) , api_version=str(settings.azure_openai_api_version) , api_key=str(settings.azure_openai_api_key) ) ] , vector_store=self.vector_store ) self.ingestion_pipeline = pipeline return pipeline async def ingest(self, chunks: list[dict]): '''Ingests a list of chunks into the vector store asynchronously''' if hasattr(self, 'ingestion_pipeline') == False: self.init_ingestion_pipeline() print('################ vector store and ingestion pipeline initialized') processed_chunks = await process_chunks(chunks) print('################ chunks processed') #await self.ingestion_pipeline.arun(documents=processed_chunks) nodes = self.ingestion_pipeline.run(documents=processed_chunks, show_progress=True) print('################ ingestion pipeline completed')
vector_store = PFVectorStore() #Custom class, not a vector store from LlamaIndex run(vector_store.ingest(test_data)) #Referencing the ingest function from an ingestion pipeline, ingest is a custom wrapper over the ingestion pipeline
pydantic.error_wrappers.ValidationError: 1 validation error for IngestionPipeline transformations -> 0 value is not a valid dict (type=type_error.dict)
ingestion_pipeline = IngestionPipeline( transformations=[AzureOpenAIEmbedding] , vector_store=vector_store ) ingestion_pipeline.run(documents=new_docs, show_progress=True)
gpt-3.5-turbo-0125
and gpt-4-turbo-preview
are both listed as models trained on function calling by OpenAI. Have there since been any additional models that are trained for function calling out of the box? Am curious if any more have been trained for function calling recentlyDocuments.example()
function. ## setup @pytest.fixture def setup() -> dict: os.environ["OPENAI_API_KEY"] = str(settings.openai_api_key) service_context = ServiceContext.from_defaults( embed_model=OpenAIEmbedding( model="text-embedding-ada-002" ), llm=OpenAI( model="gpt-3.5-turbo" ) ) shots = AlphaMatrix(data=DEFAULT_CATEGORIES) vector_index = VectorStoreIndex.from_documents( [Document.example()] , service_context=service_context ) reranker = LLMRerank(service_context=service_context) retriever = CustomRetriever( index=vector_index, llm=service_context.llm, reranker=reranker, matrix=shots, verbose=True, ) return { "retriever": retriever, "service_context": service_context, "vector_index": vector_index, "matrix": shots, } #Where the error occurs: retriever = VectorIndexRetriever( index=index, vector_store_query_mode="hybrid", alpha=default_alpha, **kwargs, # filters, etc, added here ) def test_retrieve(setup): retriever = setup.get("retriever") query = "What are LLMs good at?" results = retriever.retrieve(query)
ValueError: Invalid query mode: hybrid
llm
provided into a ServiceContext
object but when I reference it from the service context to perform a simple complete
function I get the following error:manager.service_context.llm.complete('Hi what is 5+5?')
(Manager is just a class I wrote that wraps over some LI objects, including a ServiceContext
object. service_context: ServiceContext = ServiceContext.from_defaults( embed_model= AzureOpenAIEmbedding( model="text-embedding-ada-002" , azure_deployment="text-embedding-ada-002" , azure_endpoint=str(settings.azure_openai_api_base) , api_version=str(settings.azure_openai_api_version) , api_key=str(settings.azure_openai_api_key) ) , llm = AzureOpenAI( model="gpt-4" , azure_deployment="gpt-4" , azure_endpoint=str(settings.azure_openai_api_base) , api_version=str(settings.azure_openai_api_version) , api_key=str(settings.azure_openai_api_key) ) )
AttributeError: 'LLMPredictor' object has no attribute '_llm'. Did you mean: 'llm'?
llama-index 0.9.39
system_prompt
kwarg into my ReAct Agent when creating from tools, but it doesn't seem to be having any effect on the agent. When I dig into the source code I'm having a hard time discerning whether ReAct agents really accept this kwarg and do anything with it?