Closed axiomofjoy closed 1 year ago
🤖
Hello,
From your description, it seems like you're expecting the start_trace
and end_trace
methods to be called for each event. However, in the LlamaIndex codebase, these methods are not designed to be called for each event. Instead, they are used to start and end a trace, which is a collection of events.
The start_trace
method is called when a trace is launched, and the end_trace
method is called when a trace is exited. These methods are not tied to individual events, but rather to a collection of events that make up a trace. If you've implemented your flush logic inside of end_trace
, it would only be called when a trace is ended, not when an individual event ends.
The on_event_start
and on_event_end
methods are the ones that are called for each event. If you want to perform some action at the start or end of each event, you should implement that logic inside these methods.
As for the ValueError
related to mismatched project names in GCSFileSystem
and issues with the Google Compute Engine metadata service, it would be helpful if you could provide more details about the error message and the context in which it occurs. This would help in diagnosing the issue and providing a solution.
I hope this clarifies the usage of start_trace
, end_trace
, on_event_start
, and on_event_end
in the LlamaIndex codebase. If you have any more questions, feel free to ask.
Best, Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
If you want to continue the conversation, start your reply with @dosu-bot.
@axiomofjoy so the reason is
I guess the solution here is to add trace events to the chat engines/agents
I can try and tackle that tomorrow morning 👍🏻 Shouldn't be too bad
Sounds good, thanks @logan-markewich!
@axiomofjoy created a PR to tackle this!
@sourabhdesai Nice, excited to try it out!
Bug Description
While building a callback and testing with an OpenAI chat agent, I noticed that the
on_event_start
andon_event_end
callback hooks are called without being preceded by a call tostart_trace
and without being followed by a call toend_trace
. I had implemented the flush logic inside ofend_trace
, so my accumulated trace data is not flushed at the end of the trace.Version
latest main (3506143d)
Steps to Reproduce
Run the following script:
Relevant Logs/Tracbacks