Skip to main content

Overview

The LLM package in Agenite provides utilities for working with language models, including message formatting, content types, and provider interfaces.

Message types

Base message

Content blocks

Messages can contain different types of content:

Provider interface

The core LLM Provider interface:

Generate options

Response types

Base provider implementation

The BaseLLMProvider class provides a base implementation of the LLM provider interface:

Utility functions

String to message conversion

Tool definition

Example usage

Simple generation

Streaming responses

Tool usage

Creating a custom provider

Best practices

  1. Message formatting: Use the standard message format for consistent behavior
  2. Error handling: Implement robust error handling in custom providers
  3. Streaming: Support streaming for better user experience with long responses
  4. Token tracking: Track token usage for monitoring and rate limiting
  5. Content typing: Use the appropriate content block types for rich responses

Next steps