Skip to content

Clean up the mlflow trace for tool calling#47

Open
epec254 wants to merge 3 commits into
mainfrom
update_tool_calling_tracing
Open

Clean up the mlflow trace for tool calling#47
epec254 wants to merge 3 commits into
mainfrom
update_tool_calling_tracing

Conversation

@epec254

@epec254 epec254 commented Nov 19, 2024

Copy link
Copy Markdown
Contributor

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

}

@mlflow.trace(span_type="AGENT")
@mlflow.trace(span_type="CHAIN")

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor 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
Copy Markdown
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
Copy Markdown
Contributor 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
Copy Markdown
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)

@smurching smurching left a comment

Copy link
Copy Markdown
Collaborator

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