Skip to content

Make model context window optional #362

@bhouston

Description

@bhouston

Description

Make the context window size for models optional, allowing models without a specified context window to fall back to undefined.

Changes

  • Modified the LLMResponse interface to use contextWindow instead of maxTokens
  • Updated provider implementations to handle undefined context windows
  • Modified status updates and token usage tracking to work with or without a context window
  • Removed automatic triggering of the compact tool when no context window is known

Motivation

This change allows the system to work with models that don't have a known context window size, making the system more flexible with custom or new models.

Implementation

  • The changes have been made to several files in the agent package:
    • core/llm/types.ts
    • core/llm/providers/anthropic.ts
    • core/llm/providers/ollama.ts
    • core/llm/providers/openai.ts
    • core/toolAgent/statusUpdates.ts
    • core/toolAgent/toolAgentCore.ts

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