Skip to content

Revert Vercel AI SDK adoption and implement clean abstraction for LLM providers #144

@bhouston

Description

@bhouston

Revert Vercel AI SDK adoption and implement clean abstraction for LLM providers

The recent adoption of the Vercel AI SDK has introduced reliability issues. We need to revert these changes and implement a cleaner abstraction for LLM providers using the Anthropic SDK directly.

Background

Tasks

  1. Remove dependencies on Vercel AI SDK (ai and @ai-sdk/* packages)
  2. Create our own message type system with support for:
    • System messages
    • User messages
    • Assistant messages
    • Tool use/result messages
  3. Implement a generic generateText() function that:
    • Takes messages, tools, and standard LLM settings
    • Returns a new set of messages
  4. Create an Anthropic-specific implementation that:
    • Takes API key and model name
    • Returns a function matching the generic generateText() type
    • Handles conversion between our message format and Anthropic's format

Non-goals for this PR

  • Token caching (will be added in a follow-up issue)
  • Support for OpenAI, Ollama, and Grok (will be added in follow-up issues)

Benefits

  • More reliable LLM integration
  • Cleaner abstraction between the application and specific LLM providers
  • Easier to add support for other models in the future

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions