********** Trace: index_construction **********
vector_store = AzureAISearchVectorStore( search_or_index_client=search_client, filterable_metadata_field_keys=metadata_fields, index_management=IndexManagement.VALIDATE_INDEX, id_field_key="id", chunk_field_key="chunk", embedding_field_key="embedding", embedding_dimensionality=1536, metadata_string_field_key="metadata", doc_id_field_key="doc_id", ) storage_context = StorageContext.from_defaults(vector_store=vector_store) index = VectorStoreIndex.from_documents( [], storage_context=storage_context, callback_manager=callback_manager )
thread = Thread(target=agent.stream_chat, args=(query)) thread.start()
def query_llama_index(query, agent): response = agent.stream_chat(query) queries = ["riddle me this", riddle me that"] for query in queries: thread = Thread(target=query_llama_index, args=(query, agent)) thread.start() thread.join()
def event_generator(): queue = agent.callback_manager.handlers[0].queue # stream response while True: next_item = queue.get(True, 60.0) # set a generous timeout of 60 seconds # check type of next_item, if string or not if isinstance(next_item, EventObject): yield convert_sse(dict(next_item)) elif isinstance(next_item, StreamingAgentChatResponse): response = cast(StreamingAgentChatResponse, next_item) for text in response.response_gen: yield convert_sse(text) break return StreamingResponse(event_generator(), media_type="text/event-stream")
CallbackManager
BaseEventHandler
llama_index.core.instrumentation.event_handlers
ServiceContext
to Settings
the ContextRelevancyEvaluator
in llama_index.core.evaluation.context_relevancy
imports ServiceContext
in version 10 still. When would this be updated?RetrieverQueryEngine
query_list = [ "What is the Front Setback Distance for a lot if the lot is in a R-1 zone (Single Family Residential 15 acres gross area), the lot width is 91.2 ft , the lot area is 0.5 acre and the front of the lot is 15 ft from the nearest road centerline. Check Front Secondary first for the answer. Provide a step by step process with references of how you came to the required distance. Also provide just the final required distance. \n\nDesired format:\nProcess:\nDistance: ", "What is the Side Setback Distance for a lot if the lot is in a R-1 zone (Single Family Residential 15 acres gross area), the lot width is 91.2 ft Make sure the answer is no less or more than what is required. Provide a step by step process with references of how you came to the required distance. Also provide just the final required distance. \n\nDesired format:\nProcess:\nDistance: ", "What is the Rear Setback Distance for a lot if the lot is in a R-1 zone (Single Family Residential 15 acres gross area), the lot width is 91.2 ft , the lot area is 0.5 and the rear of the lot has has no road access. Make sure the answer is no less or more than what is required. Provide a step by step process with references of how you came to the required distance. Also provide just the final required distance. \n\nDesired format:\nProcess:\nDistance: " ] results = [] for i in query_list: res = query_engine.query(i) results.append(res)
from llama_index.indices.query.query_transform.base import HyDEQueryTransform from llama_index.query_engine.transform_query_engine import TransformQueryEngine # Initialize your index and query engines query_engine_1 = YourQueryEngine1() query_engine_2 = YourQueryEngine2() # Define your query transformation hyde = HyDEQueryTransform(include_original=True) # Create an array of query engines query_engines = [query_engine_1, query_engine_2] # Create a TransformQueryEngine with the array of query engines and query transformations transform_query_engine = TransformQueryEngine(query_engines, query_transforms=[transform_1, transform_2]) # Query the index using the TransformQueryEngine response = transform_query_engine.query("Your query") # Process the response # ...
all tools
/usr/local/lib/python3.10/dist-packages/openai/_base_client.py in _request(self, cast_to, options, remaining_retries, stream, stream_cls) 991 992 log.debug("Re-raising status error") --> 993 raise self._make_status_error_from_response(err.response) from None 994 995 return self._process_response( BadRequestError: Error code: 400 - {'error': {'message': "'tool_35.24.020 - Purposes of Commercial Zones_C-2 (Retail Commercial) zone.' does not match '^[a-zA-Z0-9_-]{1,64}$' - 'tools.0.function.name'", 'type': 'invalid_request_error', 'param': None, 'code': None}}