Skip to content

feat(apollo-vertex): switch ai chat to tanstack ai [AGVSOL-1682]#343

Open
pieman1313 wants to merge 6 commits intomainfrom
feat/ai-chat-anthropic-provider
Open

feat(apollo-vertex): switch ai chat to tanstack ai [AGVSOL-1682]#343
pieman1313 wants to merge 6 commits intomainfrom
feat/ai-chat-anthropic-provider

Conversation

@pieman1313
Copy link
Contributor

@pieman1313 pieman1313 commented Mar 13, 2026

can be tested e2e here feat/ai-chat-anthropic

Mar-13-2026 13-44-35

Copilot AI review requested due to automatic review settings March 13, 2026 13:48
@github-actions
Copy link

github-actions bot commented Mar 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (PT)
apollo-canvas 🟢 Ready Preview, Logs Mar 23, 2026, 05:26:41 AM
apollo-landing 🟢 Ready Preview, Logs Mar 23, 2026, 05:24:07 AM
apollo-ui-react 🟢 Ready Preview, Logs Mar 23, 2026, 05:25:39 AM
apollo-vertex 🟢 Ready Preview, Logs Mar 23, 2026, 05:25:10 AM
apollo-wind 🟢 Ready Preview, Logs Mar 23, 2026, 05:24:12 AM

@pieman1313 pieman1313 requested a review from VKravchuk March 13, 2026 13:48
@KokoMilev KokoMilev enabled auto-merge (rebase) March 13, 2026 13:48
@github-actions
Copy link

github-actions bot commented Mar 13, 2026

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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) and AnthropicProvider (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.

@pieman1313 pieman1313 force-pushed the feat/ai-chat-anthropic-provider branch from cb394ae to 52d4503 Compare March 13, 2026 13:58
Copy link
Collaborator

@0xr3ngar 0xr3ngar left a comment

Choose a reason for hiding this comment

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

talking in a slack thread

Copilot AI review requested due to automatic review settings March 17, 2026 08:46
@pieman1313 pieman1313 force-pushed the feat/ai-chat-anthropic-provider branch from 52d4503 to 76ccf97 Compare March 17, 2026 08:46
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 via model.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-loop directive a couple of lines below this block that does not include a justification suffix. With unicorn/no-abusive-eslint-disable enabled for this app, the disable comment should include a reason (e.g. -- streaming reader loop) or be refactored away; otherwise pnpm lint is likely to fail.

@pieman1313 pieman1313 force-pushed the feat/ai-chat-anthropic-provider branch from 76ccf97 to 3a5acd2 Compare March 17, 2026 08:54
Copilot AI review requested due to automatic review settings March 19, 2026 08:48
@pieman1313 pieman1313 force-pushed the feat/ai-chat-anthropic-provider branch from 3a5acd2 to 743882e Compare March 19, 2026 08:48
@github-actions
Copy link

Dependency License Review

  • 1922 package(s) scanned
  • ✅ No license issues found
  • ⚠️ 3 package(s) excluded (see details below)
License distribution
License Packages
MIT 1687
ISC 89
Apache-2.0 56
BSD-3-Clause 28
BSD-2-Clause 23
BlueOak-1.0.0 8
MPL-2.0 5
MIT OR Apache-2.0 3
MIT-0 3
CC0-1.0 3
LGPL-3.0-or-later 2
(MIT OR Apache-2.0) 2
Unlicense 2
Python-2.0 1
CC-BY-4.0 1
(MPL-2.0 OR Apache-2.0) 1
Unknown 1
Artistic-2.0 1
(WTFPL OR MIT) 1
(BSD-2-Clause OR MIT OR Apache-2.0) 1
CC-BY-3.0 1
0BSD 1
(MIT OR CC0-1.0) 1
MIT AND ISC 1
Excluded packages
Package Version License Reason
@img/sharp-libvips-linux-x64 1.2.4 LGPL-3.0-or-later LGPL pre-built binary, not linked
@img/sharp-libvips-linuxmusl-x64 1.2.4 LGPL-3.0-or-later LGPL pre-built binary, not linked
khroma 2.1.0 Unknown MIT per GitHub repo, missing license field in package.json

@pieman1313 pieman1313 changed the title feat(apollo-vertex): ai chat anthropic agenthub provider [AGVSOL-1682] feat(apollo-vertex): switch ai chat to tanstack ai [AGVSOL-1682] Mar 19, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 StreamChunk mapping).
  • 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

Copilot AI review requested due to automatic review settings March 20, 2026 08:02
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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/Tools to TanStack AI UIMessage + AnyClientTool and introduce ToolRenderers typing.
  • 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

Comment on lines +57 to +68
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]);
Copy link
Collaborator

Choose a reason for hiding this comment

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

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

@pieman1313 pieman1313 force-pushed the feat/ai-chat-anthropic-provider branch from 64f1cf2 to f67b80f Compare March 23, 2026 09:23
Copilot AI review requested due to automatic review settings March 23, 2026 09:46
@pieman1313 pieman1313 force-pushed the feat/ai-chat-anthropic-provider branch from f67b80f to 5baadbe Compare March 23, 2026 09:46
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 27 out of 28 changed files in this pull request and generated 4 comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

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.

5 participants