UNPKG

@promptbook/markdown-utils

Version:

Promptbook: Turn your company's scattered knowledge into AI ready books

91 lines (90 loc) 3.62 kB
import { BehaviorSubject } from 'rxjs'; import type { AgentBasicInformation, AgentCapability, BookParameter } from '../../book-2.0/agent-source/AgentBasicInformation'; import type { string_book } from '../../book-2.0/agent-source/string_book'; import type { LlmExecutionTools } from '../../execution/LlmExecutionTools'; import type { ChatPromptResult } from '../../execution/PromptResult'; import type { Prompt } from '../../types/Prompt'; import type { string_agent_hash, string_agent_name, string_agent_url, string_color, string_fonts, string_url_image } from '../../types/typeAliases'; import { AgentLlmExecutionTools } from './AgentLlmExecutionTools'; import type { AgentOptions } from './AgentOptions'; /** * Represents one AI Agent * * Note: [🦖] There are several different things in Promptbook: * - `Agent` - which represents an AI Agent with its source, memories, actions, etc. Agent is a higher-level abstraction which is internally using: * - `LlmExecutionTools` - which wraps one or more LLM models and provides an interface to execute them * - `AgentLlmExecutionTools` - which is a specific implementation of `LlmExecutionTools` that wraps another LlmExecutionTools and applies agent-specific system prompts and requirements * - `OpenAiAssistantExecutionTools` - which is a specific implementation of `LlmExecutionTools` for OpenAI models with assistant capabilities, recommended for usage in `Agent` or `AgentLlmExecutionTools` * - `RemoteAgent` - which is an `Agent` that connects to a Promptbook Agents Server * * @public exported from `@promptbook/core` */ export declare class Agent extends AgentLlmExecutionTools implements LlmExecutionTools, AgentBasicInformation { #private; private _agentName; /** * Name of the agent */ get agentName(): string_agent_name; /** * Description of the agent */ personaDescription: string | null; /** * The initial message shown to the user when the chat starts */ initialMessage: string | null; /** * Links found in the agent source */ links: Array<string_agent_url>; /** * Capabilities of the agent * This is parsed from commitments like USE BROWSER, USE SEARCH ENGINE, KNOWLEDGE, etc. */ capabilities: Array<AgentCapability>; /** * List of sample conversations (question/answer pairs) */ samples: Array<{ question: string | null; answer: string; }>; /** * Computed hash of the agent source for integrity verification */ get agentHash(): string_agent_hash; /** * Metadata like image or color */ meta: { fullname?: string; image?: string_url_image; link?: string; font?: string_fonts; color?: string_color; title?: string; description?: string; [key: string]: string | undefined; }; /** * Human-readable titles for tool functions */ toolTitles: Record<string, string>; /** * Not used in Agent, always returns empty array */ get parameters(): Array<BookParameter>; readonly agentSource: BehaviorSubject<string_book>; private readonly teacherAgent; constructor(options: AgentOptions); /** * Calls the chat model with agent-specific system prompt and requirements with streaming * * Note: This method also implements the learning mechanism */ callChatModelStream(prompt: Prompt, onProgress: (chunk: ChatPromptResult) => void): Promise<ChatPromptResult>; } /** * TODO: [🧠][😰]Agent is not working with the parameters, should it be? */