Skip to content

Replace Vercel AI SDK with llm-interface - Phase 1: Basic Integration #130

@bhouston

Description

@bhouston

Replace Vercel AI SDK with llm-interface - Phase 1: Basic Integration

Background

The project currently uses the Vercel AI SDK (ai and @ai-sdk/* packages) to integrate with various LLM providers. However, this integration has not been working well. We propose replacing it with the llm-interface library, which provides a simpler and more consistent way to interact with multiple LLM providers.

Objective

In this first phase, we will:

  1. Remove the Vercel AI SDK dependencies (ai and all @ai-sdk/* packages)
  2. Integrate the llm-interface library
  3. Implement basic support for Anthropic's Claude models

Implementation Plan

1. Add llm-interface dependency

pnpm add llm-interface

2. Remove Vercel AI SDK dependencies

pnpm remove ai @ai-sdk/anthropic @ai-sdk/mistral @ai-sdk/openai @ai-sdk/xai ollama-ai-provider

3. Refactor Core Components

Update config.ts

  • Replace the model initialization functions that currently use Vercel AI SDK with llm-interface equivalents
  • Update the DEFAULT_CONFIG to use llm-interface for the default model

Update toolAgentCore.ts

  • Replace the Vercel AI SDK's generateText function with llm-interface's sendMessage function
  • Adapt the message formatting to work with llm-interface
  • Update the tool call handling to work with llm-interface's response format

Update messageUtils.ts

  • Replace Vercel AI SDK-specific token caching mechanisms with llm-interface equivalents
  • Update message formatting utilities to work with llm-interface

4. Testing

  • Ensure all existing tests pass with the new implementation
  • Add new tests specifically for the llm-interface integration
  • Manually test the agent with various prompts and tools

Future Phases

  • Phase 2: Add support for OpenAI, xAI, and Ollama models
  • Phase 3: Implement token caching with Anthropic

Acceptance Criteria

  • All Vercel AI SDK dependencies are removed
  • llm-interface is successfully integrated
  • The agent can successfully use Anthropic's Claude models
  • All existing functionality is maintained
  • All tests pass

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