Skip to content

feat(examples): add useAskableSource and subscribeAsync examples — new APIs have no reference implementation #279

Description

@vamgan

Summary

The three newest public APIs — useAskableSource, subscribeAsync / toPromptContextAsync, and async sanitizeItem — have no working example in either examples/analytics-dashboard-react or examples/react-native-expo. Users adopting these features have no reference implementation to copy.

What's missing

1. useAskableSource / collection source

No example shows:

  • Registering a collection source (e.g. a table or list of items)
  • Calling handle.notifyChanged() when data updates
  • Wiring the source into an AI sidebar

2. subscribeAsync / toPromptContextAsync

No example shows:

  • Setting up an async subscriber for multi-turn context
  • Passing async context into an LLM call (Vercel AI SDK, CopilotKit, Anthropic)
  • Handling the onError callback

3. Async sanitizeItem

No example shows redacting or enriching individual collection items before they reach the AI.

Suggested additions

  • Add a "data sources" panel to examples/analytics-dashboard-react that:
    • Registers a useAskableSource for the deals table
    • Subscribes with subscribeAsync and streams context into the chat sidebar
    • Uses sanitizeItem to strip an internalId field

Acceptance criteria

  • At least one runnable example demonstrates useAskableSource + notifyChanged
  • At least one example shows subscribeAsync wired into an LLM call
  • Example includes inline comments explaining the async data flow

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions