LLM Provider Types (providers/types.ts)

PraisonAI · src/praisonai-ts/src/llm/providers/types.ts · typescript · MIT
ai, dev-tools, lang:typescript, tag:providers

Type definitions for LLM provider abstraction layer including messages, tool calls, and generation options.

// Source: https://github.com/MervinPraison/PraisonAI | License: MIT
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * LLM Provider Types - Core type definitions for the provider abstraction layer
 */

export interface Message {
  role: 'system' | 'user' | 'assistant' | 'tool';
  content: string | null;
  name?: string;
  tool_call_id?: string;
  tool_calls?: ToolCall[];
}

export interface ToolCall {
  id: string;
  type: 'function';
  function: {
    name: string;
    arguments: string;
  };
}

export interface ToolDefinition {
  name: string;
  description?: string;
  parameters?: Record<string, any>;
}

export interface TokenUsage {
  promptTokens: number;
  completionTokens: number;
  totalTokens: number;
}

export interface GenerateTextOptions {
  messages: Mess

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key