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

[Add] Logging for each message of GPTAssistant #2677

Closed
wants to merge 7 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions autogen/agentchat/contrib/gpt_assistant_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ def __init__(
if logging_enabled():
log_new_agent(self, locals())

if logging_enabled():
log_new_agent(self, locals())

# GPTAssistantAgent's azure_deployment param may cause NotFoundError (404) in client.beta.assistants.list()
# See: https://github.com/microsoft/autogen/pull/1721
model_name = self.DEFAULT_MODEL_NAME
Expand Down Expand Up @@ -215,6 +218,12 @@ def _invoke_assistant(
role=message["role"],
)

self.client.create(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really understand the log related implement, but I would like to know if it will call openai completion function?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.create() calls the log_chat_completion() which is responsible only for logging data into sqlite DB.

its the self._get_run_response() which makes openai chat completions call

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for the GPTAssistantAgent we use the run to get the responses from the assistant. i think calling the openai completion doesn't add up to the actual assistant logs.

context=messages[-1].pop("context", None),
messages=messages,
cache=self.client_cache,
)

# Create a new run to get responses from the assistant
run = self._openai_client.beta.threads.runs.create(
thread_id=assistant_thread.id,
Expand Down
Loading