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

Clean up the mlflow trace for tool calling #47

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

epec254
Copy link
Collaborator

@epec254 epec254 commented Nov 19, 2024

Related Issues/PRs

What changes are proposed in this pull request?

Clean up the Mlflow trace from the openai SDK function calling agent. Goal was to make the inputs/outputs + how the iterations run + how the tool function is called more clear in the trace / the code easier to read.

How is this PR tested?

Screenshot 2024-11-18 at 8 55 03 PM

# messages should be returned back to the Review App (or any other front end app) and stored there so it can be passed back to this stateless agent with the next turns of converastion.
"messages": messages_log_with_tool_calls,
}

@mlflow.trace(span_type="AGENT")
@mlflow.trace(span_type="CHAIN")
Copy link
Collaborator

Choose a reason for hiding this comment

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

QQ, why change from agent to chain?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Mostly asking since this does still seem like the core agentic loop logic

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

(same thinking as below)

+ tool_messages
)
i += 1
with mlflow.start_span(name=f"iteration_{i}", span_type="CHAIN") as span:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same question here RE "CHAIN" vs "AGENT"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I mirrored what LangGraph traces looked like here - they use a CHAIN for this type of logic. My thinking: this span represents logic that is actually a deterministic chain of steps.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Got it, thanks! Do you have a pointer to a LangGraph "CHAIN" tracing example? i'm wondering if LangGraph uses that span name mostly writing a fixed chain, since the logic in this function calling agent thing looks similar to the Python equivalent of a LangGraph agent (e.g. if you translated something like LangGraph create_react_agent into Python code)

Copy link
Collaborator

@smurching smurching left a comment

Choose a reason for hiding this comment

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

LGTM in general! Still curious to learn more about the CHAIN tracing example from langgraph

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

Successfully merging this pull request may close these issues.

2 participants