[Vercel #4] Add doc + chat UI support for Vercel AI SDK integration#18590
[Vercel #4] Add doc + chat UI support for Vercel AI SDK integration#18590B-Step62 merged 15 commits intomlflow:masterfrom
Conversation
Signed-off-by: B-Step62 <yuki.watanabe@databricks.com>
Signed-off-by: B-Step62 <yuki.watanabe@databricks.com>
Signed-off-by: B-Step62 <yuki.watanabe@databricks.com>
|
@B-Step62 Thank you for the contribution! Could you fix the following issue(s)? ⚠ DCO checkThe DCO check failed. Please sign off your commit(s) by following the instructions here. See https://github.com/mlflow/mlflow/blob/master/CONTRIBUTING.md#sign-your-work for more details. |
8215812 to
e8beb2d
Compare
Signed-off-by: B-Step62 <yuki.watanabe@databricks.com>
e8beb2d to
3e02d3a
Compare
|
Documentation preview for 39c2851 is available at: Changed Pages (1)More info
|
| if (typedObj.type === 'text' && has(obj, 'text') && isString(typedObj.text)) { | ||
| return true; | ||
| } | ||
|
|
There was a problem hiding this comment.
The check typedObj.image instanceof URL could be problematic in environments where URL objects are serialized/deserialized (e.g., across worker boundaries or from JSON).
Consider using a more robust check like:
if (typedObj.type === 'image' && has(obj, 'image')) {
return isString(typedObj.image) ||
(isObject(typedObj.image) && typeof typedObj.image.toString === 'function');
}Or simply check if it's a string or has a valid URL-like structure.
Reviewed by Claude Code on behalf of daniellok-db
There was a problem hiding this comment.
would it ever be URL actually? since the data comes from JSON it seems like it should always be a string
There was a problem hiding this comment.
Good question, yea it shouldn't be for our case, the code just mirrors vercel spec without thinking.
mlflow/server/js/src/shared/web-shared/model-trace-explorer/chat-utils/vercelai.test.ts
Outdated
Show resolved
Hide resolved
mlflow/server/js/src/shared/web-shared/model-trace-explorer/chat-utils/vercelai.ts
Show resolved
Hide resolved
daniellok-db
left a comment
There was a problem hiding this comment.
Overall Review Summary
This PR adds comprehensive support for Vercel AI SDK integration with MLflow tracing. The implementation is well-structured and follows existing patterns in the codebase.
Highlights ✨
- Comprehensive format support: Handles multiple input/output formats from Vercel AI SDK (messages, prompt, text, response.text, etc.)
- Strong type safety: Good use of TypeScript type guards and discriminated unions
- Excellent test coverage: Tests cover various scenarios including edge cases
- Clean refactoring: The Card component refactoring improves code maintainability
- Good documentation: Clear examples and usage instructions for users
Areas for Improvement 🔧
I've left inline comments on specific areas that could be enhanced:
- Type safety in URL checking: The
instanceof URLcheck could be more robust for serialized objects - JSDoc documentation: Adding JSDoc to exported functions would improve maintainability
- Test coverage: Consider adding tests for malformed input data
- Documentation clarity: Adding guidance on how to get/create experiment IDs would help new users
Recommendation
The code is production-ready and well-implemented. The suggestions above are minor improvements that can be addressed if desired, but they don't block merging.
Great work on this integration! 🎉
Reviewed by Claude Code on behalf of daniellok-db
docs/src/components/Card/index.tsx
Outdated
| </Link> | ||
| ) : ( | ||
| export const SmallLogoCard = ({ children, link }) => { | ||
| const Wrapper = link ? Link : 'div'; |
There was a problem hiding this comment.
does this work? i'm surprised that a string can be called as JSX component. have we checked any callsites where we don't provide the link prop?
There was a problem hiding this comment.
Actually I don't see usage of this card without link, lemme remove the branch.
| return { type: 'text', text: item.text }; | ||
| } | ||
| case 'image': { | ||
| const imageUrl = item.image instanceof URL ? item.image.toString() : item.image; |
There was a problem hiding this comment.
same comment here, just curious if it can actually be a URL object. if not then let's remove the conditional and simplify the logic
…lflow#18590) Signed-off-by: B-Step62 <yuki.watanabe@databricks.com> Signed-off-by: Yuki Watanabe <31463517+B-Step62@users.noreply.github.com>
…lflow#18590) Signed-off-by: B-Step62 <yuki.watanabe@databricks.com> Signed-off-by: Yuki Watanabe <31463517+B-Step62@users.noreply.github.com>
🥞 Stacked PR
Use this link to review incremental changes.
What changes are proposed in this pull request?
Support rich chat rendering for Vercel AI SDK integration and add docs.
How is this PR tested?
See video in the doc
Does this PR require documentation update?
Release Notes
Is this a user-facing change?
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.