Make conversation simulator public and easily subclassable#20243
Make conversation simulator public and easily subclassable#20243smoorjani merged 11 commits intomlflow:masterfrom
Conversation
Signed-off-by: Samraj Moorjani <samraj.moorjani@databricks.com>
🛠 DevTools 🛠
Install mlflow from this PRFor Databricks, use the following command: |
Signed-off-by: Samraj Moorjani <samraj.moorjani@databricks.com>
|
Documentation preview for 205a258 is available at: More info
|
| return "\n".join(formatted) | ||
|
|
||
|
|
||
| def _fetch_traces(all_trace_ids: list[list[str]]) -> list[list["Trace"]]: |
There was a problem hiding this comment.
Would it be better to return traces instead of traceids in _run_conversation directly so that we can remove this transformation?
There was a problem hiding this comment.
Good callout! The reason I do not is because we need to flush the traces (which are logged asynchronously) before retrieving the traces. Instead of doing this in multiple threads, it's much easier to flush all at once and then retrieve the traces.
| The generated user message string. | ||
| """ | ||
|
|
||
| def invoke_llm(self, prompt: str, system_prompt: str | None = None) -> str: |
There was a problem hiding this comment.
qq: is this provided in the abstract class for user's convenience or do we expect the users to use this for inference?
There was a problem hiding this comment.
yes, just for convenience
Signed-off-by: Samraj Moorjani <samraj.moorjani@databricks.com>
Signed-off-by: Samraj Moorjani <samraj.moorjani@databricks.com>
|
|
||
| mlflow.flush_trace_async_logging() | ||
|
|
||
| client = TracingClient() |
There was a problem hiding this comment.
not to reviewer: the alternative to this code is using search traces with a specific bit of metadata, but the logic to reconstruct the order would be more complex than what is presently here. There is no performance difference between using search traces and parallelizing get trace
AveshCSingh
left a comment
There was a problem hiding this comment.
I took a quick pass and left a few small comments, but overall this LGTM. Please feel free to merge after addressing my comments.
| progress_bar.close() | ||
|
|
||
| return all_trace_ids | ||
| return _fetch_traces(all_trace_ids) |
Signed-off-by: Samraj Moorjani <samraj.moorjani@databricks.com>
Related Issues/PRs
#xxxWhat changes are proposed in this pull request?
This PR does two main things:
simulatemethod public as we have validated qualityHow is this PR tested?
result:

Does this PR require documentation update?
Release Notes
Is this a user-facing change?
Make
simulatemethod ofConversationSimulatorpublic and make the user agent easily subclassable to customize conversation simulation..What component(s), interfaces, languages, and integrations does this PR affect?
Components
area/tracking: Tracking Service, tracking client APIs, autologgingarea/models: MLmodel format, model serialization/deserialization, flavorsarea/model-registry: Model Registry service, APIs, and the fluent client calls for Model Registryarea/scoring: MLflow Model server, model deployment tools, Spark UDFsarea/evaluation: MLflow model evaluation features, evaluation metrics, and evaluation workflowsarea/gateway: MLflow AI Gateway client APIs, server, and third-party integrationsarea/prompts: MLflow prompt engineering features, prompt templates, and prompt managementarea/tracing: MLflow Tracing features, tracing APIs, and LLM tracing functionalityarea/projects: MLproject format, project running backendsarea/uiux: Front-end, user experience, plotting, JavaScript, JavaScript dev serverarea/build: Build and test infrastructure for MLflowarea/docs: MLflow documentation pagesHow should the PR be classified in the release notes? Choose one:
rn/none- No description will be included. The PR will be mentioned only by the PR number in the "Small Bugfixes and Documentation Updates" sectionrn/breaking-change- The PR will be mentioned in the "Breaking Changes" sectionrn/feature- A new user-facing feature worth mentioning in the release notesrn/bug-fix- A user-facing bug fix worth mentioning in the release notesrn/documentation- A user-facing documentation change worth mentioning in the release notesShould this PR be included in the next patch release?
Yesshould be selected for bug fixes, documentation updates, and other small changes.Noshould be selected for new features and larger changes. If you're unsure about the release classification of this PR, leave this unchecked to let the maintainers decide.What is a minor/patch release?
Bug fixes, doc updates and new features usually go into minor releases.
Bug fixes and doc updates usually go into patch releases.