feat(apollo-vertex): switch ai chat to tanstack ai [AGVSOL-1682]#343
feat(apollo-vertex): switch ai chat to tanstack ai [AGVSOL-1682]#343pieman1313 wants to merge 6 commits intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
There was a problem hiding this comment.
Pull request overview
Adds UiPath AgentHub-backed LLM providers to the apollo-vertex AI Chat utilities, restructuring provider code under an agenthub/ namespace and documenting usage for both OpenAI and Anthropic models.
Changes:
- Introduces AgentHub provider implementations:
OpenAIProvider(OpenAI-compatible endpoint) andAnthropicProvider(normalized Anthropic endpoint). - Refactors shared request/stream helpers into
agenthub/utils(buildBaseMessages,readAIStream). - Updates docs, templates, and registry mappings to the new provider paths.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| apps/apollo-vertex/templates/AiChatTemplate.tsx | Switches demo import/usage to OpenAIProvider. |
| apps/apollo-vertex/registry/ai-chat/utils/providers/agenthub/utils/agenthub-stream.ts | Renames/centralizes SSE streaming reader as readAIStream. |
| apps/apollo-vertex/registry/ai-chat/utils/providers/agenthub/utils/agenthub-messages.ts | Introduces shared BaseMessage + buildBaseMessages. |
| apps/apollo-vertex/registry/ai-chat/utils/providers/agenthub/openai/openai-provider.ts | Implements AgentHub OpenAI-compatible provider using shared helpers. |
| apps/apollo-vertex/registry/ai-chat/utils/providers/agenthub/openai/openai-messages.ts | Adds OpenAI-native tool definition builder. |
| apps/apollo-vertex/registry/ai-chat/utils/providers/agenthub/anthropic/anthropic-provider.ts | Adds AgentHub normalized Anthropic provider. |
| apps/apollo-vertex/registry/ai-chat/utils/providers/agenthub/anthropic/anthropic-messages.ts | Adds BaseMessage→Anthropic conversion + Anthropic tool definitions. |
| apps/apollo-vertex/registry/ai-chat/utils/ai-chat-types.ts | Updates barrel exports to include new providers/configs. |
| apps/apollo-vertex/registry.json | Updates registry file mappings to new provider locations (+ minor formatting change). |
| apps/apollo-vertex/app/vertex-components/ai-chat/page.mdx | Updates documentation and examples for AgentHub providers. |
apps/apollo-vertex/registry/ai-chat/utils/providers/agenthub/anthropic/anthropic-messages.ts
Outdated
Show resolved
Hide resolved
cb394ae to
52d4503
Compare
0xr3ngar
left a comment
There was a problem hiding this comment.
talking in a slack thread
apps/apollo-vertex/registry/ai-chat/utils/providers/agenthub/anthropic/anthropic-messages.ts
Outdated
Show resolved
Hide resolved
52d4503 to
76ccf97
Compare
There was a problem hiding this comment.
Pull request overview
Introduces a unified AgentHubProvider for the Apollo Vertex AI Chat, routing all LLM interactions through UiPath AgentHub’s normalized endpoint and updating the demo, registry mapping, and documentation accordingly.
Changes:
- Replaced the OpenAI-specific provider with a new unified
AgentHubProvider(supports OpenAI + Anthropic wire formats viamodel.vendor). - Added AgentHub message serialization and OpenAI-compatible SSE stream reader utilities; removed the old OpenAI provider implementation.
- Updated exports (
ai-chat-types), registry wiring, and the AI Chat docs to reflect the new provider.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| apps/apollo-vertex/templates/AiChatTemplate.tsx | Swaps the demo to use AgentHubProvider and the { vendor, name } model config. |
| apps/apollo-vertex/registry/ai-chat/utils/providers/openai/openai-provider.ts | Removes the OpenAI-specific provider implementation. |
| apps/apollo-vertex/registry/ai-chat/utils/providers/openai/openai-messages.ts | Removes OpenAI-specific message/tool-definition builders. |
| apps/apollo-vertex/registry/ai-chat/utils/providers/agenthub/agenthub-provider.ts | Adds the unified AgentHub provider that hits /chat/completions and streams responses. |
| apps/apollo-vertex/registry/ai-chat/utils/providers/agenthub/agenthub-messages.ts | Adds normalized message + tool-definition builders, including Anthropic-specific constraints. |
| apps/apollo-vertex/registry/ai-chat/utils/providers/agenthub/agenthub-stream.ts | Renames/generalizes the SSE reader to readAIStream and broadens data: parsing. |
| apps/apollo-vertex/registry/ai-chat/utils/ai-chat-types.ts | Re-exports AgentHub provider/types for consumers; removes OpenAI provider exports. |
| apps/apollo-vertex/registry.json | Updates the registry wiring to include the new AgentHub provider files instead of OpenAI ones. |
| apps/apollo-vertex/app/vertex-components/ai-chat/page.mdx | Updates documentation and examples to use AgentHubProvider and AgentHub base URL. |
Comments suppressed due to low confidence (1)
apps/apollo-vertex/registry/ai-chat/utils/providers/agenthub/agenthub-stream.ts:55
- In this function there is an
// eslint-disable-next-line no-await-in-loopdirective a couple of lines below this block that does not include a justification suffix. Withunicorn/no-abusive-eslint-disableenabled for this app, the disable comment should include a reason (e.g.-- streaming reader loop) or be refactored away; otherwisepnpm lintis likely to fail.
apps/apollo-vertex/registry/ai-chat/utils/providers/agenthub/agenthub-provider.ts
Outdated
Show resolved
Hide resolved
76ccf97 to
3a5acd2
Compare
apps/apollo-vertex/registry/ai-chat/utils/providers/agenthub/agenthub-provider.ts
Outdated
Show resolved
Hide resolved
apps/apollo-vertex/registry/ai-chat/utils/providers/agenthub/agenthub-provider.ts
Outdated
Show resolved
Hide resolved
apps/apollo-vertex/registry/ai-chat/utils/providers/agenthub/agenthub-provider.ts
Outdated
Show resolved
Hide resolved
apps/apollo-vertex/registry/ai-chat/utils/providers/agenthub/agenthub-provider.ts
Outdated
Show resolved
Hide resolved
apps/apollo-vertex/registry/ai-chat/utils/providers/agenthub/agenthub-messages.ts
Outdated
Show resolved
Hide resolved
apps/apollo-vertex/registry/ai-chat/utils/providers/agenthub/agenthub-messages.ts
Outdated
Show resolved
Hide resolved
apps/apollo-vertex/registry/ai-chat/utils/providers/agenthub/agenthub-messages.ts
Outdated
Show resolved
Hide resolved
apps/apollo-vertex/registry/ai-chat/utils/providers/openai/openai-stream.ts
Show resolved
Hide resolved
3a5acd2 to
743882e
Compare
Dependency License Review
License distribution
Excluded packages
|
There was a problem hiding this comment.
Pull request overview
This PR migrates the apollo-vertex AI Chat UI to TanStack AI message types and introduces an AgentHub connection adapter that supports both OpenAI and Anthropic models via UiPath’s normalized LLM gateway.
Changes:
- Add TanStack AI dependencies and refactor the chat UI to accept
UIMessage[]plus typed display tool renderers. - Introduce an AgentHub adapter (message normalization + SSE stream → AG-UI
StreamChunkmapping). - Remove the legacy OpenAI-compatible provider/tool-loop implementation and update registry metadata + docs accordingly.
Reviewed changes
Copilot reviewed 27 out of 28 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Locks newly added TanStack AI dependencies. |
| apps/apollo-vertex/package.json | Adds @tanstack/ai, @tanstack/ai-client, @tanstack/ai-react. |
| apps/apollo-vertex/templates/AiChatTemplate.tsx | Updates demo template to use UIMessage mocks instead of the removed custom hook/provider. |
| apps/apollo-vertex/registry/ai-chat/utils/ai-chat-utils.ts | Updates grouping + “choices” extraction to work on TanStack UIMessage parts. |
| apps/apollo-vertex/registry/ai-chat/types.ts | Adds typed display-tool renderer helpers (toolRenderer, buildToolRenderers). |
| apps/apollo-vertex/registry/ai-chat/components/ai-chat.tsx | Switches component props from internal ChatMessage/tools to UIMessage/toolRenderers. |
| apps/apollo-vertex/registry/ai-chat/components/ai-chat-message.tsx | Renders TanStack TextPart + tool-call parts and inline display tools. |
| apps/apollo-vertex/registry/ai-chat/components/ai-chat-suggestions.tsx | Updates imports for suggestion option types. |
| apps/apollo-vertex/registry/ai-chat/components/ai-chat-tool-group.tsx | Updates tool call rendering to TanStack ToolCallPart shape. |
| apps/apollo-vertex/registry/ai-chat/components/ai-chat-tool-group-message.tsx | Updates tool grouping message to TanStack tool-call fields. |
| apps/apollo-vertex/registry/ai-chat/adapters/agenthub/types.ts | Defines AgentHub adapter config (vendor/model/tools). |
| apps/apollo-vertex/registry/ai-chat/adapters/agenthub/tools.ts | Builds vendor-specific tool definitions for the AgentHub request payload. |
| apps/apollo-vertex/registry/ai-chat/adapters/agenthub/sse.ts | Adds a simple OpenAI-style SSE data: JSON parser. |
| apps/apollo-vertex/registry/ai-chat/adapters/agenthub/messages.ts | Converts UIMessage[] into AgentHub “normalized” wire messages (including tool calls/results). |
| apps/apollo-vertex/registry/ai-chat/adapters/agenthub/stream.ts | Fetches /chat/completions and maps SSE deltas into AG-UI StreamChunk events. |
| apps/apollo-vertex/registry/ai-chat/adapters/agenthub/adapter.ts | Provides a TanStack-AI-friendly stream factory wrapper around the AgentHub fetcher. |
| apps/apollo-vertex/registry.json | Updates registry entry: new deps + new file list (AgentHub adapter + types), removes legacy provider/hook files. |
| apps/apollo-vertex/app/vertex-components/ai-chat/page.mdx | Updates docs to TanStack AI + AgentHub adapter usage and new display-tool renderer pattern. |
| apps/apollo-vertex/registry/ai-chat/utils/providers/openai/openai-stream.ts | Removes legacy OpenAI SSE stream reader. |
| apps/apollo-vertex/registry/ai-chat/utils/providers/openai/openai-provider.ts | Removes legacy OpenAI provider implementation. |
| apps/apollo-vertex/registry/ai-chat/utils/providers/openai/openai-messages.ts | Removes legacy internal → OpenAI message/tool-definition conversion. |
| apps/apollo-vertex/registry/ai-chat/utils/ai-chat-types.ts | Removes legacy AI chat public type surface tied to the old provider/hook. |
| apps/apollo-vertex/registry/ai-chat/utils/ai-chat-tool-types.ts | Removes legacy tool typing model (execute/display) tied to the removed loop. |
| apps/apollo-vertex/registry/ai-chat/utils/ai-chat-provider.ts | Removes legacy LLMProvider interface. |
| apps/apollo-vertex/registry/ai-chat/utils/ai-chat-message-types.ts | Removes legacy internal message/part types. |
| apps/apollo-vertex/registry/ai-chat/utils/ai-chat-loop.ts | Removes legacy agentic tool-loop implementation. |
| apps/apollo-vertex/registry/ai-chat/utils/ai-chat-api.ts | Removes legacy helpers (token resolve + executeToolCall). |
| apps/apollo-vertex/registry/ai-chat/hooks/use-ai-chat.ts | Removes legacy useAiChat hook in favor of TanStack useChat. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
There was a problem hiding this comment.
Pull request overview
This PR updates the apollo-vertex AI Chat registry component to use TanStack AI primitives (messages/tools/streaming) and replaces the previous custom OpenAI-compatible provider + agent loop with an AgentHub streaming adapter and typed display-tool renderers.
Changes:
- Switch AI Chat message/tool types from custom
ChatMessage/Toolsto TanStack AIUIMessage+AnyClientTooland introduceToolRendererstyping. - Add AgentHub adapter (message normalization, tool definition mapping, SSE→AG-UI stream chunk mapping).
- Update docs/template/registry metadata and add required dependencies (
@tanstack/ai*,eventsource-parser).
Reviewed changes
Copilot reviewed 26 out of 27 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Adds TanStack AI and eventsource-parser dependencies; bumps shadcn. |
| apps/apollo-vertex/package.json | Declares new TanStack AI and eventsource-parser deps. |
| apps/apollo-vertex/templates/AiChatTemplate.tsx | Updates demo template to use UIMessage and mock TanStack-style parts. |
| apps/apollo-vertex/registry/ai-chat/utils/ai-chat-utils.ts | Updates grouping + suggestion parsing to operate on UIMessage parts and embeds choices schema. |
| apps/apollo-vertex/registry/ai-chat/types.ts | Adds ToolRenderers mapped type and re-exports choice types. |
| apps/apollo-vertex/registry/ai-chat/components/ai-chat.tsx | Makes <AiChat> generic over TanStack tools and switches from tools to toolRenderers. |
| apps/apollo-vertex/registry/ai-chat/components/ai-chat-message.tsx | Renders tool UI via typed renderers keyed by tool name; parses tool args from tc.input/tc.arguments. |
| apps/apollo-vertex/registry/ai-chat/components/ai-chat-tool-group.tsx | Updates tool call display to TanStack tool call part shape (id/name). |
| apps/apollo-vertex/registry/ai-chat/components/ai-chat-tool-group-message.tsx | Updates tool call filtering to use TanStack tool call part shape. |
| apps/apollo-vertex/registry/ai-chat/components/ai-chat-suggestions.tsx | Imports choice types from new shared types.ts. |
| apps/apollo-vertex/registry/ai-chat/adapters/agenthub/types.ts | Introduces AgentHub adapter config + vendor model typing. |
| apps/apollo-vertex/registry/ai-chat/adapters/agenthub/tools.ts | Builds vendor-specific tool definition payloads from TanStack tool schemas. |
| apps/apollo-vertex/registry/ai-chat/adapters/agenthub/messages.ts | Converts TanStack UIMessage[] to AgentHub normalized request format. |
| apps/apollo-vertex/registry/ai-chat/adapters/agenthub/stream.ts | Implements fetch + SSE parsing and maps OpenAI deltas into AG-UI StreamChunks. |
| apps/apollo-vertex/registry/ai-chat/adapters/agenthub/adapter.ts | Exposes a stream factory for consumption by TanStack AI stream(...). |
| apps/apollo-vertex/registry.json | Updates registry entry (description, deps, file list) to new TanStack AI-based layout. |
| apps/apollo-vertex/app/vertex-components/ai-chat/page.mdx | Rewrites docs/examples to use TanStack AI + AgentHub adapter and typed display tools. |
| apps/apollo-vertex/registry/ai-chat/utils/providers/openai/openai-stream.ts | Removed legacy OpenAI SSE parser. |
| apps/apollo-vertex/registry/ai-chat/utils/providers/openai/openai-provider.ts | Removed legacy OpenAI provider. |
| apps/apollo-vertex/registry/ai-chat/utils/providers/openai/openai-messages.ts | Removed legacy OpenAI message/tool conversion. |
| apps/apollo-vertex/registry/ai-chat/utils/ai-chat-types.ts | Removed legacy API surface (custom hook/provider/tools/messages exports). |
| apps/apollo-vertex/registry/ai-chat/utils/ai-chat-tool-types.ts | Removed legacy tool typing/schema exports. |
| apps/apollo-vertex/registry/ai-chat/utils/ai-chat-provider.ts | Removed legacy LLMProvider interface. |
| apps/apollo-vertex/registry/ai-chat/utils/ai-chat-message-types.ts | Removed legacy message/part types. |
| apps/apollo-vertex/registry/ai-chat/utils/ai-chat-loop.ts | Removed legacy agentic tool loop. |
| apps/apollo-vertex/registry/ai-chat/utils/ai-chat-api.ts | Removed legacy config/token/tool execution helpers. |
| apps/apollo-vertex/registry/ai-chat/hooks/use-ai-chat.ts | Removed legacy useAiChat hook. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
apps/apollo-vertex/registry/ai-chat/adapters/agenthub/stream.ts
Outdated
Show resolved
Hide resolved
apps/apollo-vertex/registry/ai-chat/adapters/agenthub/stream.ts
Outdated
Show resolved
Hide resolved
| const render = getToolRenderer(toolRenderers, tc.name); | ||
| if (!render) return []; | ||
|
|
||
| if (tc.input != null) { | ||
| const rendered = render(tc.input); | ||
| if (!rendered) return []; | ||
| return [<div key={tc.id}>{rendered}</div>]; | ||
| } | ||
|
|
||
| const parsed = tryParseJSON(tc.arguments); | ||
| if (parsed == null) return []; | ||
| const rendered = render(parsed as Parameters<typeof render>[0]); |
There was a problem hiding this comment.
I'm not sure if I like this API - why can't we do the stuff tanstack AI did? We just have the useChat hook return the right types - then we provide one simple "chat" message component that renders those and we let users provide their own custom components for the tools
64f1cf2 to
f67b80f
Compare
f67b80f to
5baadbe
Compare
can be tested e2e here feat/ai-chat-anthropic