Find answers from the community

Home
Members
Simon πŸ“πŸ› 
S
Simon πŸ“πŸ› 
Offline, last seen 2 weeks ago
Joined September 25, 2024
Does AzureAISearchVectorStore support a callback manager?
I only get the message
Plain Text
**********
Trace: index_construction
**********

and no other Events

My code is as follows:
Plain Text
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
)
14 comments
L
S
Has anyone had any experience with creating and loading Multi-Doc Agents in the cloud?
I have used the Multi-Doc Agents v1 notebook as a starting point and I want to load these Agents and top agent on a server (I have 10,000+ agents..)
Any suggestions how I could do this? Preferably using Azure.
3 comments
L
S
Is there a way to run multiple OpenAIAgents using the callback manager concurrently?
I have tried the following for one query to one OpenAIAgent 'top_agent':
Plain Text
thread = Thread(target=agent.stream_chat, args=(query))
thread.start()

Which works for one query but if I want to run multiple queries concurrently I tried the following using Threading:
Plain Text
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()

This runs however I receive no output from the Stream. My StreamingResponse looks like below:
Plain Text
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")

Can OpenAIAgent's be used in multiple threads? If so, how do I 'queue' all these callbacks in the one queue and receive them?
1 comment
L
With instrumentation deprecated callbacks what does this mean for the
Plain Text
CallbackManager
? For instance I use a callback manager to surface function calls made by agents as a query is being processed. How would I do this with the
Plain Text
BaseEventHandler
in the
Plain Text
llama_index.core.instrumentation.event_handlers
? Is a callback manager used at all when creating an index with callbacks being deprecated?
4 comments
L
S
With the migration from ServiceContext to Settings the ContextRelevancyEvaluator in llama_index.core.evaluation.context_relevancy imports ServiceContext in version 10 still. When would this be updated?
24 comments
L
S
I am using the
Plain Text
RetrieverQueryEngine
to create a custom vector and knowledgegraph index query engine. I have previously stored my vector index with Weaviate when I only needed a vector Index. But know I am using both. What would you suggest is a good production ready place to remotely store my VectorIndex AND KnowledgeGraph Index? Weaviate or somewhere else?
1 comment
W
How do you run a list of queries using the one query engine?
I have tried using asyncio (as I would with openai completions.create) but it is not working.
I even just tried a simple for loop over a list. see below but it doesn't work either. What am I missing?
Plain Text
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)
2 comments
L
Is there a method for returning a Response as a JSON Object? Basically convert the Response object to JSON. Trying to with json.dumps but it’s not serializable. (Just want to check for an β€œin house” method)
1 comment
L
Can TransformQueryEngine take multiple query engines (array of engines)? I asked the LLama chatbot and it provided a response that doesn't work:
Plain Text
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
# ...
10 comments
L
S
Can you fine tune a query engine?
For example I have a CSV file with building lot property development standards i.e. "Front setback primary is 50ft if lot width is greater than 100 feet otherwise Front setback secondary is 20ft".
My query is something like. "What is the Front setback distance for a lot if the lot width is 155 feet and the lot area is 0.5 acre?"
But the query engine is getting confused about whether to select "Primary" over "Secondary".

Can I use the guidance question generator to analyze both trained data (prompt and completion) and context data (complete context to derive answer from)?
9 comments
S
L
Loading multi doc agents from stored indices takes time for every query. Is there a way to pickle an OpenAIAgentWorker?
Tried to pickle
Plain Text
all tools
with the multi-doc agents v1 Notebook and was not able to. Is there a way to save this local object and load it when needed saving time loading every tool at query time?
9 comments
L
S
Is there a way to increase the character limit to be greater than 64 characters? @Logan M
2 comments
L
I am using the multi-doc_agents-v1 google colab notebook and tweaking it with my own data. I ran it fine with the original data set (llama index html files) but with my own data I rely of the tool names to have numbers and periods which seem to not gel with openai chat. Is there a way I can use numbers as they are essential to the hierarchical nature of these documents?
Plain Text
/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}}
6 comments
S
L
The site https://docs.llamaindex.ai/en/stable/ reloads sporadically when viewed on mobile. Used Chrome and Brave
3 comments
S
L
Is there a β€˜RetryGuidelineQueryEngine’ that instead of feeding a β€˜GuidelineEvaluator’ instead use a β€˜CorrectnessEvaluator’?
So I guess it would be called a β€˜RetryCorrectnessQueryEngine’? Does this exist? If not how could I evaluate a response using a golden dataset to check for correctness and retry if necessary?
4 comments
L
S
Does llama index derive answers from the web or only from the context provided?
1 comment
L