Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENH] accessing the run steps with GPTAssistantAgent #715

Closed
YannDubs opened this issue Nov 19, 2023 · 8 comments
Closed

[ENH] accessing the run steps with GPTAssistantAgent #715

YannDubs opened this issue Nov 19, 2023 · 8 comments

Comments

@YannDubs
Copy link
Collaborator

YannDubs commented Nov 19, 2023

The current GPTAssistantAgent only returns the output from the last step when you call _invoke_assistant. But in many cases I would like to be able to see what were the intermediate calls that were made. You can get that information using self.openai_client.beta.beta.threads.runs.steps.list(thread_id=..., run_id=..., order="asc") as shown here. But I don't think you can currently get the run_id of the last call to get those steps. For more interpretability and when developing, it would be nice to either:

  1. save the latest run_id to be able to get the steps
    and/or
  2. have an option in _invoke_assistant to return all the steps

E.g. this i useful when using web search or code_interpreter to know what were the arguments and how many calls were there.

Ps: thanks for the great library 💯

@YannDubs YannDubs changed the title [ENH] saving the latest run/steps with GPTAssistantAgent [ENH] accessing the run steps with GPTAssistantAgent Nov 19, 2023
@gagb
Copy link
Collaborator

gagb commented Nov 20, 2023

@YannDubs checkout this PR #665 Feel free to review it and suggest improvements. Would like to get this merged before thanksgiving

@YannDubs
Copy link
Collaborator Author

Thanks @gagb, But I don't quite see how the PR addresses the issue. You still can't access the run.id after invoking the assistant, right?

@gagb
Copy link
Collaborator

gagb commented Nov 21, 2023

It doesn't yet, but perhaps _get_run_response and _process_messages can be modified to log steps (or add them to the message itself). Or did I misunderstand your question?

response = self._get_run_response(assistant_thread, run)

def _process_messages(self, assistant_thread, run):

@sonichi
Copy link
Contributor

sonichi commented Dec 3, 2023

@IANTHEREAL FYI

@IANTHEREAL
Copy link
Collaborator

IANTHEREAL commented Dec 4, 2023

@YannDubs We have implemented a feature that logs more (the parameters and results) on function calls, which should fulfill the requirements for tracing function calls. I am also considering to extend this tracing capability to other tools, such as the code interpreter, in a subsequent phase.

@YannDubs
Copy link
Collaborator Author

YannDubs commented Dec 6, 2023

Thanks, @IANTHEREAL #717 seems useful but still only concerns the function execution, right? It won't show all the steps in the assistant if you use the code interpreter, right?

I might be wrong, but I was under the impression that OpenAI controls those substeps and you can only access them using client.beta.threads.runs.steps

@IANTHEREAL
Copy link
Collaborator

IANTHEREAL commented Dec 6, 2023

@YannDubs Yes. Currently, I have resolved the issue with function call tracing, which is controlled by the external program itself (not openai api). To tracing openai built-in tools like code interpreter, it is necessary to utilize the client.beta.threads.runs.steps api, which I will work on it in my free time

@thinkall
Copy link
Collaborator

Closing this issue due to inactivity. If you have further questions, please open a new issue or join the discussion in AutoGen Discord server: https://discord.com/invite/Yb5gwGVkE5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants