Skip to content

Conversation

tuntisz
Copy link

@tuntisz tuntisz commented Jul 10, 2025

Add LlamaIndex Agent Framework Support

This PR implements comprehensive support for LlamaIndex as an agent framework in the AI Data Stream project, enabling streaming AI responses that comply with Vercel's AI SDK Data Stream Protocol.

Key Changes

Core Implementation:

  • Added LlamaIndexStreamer class that implements both sync and async streaming interfaces
  • Added LlamaIndexMessageParser for converting between internal and LlamaIndex message formats
  • Added LlamaIndexStreamConverter for transforming LlamaIndex responses to data stream protocol format
  • Added DataStreamToolCallDelta class to handle incremental tool call updates

Features:

  • Full support for streaming text responses
  • Tool call and tool result handling
  • Memory management and conversation history preservation
  • Both synchronous and asynchronous interfaces
  • Proper protocol ordering (start → content/tool calls → finish)

Testing:

  • Comprehensive scenario-based test suite covering:
    • Simple text streaming
    • Tool calls (single and parallel)
    • Multi-turn conversations
    • Edge cases and error handling
  • Mock utilities for testing without real LlamaIndex agents

Configuration:

  • Added optional llama-index dependency group in pyproject.toml
  • Updated .gitignore to exclude Claude Swarm configuration files
  • Updated dependency versions (aiohappyeyeballs, aiohttp)

Documentation

  • Added detailed README in ai_datastream/agent/llamaindex/
  • Includes usage examples, architecture details, and integration guides

@ofek1weiss
Copy link
Collaborator

@tuntisz if you could add this framework as a bullet in the main README file that would be awesome

Copy link
Collaborator

@ofek1weiss ofek1weiss left a comment

Choose a reason for hiding this comment

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

Just make sure to fix the pre-commit issues

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.

2 participants